2012-03-21 18 views
17

プログラムの実行ファイルをリンクしようとしていますが、エラーが発生し続けます。私のソースコード内の異常なC++リンカエラー - '破棄されたセクションに定義されています'

boost::this_thread::sleep(boost::posix_time::milliseconds(10)); 

を持つ

は、リンカで以下のエラーを生成:ブーストを使用して

`.text._ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<std::runtime_error>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED2Ev[_ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::gregorian::bad_year>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::gregorian::bad_month>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 

::スレッド:: condition_variable ::待つ利回り

src/net/libnet.a(semaphore.cpp.o): In function `interruption_checker': 
/usr/local/include/boost/thread/pthread/thread_data.hpp:96: undefined reference to `boost::detail::get_current_thread_data()' 
src/net/libnet.a(semaphore.cpp.o): In function `boost::condition_variable::wait(boost::unique_lock<boost::mutex>&)': 
/usr/local/include/boost/thread/pthread/condition_variable.hpp:57: undefined reference to `boost::this_thread::interruption_point()' 
collect2: ld returned 1 exit status 

私はCMakeを使用していますが、Makeが次のコマンドを発行すると失敗します。

/usr/bin/c++  CMakeFiles/rcon.dir/src/main.cpp.o -o rcon -rdynamic -L/usr/local/lib /usr/local/lib/libboost_system.a /usr/local/lib/libboost_thread.a -lpthread src/net/libnet.a src/log/liblogging.a -Wl,-rpath,/usr/local/lib 

Whatever could be wrong? It is linking in libboost_thread.a? 

更新

のlibnetを移動し、コマンドラインでのブーストライブラリがundefinedエラーを削除する前に、(私はそれがきちんとだと思ったので、静的ライブラリにコンパイル私のプログラムの一部を、)liblogging後。しかし、今のブーストでコンパイルするとき、私はこれらを取得する::私のコードでcondition_variable、他のエラーは変更されている間:

`.text._ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::lock_error>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_10lock_errorEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<std::runtime_error>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED2Ev[_ZN5boost16exception_detail19error_info_injectorISt13runtime_errorED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_9gregorian16bad_day_of_monthEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::thread_resource_error>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_21thread_resource_errorEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::condition_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::condition_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_15condition_errorEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_15condition_errorEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_15condition_errorEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::condition_error>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_15condition_errorEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_15condition_errorEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_year> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian8bad_yearEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::gregorian::bad_year>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_9gregorian8bad_yearEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED2Ev' referenced in section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED1Ev[non-virtual thunk to boost::exception_detail::error_info_injector<boost::gregorian::bad_month>::~error_info_injector()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED2Ev[_ZN5boost16exception_detail19error_info_injectorINS_9gregorian9bad_monthEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_day_of_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian16bad_day_of_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::runtime_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorISt13runtime_errorEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::gregorian::bad_month> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_9gregorian9bad_monthEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_21thread_resource_errorEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
`.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED2Ev' referenced in section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED1Ev[non-virtual thunk to boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >::~clone_impl()]' of /usr/local/lib/libboost_thread.a(thread.o): defined in discarded section `.text._ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED2Ev[_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINS_10lock_errorEEEED5Ev]' of /usr/local/lib/libboost_thread.a(thread.o) 
+1

を参照してください? –

+1

@ MarkB C++はg ++へのシンボリックリンクです – Max

答えて

11

今私は少し恥ずかしいです。明らかに、私のブーストライブラリで何かが間違っていた。おそらく、私はを更新した後、gccの1つのバージョンでそれを編集しました。です。これはおそらく、2つのバージョンの間に若干の互換性のない形式のGCCを更新しました。私はそれについて完全に間違っているかもしれません。

Archlinuxリポジトリから、以前の公式リリースの最新版である、すべての追加機能を削除しました。今度はそれをコンパイルする必要があります。

愚かな私。

void foo() {/* ... */} 

とリンカ利回りこのエラーメッセージ:あなたはこの機能を持っていると仮定すると、

::(

+1

あなたはそれを解決してくれてうれしいですが、これはまだGCCのいくつかの設定で起こっている実際の問題であることに注意してください。私は今、組み込みアプリケーションでこれを遭遇しました。 –

+0

同じバージョンのgcc/g ++ですべてのソースファイルをコンパイルします。 – songhir

3

私はパートや問題のすべてがリンクライン上のライブラリの順序であると思います。リンカの中には、ライブラリを依存度の高いものから依存性の低いものから、左から右へとリストする必要があるため、各ライブラリから抽出するシンボルを知っています。まず最初にlibnetlibboost_threadの前に移動して、状況が改善する(または少なくとも変更する)かどうかを確認します。

+0

あなたは問題ありませんでした。問題の一部は、libboost_threadをあまりにも遅くリンクしたことでした。これらは 'undefined'エラーでした。しかし、他のエラーはそのままです。それ以上のヒント? – Max

6

Linkonceセクション(およびcomdatグループの新しい概念)は、リンクされた出力ファイルの重複したコピーを心配することなく、テンプレートのインスタンス化とアウトラインのインライン関数を発行する方法です。たとえば、インスタンス化されたテンプレート関数のコピーが、2つ以上の個別のオブジェクトファイルに存在する場合があります。そのうちのリンカーが1つを選択し、残りのすべてを破棄します。そのケースが適切にリンクされるためには、各コピーが全く同じシンボルセットを定義して参照することが重要です。

異なるコンパイルオプションを使用すると、余分なシンボルが定義されることがあります(たとえば、-g、または通常は共有ライブラリの場合のようにオブジェクトファイル間でコンパイラオプションが異なる場合)。 gccを次へ(あなたのケースではこれが起こりそうなのではないかと思われます。編集:うーん、私は興奮しています。あなたの愚か者であったかもしれません。 ここでは、非linkonceセクションから特定のlinkonceセクションの一部の(ただしすべてではない)コピーに定義されている シンボルへの参照があります。リンカがそのシンボルのあるシンボルを破棄し、シンボルなしのシンボルを保持した場合、このエラーが発生します。

オブジェクトモジュールのリンク順を並べ替えて、必要なシンボルを定義するセクションを保持するようリンカーに指示することを提案します。特に、エラーメッセージに記述されているオブジェクトファイルを、オブジェクトファイルの依存関係に従って、オブジェクトファイルリストの最後または先頭に移動してください(オブジェクトファイルは、の左から右にのコマンドラインでリンクされています)。

+0

私の編集をご覧ください。 :)あなたは少なくとも部分的には正しかった - 私の 'undefined'エラーを解決しました。しかし、私はまだこれらの怪物の「破棄されたセクション」エラーを取得しています。それ以上のヒント?私はデバッグシンボルなしでコンパイルしようとしましたが、それは同じです。 – Max

4

はここにあなたの全体のプロジェクトのビルドフラグを変更する必要ありません、それは私の実際のソリューションです機能が削除されたプロセスをリンク/どこかのコンパイルで、意味

`foo' referenced in section `...' of ...: defined in discarded section `.text' of ... 

あなたがいないどのような方法で機能をガベージコレクトするようにコンパイラに強制的にGCCの__attribute__((used))関数属性を適用することができます。

__attribute__((used)) void foo() {/* ... */} 

頻繁に使用する場合、私は互換性があるようにも使用することができる(マクロの定義をお勧めします)他のコンパイラと:すべての関数にこの属性を追加することはお勧めできませんことを

#define USED __attribute__((used)) 
//Usage example 
USED void foo() {/* ... */} 

注 - 多くの未使用の関数は、最終的なcompilateから削除されませんので、それはあなたの実行ファイル/ライブラリのサイズを大きくすることがあります。

は、 `は/ usr/binに/ C++コンパイラ`であるfunction attributes GCC docpage

関連する問題