This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: BROKEN: pthreads and c++ statically linked
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "Dixon, Lee L." <JOEL dot L dot DIXON at saic dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 8 Nov 2005 15:38:38 +0100
- Subject: Re: BROKEN: pthreads and c++ statically linked
- References: <1131460316.3007.4.camel@localhost.localdomain>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Nov 08, 2005 at 09:31:56AM -0500, Dixon, Lee L. wrote:
> I really don't know what I could be doing wrong, but on a _stock_ FC4
> install, I'm having a segfault in a pthread call when
> statically linked and including iostream (or STL includes like string)
>
> Here's the code:
>
> #include <pthread.h>
> #include <iostream>
>
> int main(int argc, char *argv[])
> {
> pthread_mutexattr_t attr;
> pthread_mutexattr_init( &attr );
> }
This is a known problem, see
http://gcc.gnu.org/ml/gcc/2005-10/msg00235.html
for details.
In the mean time, don't link statically (which is a terribly bad idea
anyway), or use -Wl,--whole-archive -lpthread -Wl,--no-whole-archive.
Jakub