This is the mail archive of the gcc@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: BROKEN: pthreads and c++ statically linked


Thank you SOOO much for the reply.  I'd been pulling hair out while
getting *no* responses on several forums and mail lists.

In my case, statically linking is important because of configuration
management of executable files for an airborne embedded flight control
system.  

I'd like to find out if there is a bug number associated with this; be
nice to document these symptoms for others that have the same problem.

At the least, I'll try to go back to those forums and post this
workaround.

Thanks again!
Lee

On Tue, 2005-11-08 at 09:38 -0500, Jakub Jelinek wrote:
> 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
> 


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