std thread,mutex,cv and static linking with GCC

Damian Lezama Damian.Lezama@riverbed.com
Wed Oct 22 17:28:00 GMT 2014


Thanks. For other's future reference:

I've verified that replacing the -pthread (or -lpthread) option in the linker invocation with '-Wl,--whole-archive -lpthread -Wl,--no-whole-archive' solves the problem. Be aware that the -pthread option in the compiler invocation has to be kept there.

-----Original Message-----
From: Jonathan Wakely [mailto:jwakely.gcc@gmail.com] 
Sent: Wednesday, October 22, 2014 10:13 AM
To: Damian Lezama
Cc: libstdc++@gcc.gnu.org
Subject: Re: std thread,mutex,cv and static linking with GCC

On 22 October 2014 18:10, Jonathan Wakely wrote:
> Oh I just noticed that you said:
> creating an std::thread also works, but the test crashes when using 
> the cv

That means the change on trunk probably won't help.

But as Jakub says at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909 you should be able to use --whole-archive


More information about the Libstdc++ mailing list