执行安装redis报错undefined reference to `__sync_add_and_fetch_4'

本文介绍了一种在32位Linux系统中编译Redis时遇到的未定义引用错误,并提供了通过添加特定编译标志来解决此问题的方法。
执行make命令时报错:
 
zmalloc.o: In function `zmalloc_used_memory':
/var/lib/tcommsvr/redis-2.8.0-rc4/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/var/lib/tcommsvr/redis-2.8.0-rc4/src'
make: *** [all] Error 2
 
产生原因:
 
linux为32位版本。
查看方式:getconf LONG_BIT
 
 
解决办法:
 
执行make命令时加参数:make CFLAGS="-march=i686"

转载于:https://www.cnblogs.com/fanweiwei/p/3552135.html

/usr/bin/ld: CMakeFiles/TestRH.dir/unit_src/test_business_state_machine.cpp.o:(.data.rel.ro._ZTVN3BNE2RH10Controller15MockRobotModuleE[_ZTVN3BNE2RH10Controller15MockRobotModuleE]+0x70): undefined reference to `BNE::RH::Controller::RobotModule::HandleSubStateSucceed(BNE::RH::Controller::SubState&, std::unique_ptr<BNE::RH::Controller::ResponseMessage, std::default_delete<BNE::RH::Controller::ResponseMessage> >&, std::unordered_set<BNE::RH::Controller::SubState, std::hash<BNE::RH::Controller::SubState>, std::equal_to<BNE::RH::Controller::SubState>, std::allocator<BNE::RH::Controller::SubState> >&)' /usr/bin/ld: CMakeFiles/TestRH.dir/unit_src/test_business_state_machine.cpp.o:(.data.rel.ro._ZTVN3BNE2RH10Controller15MockRobotModuleE[_ZTVN3BNE2RH10Controller15MockRobotModuleE]+0x78): undefined reference to `BNE::RH::Controller::RobotModule::HandleSubStateFailed(BNE::RH::Controller::SubState&, std::unique_ptr<BNE::RH::Controller::ResponseMessage, std::default_delete<BNE::RH::Controller::ResponseMessage> >&, std::unordered_set<BNE::RH::Controller::SubState, std::hash<BNE::RH::Controller::SubState>, std::equal_to<BNE::RH::Controller::SubState>, std::allocator<BNE::RH::Controller::SubState> >&)' /usr/bin/ld: CMakeFiles/TestRH.dir/unit_src/test_business_state_machine.cpp.o:(.data.rel.ro._ZTVN3BNE2RH10Controller13MockPreModuleE[_ZTVN3BNE2RH10Controller13MockPreModuleE]+0x38): undefined reference to `BNE::RH::Controller::PreModule::HandleSubStateSucceed(BNE::RH::Controller::SubState&, std::unique_ptr<BNE::RH::Controller::ResponseMessage, std::default_delete<BNE::RH::Controller::ResponseMessage> >&, std::unordered_set<BNE::RH::Controller::SubState, std::hash<BNE::RH::Controller::SubState>, std::equal_to<BNE::RH::Controller::SubState>, std::allocator<BNE::RH::Controller::SubState> >&)' /usr/bin/ld: CMakeFiles/TestRH.dir/unit_src/test_business_state_machine.cpp.o:(.data.rel.ro._ZTVN3BNE2RH10Controller13MockPreModuleE[_ZTVN3BNE2RH10Controller13MockPreModuleE]+0x40): undefined reference to `BNE::RH::Controller::PreModule::HandleSubStateFailed(BNE::RH::Controller::SubState&, std::unique_ptr<BNE::RH::Controller::ResponseMessage, std::default_delete<BNE::RH::Controller::ResponseMessage> >&, std::unordered_set<BNE::RH::Controller::SubState, std::hash<BNE::RH::Controller::SubState>, std::equal_to<BNE::RH::Controller::SubState>, std::allocator<BNE::RH::Controller::SubState> >&)' /usr/bin/ld: CMakeFiles/TestRH.dir/unit_src/test_business_state_machine.cpp.o:(.data.rel.ro._ZTVN3BNE2RH10Controller14MockGripModuleE[_ZTVN3BNE2RH10Controller14MockGripModuleE]+0x60): undefined reference to `BNE::RH::Controller::GripModule::HandleSubStateSucceed(BNE::RH::Controller::SubState&, std::unique_ptr<BNE::RH::Controller::ResponseMessage, std::default_delete<BNE::RH::Controller::ResponseMessage> >&, std::unordered_set<BNE::RH::Controller::SubState, std::hash<BNE::RH::Controller::SubState>, std::equal_to<BNE::RH::Controller::SubState>, std::allocator<BNE::RH::Controller::SubState> >&)' /usr/bin/ld: CMakeFiles/TestRH.dir/unit_src/test_business_state_machine.cpp.o:(.data.rel.ro._ZTVN3BNE2RH10Controller14MockGripModuleE[_ZTVN3BNE2RH10Controller14MockGripModuleE]+0x68): undefined reference to `BNE::RH::Controller::GripModule::HandleSubStateFailed(BNE::RH::Controller::SubState&, std::unique_ptr<BNE::RH::Controller::ResponseMessage, std::default_delete<BNE::RH::Controller::ResponseMessage> >&, std::unordered_set<BNE::RH::Controller::SubState, std::hash<BNE::RH::Controller::SubState>, std::equal_to<BNE::RH::Controller::SubState>, std::allocator<BNE::RH::Controller::SubState> >&)' collect2: error: ld returned 1 exit status gmake[2]: *** [tests/CMakeFiles/TestRH.dir/build.make:310: /home/yushijin/fromGitLib/myWorkspace/20250813/rhc/out/TestRH] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:1141: tests/CMakeFiles/TestRH.dir/all] Error 2 gmake: *** [Makefile:146: all] Error 2
最新发布
08-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值