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 24 May 2018 at 02:44, 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.

That bug was fixed by adding explicit instantiations to the library,
but the undefined symbols you're seeing are not templates, and are
defined in libstdc++.so

The only way those symbols would not be in libstdc++.so is if this
condition is false when building libstdc++.so but true when compiling
your own code:

#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1)


Alternatively, you're simply not linking to libstdc++ correctly (or at
all). What is your linker command that fails?


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