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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bob,

I definitely have -pthread in there, std::thread isn't defined with out it.

Jonathan,
I was pulling together the linker command line to post and realized
that I had a -L directive that points to a directory containing
libstdc++, but it was the gcc 5.3.0 libstdc++.  I did this because
it's the only way to get an rpath-type thing in the resulting binary.
Of course, once I removed this everything linked properly.

Sorry to be a bother and thanks for the quick replies!!


On Thu, May 24, 2018 at 6:01 AM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
> 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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux