[Top][All Lists]

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

Re: libtool problem on FreeBSD 4.1 with -pthread

From: Ralf Wildenhues
Subject: Re: libtool problem on FreeBSD 4.1 with -pthread
Date: Tue, 9 Nov 2004 08:10:06 +0100
User-agent: Mutt/1.4.1i

* Bob Friesenhahn wrote on Mon, Nov 08, 2004 at 05:39:50PM CET:
> On Mon, 8 Nov 2004, Ralf Wildenhues wrote:
> >>
> >>A build system for a program that uses threads should compile _every_ 
> >>_source_
> >>_file_ with platform-appropriate CPPFLAGS (e.g. -D_REENTRANT 
> >
> >This is what the whole question boils down to.  Even if the main program
> >does not use threads (only a shared lib it uses), is it necessary for it
> >to be compiled with those flags (as opposed to only be linked with)?
> Usually.  Linux seems to incorporate thread-safe errno and other 
> features in single-threaded programs.  Other operating systems may 
> encounter situations where a thread-safe library uses thread-specific 
> errno wrapper functions while the program and other libraries use a 
> static global errno variable, leading to potentially improper 
> behavior.  Interfaces like stdio usually require special compilation 
> since they rely on macros or may even change their binary interface. 

The latter two sentences contain the important cases for us.

> Under Solaris, many functions used to support thread-safety use "weak" 
> linkage so if the pthread library is not supplied, the application 
> runs with dummy versions which do nothing.

For this exact case the just-applied patch should do The Right

> >What we could do now, however, is complain if a library uses threads and
> >the other program sources weren't compiled with the thread-safe flag.  Not
> >too brilliant, but better than nothing if at the end of your build it
> >says
> Sounds great, but it would incur the wrath of many.  Violations of 
> thread-safe principles are rampant.

Let's just warn about it then.  IMHO, people who disregard warnings
should shoot themselves in the foot.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]