我需要共享库文件libthrift-0.9.3.so作为其他包的依赖项。我在构建thrift-0.9.3软件包时看到了编译问题(我是从https://thrift.apache.org/download下载的)。在lib / cpp / test中观察到一些链接错误。任何人都可以建议我应该安装什么版本的Boost?我试过1.54和1.55,但没用。我无法理解这些错误。
我在boost包中看到以下错误日志。
.
.
Making all in test
make[4]: Entering directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test'
make all-am
make[5]: Entering directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test'
/bin/bash ../../../libtool --tag=CXX --mode=link g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -L/usr/lib/x86_64-linux-gnu -o libtestgencpp.la gen-cpp/DebugProtoTest_types.lo gen-cpp/EnumTest_types.lo gen-cpp/OptionalRequiredTest_types.lo gen-cpp/Recursive_types.lo gen-cpp/ThriftTest_types.lo gen-cpp/ThriftTest_constants.lo gen-cpp/TypedefTest_types.lo ThriftTest_extras.lo DebugProtoTest_extras.lo ../../../lib/cpp/libthrift.la -lssl -lcrypto -lrt -lpthread
depbase=`echo Benchmark.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../lib/cpp/src/thrift -I/usr/include -I../../../lib/cpp/src -D__STDC_LIMIT_MACROS -Wall -Wextra -pedantic -g -O2 -std=c++11 -MT Benchmark.o -MD -MP -MF $depbase.Tpo -c -o Benchmark.o Benchmark.cpp &&\
mv -f $depbase.Tpo $depbase.Po
/bin/bash ../../../libtool --tag=CXX --mode=link g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -L/usr/lib/x86_64-linux-gnu -o processor_test processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o libprocessortest.la ../../../lib/cpp/libthrift.la ../../../lib/cpp/libthriftnb.la /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.a -L/usr/lib/x86_64-linux-gnu -levent -lssl -lcrypto -lrt -lpthread
libtool: link: ar cru .libs/libtestgencpp.a gen-cpp/.libs/DebugProtoTest_types.o gen-cpp/.libs/EnumTest_types.o gen-cpp/.libs/OptionalRequiredTest_types.o gen-cpp/.libs/Recursive_types.o gen-cpp/.libs/ThriftTest_types.o gen-cpp/.libs/ThriftTest_constants.o gen-cpp/.libs/TypedefTest_types.o .libs/ThriftTest_extras.o .libs/DebugProtoTest_extras.o
libtool: link: g++ -Wall -Wextra -pedantic -g -O2 -std=c++11 -o .libs/processor_test processor/ProcessorTest.o processor/EventLog.o processor/ServerThread.o -L/usr/lib/x86_64-linux-gnu ./.libs/libprocessortest.a ../../../lib/cpp/.libs/libthrift.so ../../../lib/cpp/.libs/libthriftnb.so /usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.a -levent -lssl -lcrypto -lrt -lpthread
libtool: link: ranlib .libs/libtestgencpp.a
libtool: link: ( cd ".libs" && rm -f "libtestgencpp.la" && ln -s "../libtestgencpp.la" "libtestgencpp.la" )
processor/ProcessorTest.o: In function `operator<< <char const*>':
/usr/local/include/boost/test/tools/detail/print_helper.hpp:172: undefined reference to `boost::test_tools::tt_detail::print_log_value<char const*>::operator()(std::ostream&, char const*)'
processor/ProcessorTest.o: In function `boost::unit_test::make_test_case(boost::function<void ()> const&, boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long)':
/usr/local/include/boost/test/tree/test_unit.hpp:249: undefined reference to `boost::unit_test::test_case::test_case(boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long, boost::function<void ()> const&)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, char const*, char const*>(boost::test_tools::tt_detail::equal_impl_frwd, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, char const* const&, char const*, char const* const&, char const*)':
/usr/loc*al/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, unsigned int, unsigned int>(boost::test_tools::tt_detail::equal_impl_frwd, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned int const&, char const*, unsigned int const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, std::string, std::string>(boost::test_tools::tt_detail::equal_impl_frwd, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, std::string const&, char const*, std::string const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::ne_impl, unsigned long, unsigned long>(boost::test_tools::tt_detail::ne_impl, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long const&, char const*, unsigned long const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::ne_impl, unsigned int, unsigned int>(boost::test_tools::tt_detail::ne_impl, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned int const&, char const*, unsigned int const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o:/usr/local/include/boost/test/tools/old/impl.hpp:92: more undefined references to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)' follow
processor/ProcessorTest.o: In function `__static_initialization_and_destruction_0':
/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test/processor/ProcessorTest.cpp:894: undefined reference to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'
/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test/processor/ProcessorTest.cpp:894: undefined reference to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'
/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test/processor/ProcessorTest.cpp:894: undefined reference to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'
/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test/processor/ProcessorTest.cpp:894: undefined reference to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'
/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test/processor/ProcessorTest.cpp:894: undefined reference to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)'
processor/ProcessorTest.o:/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test/processor/ProcessorTest.cpp:894: more undefined references to `boost::unit_test::ut_detail::auto_test_unit_registrar::auto_test_unit_registrar(boost::unit_test::test_case*, boost::unit_test::decorator::collector&, unsigned long)' follow
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, int, unsigned long>(boost::test_tools::tt_detail::equal_impl_frwd, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, int const&, char const*, unsigned long const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, char [4], std::string>(boost::test_tools::tt_detail::equal_impl_frwd, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, char const (&) [4], char const*, std::string const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `bool boost::test_tools::tt_detail::check_frwd<boost::test_tools::tt_detail::equal_impl_frwd, char [5], std::string>(boost::test_tools::tt_detail::equal_impl_frwd, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, char const (&) [5], char const*, std::string const&, char const*)':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o: In function `check_frwd<boost::test_tools::tt_detail::ne_impl, unsigned int, unsigned int>':
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
/usr/local/include/boost/test/tools/old/impl.hpp:92: undefined reference to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)'
processor/ProcessorTest.o:/usr/local/include/boost/test/tools/old/impl.hpp:92: more undefined references to `boost::test_tools::tt_detail::report_assertion(boost::test_tools::assertion_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)' follow
collect2: error: ld returned 1 exit status
make[5]: *** [processor_test] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: Leaving directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp/test'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib/cpp'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3/lib'
ake[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/gou/nt/nfp/dependencies/thrift/thrift-0.9.3'
make: *** [all] Error 2
答案 0 :(得分:2)
我删除了手动安装的旧版本,然后使用libboost-all-dev安装新版本。我分别在/ usr / lib / x86_64-linux-gnu /或/ usr / local / lib下看到了所有新旧的boost .so文件。当我使用apt-get删除旧的boost包时,它们不会自动删除。但任何我如何设法将库位置作为/ usr / local / lib提供给.iftigure的.configure(即./configure --with-boost-libdir = / usr / local / lib)文件并且能够编译成功。