boost1.33.0 on IA64 thread problem
I'm working on porting a large project to IA64. Therefore I'd like to
use the boost thread package on IA64 using gcc 3.2.3 (standard compiler
on the SL 3 Linux distribution). There are some problems which I describe
below and at the end of the mail I pose my questions. Thanks for any
comments !
To test I use the following code:
#include
Andreas Unterkircher wrote:
I'm working on porting a large project to IA64. Therefore I'd like to use the boost thread package on IA64 using gcc 3.2.3 (standard compiler on the SL 3 Linux distribution).
For reference, I used Debian 3.1 (sarge) with g++ 3.3.5 and Boost from CVS shortly before 1.33. <snip>
In the boost mailing list archive I found an IA64 patch posted by Ben Hutchings. Applying this patch and recompiling boost I get:
g++ -g -O2 -pthread -I/opt/boostTest/include/boost-1_33 -L/opt/boostTest/lib -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lpthread -lboost_regex-gcc-mt prog.c
The patch is supposed to add a -D_REENTRANT to that. Are you constructing this command-line yourself?
In file included from /opt/boostTest/include/boost-1_33/boost/thread/detail/config.hpp:18, from /opt/boostTest/include/boost-1_33/boost/thread/mutex.hpp:15, from prog.c:2: /opt/boostTest/include/boost-1_33/boost/config/requires_threads.hpp:47:5: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
But when I use "-DBOOST_HAS_THREADS" everything works fine:
g++ -g -O2 -pthread -DBOOST_HAS_THREADS -I/op/boostTest/include/boost-1_33 -L/opt/boostTest/lib -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lpthread -lboost_regex-gcc-mt prog.c
<snip>
Here are my questions:
Boost 1.33.0 contains the file boost/detail/sp_counted_base_gcc_ia64.hpp, nevertheless thread support seems not to work with gcc3.2.3. Thread support works by applying the patch and using "-DBOOST_HAS_THREADS". What is the status of boost 1.33.0 concerning IA64 ? I guess the patch has not been incorporated into the boost distribution ?
Sorry, no, I seem to have missed committing the change to gcc-tools.jam. Since I don't normally develop on IA64 this error wasn't obvious to me until now.
On IA32 I can compile and use boost 1.33.0 threads using gcc3.2.3 without using "-DBOOST_HAS_THREADS". Why is this the case ?
You're telling Boost that the compiler has been configured to use thread-safe options (which unfortunately is not true if _REENTRANT is not defined).
Ideally I would like to use the same compiler flags to compile a project using boost on IA32 and IA64.
You can use the options -pthread -D_REENTRANT on both. Ben.
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) ? 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" ? 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 ? Thank you very much for your efforts ! Best regards, Andreas On Tue, 8 Nov 2005, Ben Hutchings wrote:
Andreas Unterkircher wrote:
I'm working on porting a large project to IA64. Therefore I'd like to use the boost thread package on IA64 using gcc 3.2.3 (standard compiler on the SL 3 Linux distribution).
For reference, I used Debian 3.1 (sarge) with g++ 3.3.5 and Boost from CVS shortly before 1.33.
<snip>
In the boost mailing list archive I found an IA64 patch posted by Ben Hutchings. Applying this patch and recompiling boost I get:
g++ -g -O2 -pthread -I/opt/boostTest/include/boost-1_33 -L/opt/boostTest/lib -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lpthread -lboost_regex-gcc-mt prog.c
The patch is supposed to add a -D_REENTRANT to that. Are you constructing this command-line yourself?
In file included from /opt/boostTest/include/boost-1_33/boost/thread/detail/config.hpp:18, from /opt/boostTest/include/boost-1_33/boost/thread/mutex.hpp:15, from prog.c:2: /opt/boostTest/include/boost-1_33/boost/config/requires_threads.hpp:47:5: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
But when I use "-DBOOST_HAS_THREADS" everything works fine:
g++ -g -O2 -pthread -DBOOST_HAS_THREADS -I/op/boostTest/include/boost-1_33 -L/opt/boostTest/lib -lboost_filesystem-gcc-mt -lboost_thread-gcc-mt -lpthread -lboost_regex-gcc-mt prog.c
<snip>
Here are my questions:
Boost 1.33.0 contains the file boost/detail/sp_counted_base_gcc_ia64.hpp, nevertheless thread support seems not to work with gcc3.2.3. Thread support works by applying the patch and using "-DBOOST_HAS_THREADS". What is the status of boost 1.33.0 concerning IA64 ? I guess the patch has not been incorporated into the boost distribution ?
Sorry, no, I seem to have missed committing the change to gcc-tools.jam. Since I don't normally develop on IA64 this error wasn't obvious to me until now.
On IA32 I can compile and use boost 1.33.0 threads using gcc3.2.3 without using "-DBOOST_HAS_THREADS". Why is this the case ?
You're telling Boost that the compiler has been configured to use thread-safe options (which unfortunately is not true if _REENTRANT is not defined).
Ideally I would like to use the same compiler flags to compile a project using boost on IA32 and IA64.
You can use the options -pthread -D_REENTRANT on both.
Ben.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
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.
participants (2)
-
Andreas Unterkircher
-
Ben Hutchings