我有一个巨大的项目,我在其中使用 boost。boost 将我的源代码树放在特定文件夹中,其中 gcc 32 位和 64 位的标头和库位于单独的子文件夹中。
在 Centos 上:Linux .... SMP Tue Jun 12 09:58:12 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
没问题,每个链接都很好。
但是 Ubuntu 上的相同源代码树:Linux ... 3.2.0-48-generic #74-Ubuntu SMP Thu Jun 6 19:43:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
由于链接器错误而失败。
libtest.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::~sem_based_event()'
libtest.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::sem_based_event()'
libtest.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::set_signalled()'
libtest.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::wait()'
下面是整个链接器命令行...欢迎任何帮助!
/usr/bin/ccache g++ -m32 -lrt -L/home/abuisson/dev/fwk/build/lin32_release -L/home/abuisson/dev/fwk/Source/../Libs/boost/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/ace/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/SafeNetRMS/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/OpenSSL/bin/out32StaticMTReleaseLinux -L/home/abuisson/dev/fwk/Source/../Libs/TinyXML/Lin32/ReleaseStaticMT -L/home/abuisson/dev/fwk/Source/../Libs/zlib/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/Curl/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/microhttpd/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/Intel/Linux32 -L/home/abuisson/dev/fwk/Source/../Libs/IPP/Lin32 -L/home/abuisson/dev/fwk/Source/../Libs/xerces/lin32 CMakeFiles/Frameworktst.dir/Framework/FrameworkTst/FrameworkTimerTst.cpp.o CMakeFiles/Frameworktst.dir/Framework/FrameworkTst/FrameworkTst.cpp.o CMakeFiles/Frameworktst.dir/Framework/FrameworkTst/WriterTst.cpp.o CMakeFiles/Frameworktst.dir/Framework/FrameworkTst/FrameworkLogTst.cpp.o -o Frameworktst libFramework.so libVersionInfoLib.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread -ldl -lrt libTestMediaPlugin.so libFramework.so libVersionInfoLib.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread -ldl -lrt libTestAlgorithmPlugin.so libFramework.so libVersionInfoLib.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread -ldl -lrt libTestChannel.so libFramework.so libVersionInfoLib.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread -ldl -lrt libYaffut.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread libWMCommon.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_thread-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -lpthread /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_system-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_date_time-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_regex-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_signals-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_filesystem-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_program_options-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log-gcc41-mt-1_49.a /home/abuisson/dev/fwk/Libs/boost/Lin32/libboost_log_setup-gcc41-mt-1_49.a -ldl -lrt -Wl,-rpath,/home/abuisson/dev/fwk/build/lin32_release
libFramework.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::~sem_based_event()'
libFramework.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::sem_based_event()'
libFramework.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::set_signalled()'
libFramework.so: undefined reference to `boost::log2_mt_posix::aux::sem_based_event::wait()'