g++ 8.1, AIX, std::thread::_State linking

Brian Groose brian@groose.com
Thu May 24 01:44:00 GMT 2018


I'm moving from g++ 5.3.0 to 8.1.0 at the moment, and bumped into an
unexpected linker failure on AIX.  I don't currently have a small
piece of code that reproduces the issue, but I'm working on narrowing
it down.  Hopefully someone can make a suggestion without code,
though.  I've build gcc 8.1.0 from source with no special options
except --prefix and --enable-languages=c,c++

These are the AIX linker errors using g++ 8.1.0:
ld: 0711-317 ERROR: Undefined symbol: typeinfo for std::thread::_State
ld: 0711-317 ERROR: Undefined symbol: .std::thread::_State::~_State()
ld: 0711-317 ERROR: Undefined symbol:
.std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)())
ld: 0711-317 ERROR: Undefined symbol: vtable for std::thread::_State

This worked fine, the same code, on g++ 5.3.0.

This looks similar to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52887 except for
std::thread.  It seems to happen when std::thread is used to call a
member function, though a simple test case worked fine.

The detailed linker output is:

 typeinfo for std::thread::_State [6848]  ER PR
src/CopyBlocksImplThreadPool.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libsmartcopy.a[CopyBlocksImplThreadPool.o])
                                   00017968 .data    R_POS    [86851]
typeinfo for std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ThreadPool::*)(), ThreadPool*> > >
 typeinfo for std::thread::_State [1590]  ER PR
../../udp/common/utils/ActifioLogger.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libagentutils.a[ActifioLogger.o])
                                   0004e678 .data    R_POS    [32425]
typeinfo for std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ActifioLogger::*)(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int), ActifioLogger*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int> > >
                                   0004e688 .data    R_POS    [32429]
typeinfo for std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ActifioLogger::*)(), ActifioLogger*> > >
 .std::thread::_State::~_State() [6624]  ER PR
src/CopyBlocksImplThreadPool.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libsmartcopy.a[CopyBlocksImplThreadPool.o])
                                   0000aed0 .text    R_RBR    [62670]
.std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ThreadPool::*)(), ThreadPool*> > >::~_State_impl()
                                   0000af6c .text    R_RBR    [62685]
.std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ThreadPool::*)(), ThreadPool*> > >::~_State_impl()
 .std::thread::_State::~_State() [1580]  ER PR
../../udp/common/utils/ActifioLogger.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libagentutils.a[ActifioLogger.o])
                                   00048efc .text    R_RBR    [29635]
.std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ActifioLogger::*)(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int), ActifioLogger*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int> > >::~_State_impl()
                                   000490d8 .text    R_RBR    [29657]
.std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
(ActifioLogger::*)(), ActifioLogger*> > >::~_State_impl()
 .std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)()) [9154]  ER PR
src/FilesystemProcessor.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libsmartcopy.a[FilesystemProcessor.o])
                                   0001b3f0 .text    R_RBR    [104262]
.ThreadPool::startWorkerThreads(unsigned long)
 .std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)()) [6738]  ER PR
src/CopyBlocksImplThreadPool.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libsmartcopy.a[CopyBlocksImplThreadPool.o])
                                   00001674 .text    R_RBR    [30838]
.CopyBlocksImplThreadPool::getThreadPool()
 .std::thread::_M_start_thread(std::unique_ptr<std::thread::_State,
std::default_delete<std::thread::_State> >, void (*)()) [1508]  ER PR
../../udp/common/utils/ActifioLogger.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libagentutils.a[ActifioLogger.o])
                                   000129a0 .text    R_RBR    [19410]
.std::thread::thread<void (ActifioLogger::*)(), ActifioLogger*>(void
(ActifioLogger::*&&)(), ActifioLogger*&&)
                                   000133c8 .text    R_RBR    [19572]
.std::thread::thread<void
(ActifioLogger::*)(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int), ActifioLogger*,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, int&>(void
(ActifioLogger::*&&)(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >, int),
ActifioLogger*&&, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, int&)
 vtable for std::thread::_State [1534]  ER PR
../../udp/common/utils/ActifioLogger.cpp(/opt/jenkins/bg/trunk/local//UDS/release/lib/libagentutils.a[ActifioLogger.o])
                                   0004ea08 .data    R_POS    [32697]
<_ZTVNSt6thread6_StateE.P8>

Thanks!



More information about the Gcc-help mailing list