This is the mail archive of the
mailing list for the GCC project.
Re: g++ 8.1, AIX, std::thread::_State linking
- From: Bob Wilkinson <bob dot wilkinson at cristie dot com>
- To: Brian Groose <brian at groose dot com>
- Cc: <gcc-help at gcc dot gnu dot org>
- Date: Thu, 24 May 2018 10:55:27 +0100
- Subject: Re: g++ 8.1, AIX, std::thread::_State linking
- References: <CAKMEP22K0aOY1WhgYNhm1GRnc3wvA0vG-e3db0HWFLC2yQfirstname.lastname@example.org>
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::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.
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.
You have the capacity to learn from mistakes. You'll learn a lot today.