2016-05-17 82 views
0

我需要共享庫文件libthrift-0.9.3.so作爲其他軟件包的依賴關係。我在編譯thrift-0.9.3包時看到了編譯問題(我從https://thrift.apache.org/download下載了)。在lib/cpp/test中會觀察到一些鏈接錯誤。任何人都可以告訴我應該安裝什麼樣的Boost版本?我嘗試了1.54和1.55,但沒用。我無法理解這些錯誤。thrift-0.9.3包C++編譯問題。哪些boost包使用?

我在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 

回答

2

我已經刪除了舊手動安裝的升級版本,並且使用libboost-all-dev安裝了新版本。我已經分別在/ usr/lib/x86_64-linux-gnu /或/ usr/local/lib下看到了舊的和新的boost文件。當我使用apt-get刪除舊的升級包時,它們不會自動刪除。但是,我設法將庫位置/ usr/local/lib設置爲thrift-0.9.3的.configure(即./configure --with-boost-libdir =/usr/local/lib)文件,並且能夠編譯成功。