Подтвердить что ты не робот

Необычная ошибка компоновщика С++ - "Определено в отброшенном разделе"

Я пытаюсь связать свою исполняемую программу, но я продолжаю получать ошибки.

Имея

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)

Использование boost:: thread:: condition_variable:: wait yields

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, и он сообщает мне, что выдает следующую команду, которая не выполняется:

    /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 и liblogging (части моей программы, скомпилированные в статические библиотеки, потому что я думал, что это было аккуратно), прежде чем библиотеки boost в командной строке удаляют ошибки undefined. Однако теперь я получаю их при компиляции с boost:: 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)
4b9b3361

Ответ 1

Теперь я немного смущен. По-видимому, что-то не так с моей библиотекой повышения. Вероятно, я скомпилировал его с одной версией gcc, после чего я все обновил. Вероятно, это обновление GCC с некоторой формой незначительной несовместимости между двумя версиями. Возможно, я ошибаюсь.

Я удалил все вхождения boost, и вместо этого вытащил импульс из репозиториев Archlinux, который в настоящее время обновляется с официальными релизами. Теперь он компилируется так, как должен.

Глупый мне.: (

Ответ 2

Разделы Linkonce (и более новое понятие групп comdat) - это способ для компилятора испускать экземпляры шаблонов и встроенные встроенные функции, не беспокоясь о большом количестве дубликатов в связанном выходном файле. Может быть копия, например, экземпляра шаблона в 2+ дискретных объектных файлах, из которых компоновщик будет выбирать один и отбросить все остальные. Для того, чтобы этот случай правильно связывался, важно, чтобы каждая копия определяла и ссылалась точно на тот же набор символов.

Однако иногда дополнительные символы определяются при использовании различных параметров компиляции (например, -g или когда параметры компилятора различаются между объектными файлами, как это обычно бывает с общими библиотеками) или набор символов изменился с одной версии gcc к следующему (я подозреваю, что это маловероятно в вашем случае - EDIT: ну, цвет меня взволнован, похоже, что это была твоя глупость. Рад, что твоя проблема решена). Что может случиться здесь, так это то, что у вас есть ссылка из раздела без ссылки на символ, определенный в некоторых (но не всех) экземплярах отдельного раздела linkonce. Если компоновщик случайно выбрал тот, у кого есть этот символ, и сохраните его без этого символа, вы получите эту ошибку.

Я бы предложил вам изменить порядок ссылок ваших объектных модулей, чтобы попытаться заставить компоновщик сохранить раздел, который определяет нужные вам символы; в частности, попытайтесь переместить файлы объектов, упомянутые в сообщении об ошибке, в конец или начало списка объектных файлов в соответствии с их зависимостями (помните, что объектные файлы связаны слева направо в порядке их командной строки).

Ответ 3

Здесь мое фактическое решение для него, которое не связано с изменением всех флагов сборки проекта:

Предполагая, что у вас есть эта функция:

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

и ваш компоновщик выдает это сообщение об ошибке:

`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() {/* ... */}

Обратите внимание, что не рекомендуется добавлять этот атрибут ко всем функциям - это может увеличить размер исполняемого файла/библиотеки, поскольку многие неиспользуемые функции не будут удалены из окончательного компилята.

См. атрибуты функций GCP docpage

Ответ 4

Я подозреваю, что часть или вся проблема - это порядок библиотек в линии ссылок. Некоторые линкеры требуют, чтобы вы перечислили библиотеки из самых зависимых от наименее зависимых, слева направо, чтобы они знали, какие символы извлекать из каждой библиотеки. В качестве первого запуска переместите libnet до libboost_thread и посмотрите, улучшатся ли (или, по крайней мере, изменения) вещи.