This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Wed, May 23, 2018 at 09:44:03PM -0400, Brian Groose wrote:
> 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.
> 
> Thanks!

Hello Brian

I think that you need to compile with -pthread switch as well as
linking with -pthread.

The order of switches is important when linking, I think that I got
joy with putting -lpthread last in the link list.

I do not have detailed knowledge to hand, but these are my memories
of working with threaded code on AIX. Not version 8.1 though.

Bob
-- 
You have the capacity to learn from mistakes.  You'll learn a lot today.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]