Re: -fuse-ld=gold and -pthread vs -lpthread

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

 



On 29 March 2017 at 07:00, John Steele Scott wrote:
> On 21/03/17 11:32, John Steele Scott wrote:
>> I have a project where linking with "gcc -pthread -fuse-ld=gold ..." fails with errors about undefined pthread symbols, e.g.
>>
>> gcc /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.2.1/crtend.o /usr/lib/../lib64/crtn.o
>> /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.2.1/libstdc++_nonshared.a(thread44.o):function std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()): error: undefined reference to 'pthread_create'
>> /opt/rh/devtoolset-6/root/usr/lib/gcc/x86_64-redhat-linux/6.2.1/libstdc++_nonshared.a(thread44.o):function std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>, void (*)()): error: undefined reference to 'pthread_create'
>
> There were a couple of other libraries being linked in which referred to symbols in libpthread, but did not have a DT_NEEDED entry for libpthread. One of these instances was a libtool project bitten by <https://bugzilla.redhat.com/show_bug.cgi?id=661333>, the others could be fixed with simple makefile editing.
>
> Anyhow, after fixing those problems, the above messages disappeared as well. So I've gone back to using -pthread, like I had before. All's well that ends well.

Thanks for the update. It's always good to have the solution in the
list archives for future readers who have similar problems.




[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