Boost logo

Boost Users :

From: Ben Hutchings (ben.hutchings_at_[hidden])
Date: 2005-11-09 15:18:55


Andreas Unterkircher wrote:

>Hello Ben,
>
>thank you very much for your response. I tried adding "-D_REENTRANT" and
>it works fine. Please let me ask some follow up questions for
>clarification:
>
>On IA32/gcc3.2.3 I tried to compile the below test code both with
>boost_1_32_0 and boost_1_33_0. The compile comand is constructed by the
>build system of the project I'm porting but I can influence it by an .m4
>file. In both cases it works by using just "-pthread" and it also works
>with "-pthread -D_REENTRANT". What is the difference between these two (if
>any) ?
>
>
"-pthread" is a gcc-specific option that is meant to support building
thread-safe code that may use POSIX threads. On Linux it is generally
equivalent to "-lpthread -D_REENTRANT". So on IA32 the addition of
"-D_REENTRANT" has no effect.

>On IA64/gcc3.2.3 it works only with "-pthread -D_REENTRANT" (having
>applied your patch). What is the reason for this difference between IA32
>and IA64 ? Is it a "bug" ?
>
>
On IA64 (and S390), the "-pthread" option is only equivalent to
"-lpthread", and "-D_REENTRANT" must be specified explicitly to ensure
that thread-safe library functions are used. I consider this
inconsistency to be a bug in gcc. (However, it could be that the C
library is thread-safe by default on these platforms, and that Boost
should not be checking for the _REENTRANT macro. I don't know.)

>With a few towards building on IA32 and IA64 using the same Makefile could
>I just change "-pthread" to "-pthread -D_REENTRANT" and this would produce
>the same binaries on IA32 as "-pthread" for boost_1_32_0 as well as for
>boost_1_33_0 ?
>
>
It would.

Ben.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net