
Jonathan Wakely wrote:
On Tue, Oct 05, 2004 at 04:28:46PM +0100, John Maddock wrote:
Markus, I believe what you're seeing is the problem that prompted the GCC developers to unconditionally define _REENTRANT even when -pthread is not given (and which breaks Boost for GCC 3.4), see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11953
That's what I thought, but http://tinyurl.com/3lyr8 suggests that _REENTRANT *is* defined, even without -pthread (unless this is an artifact of including <iostream>).
<iostream> includes <ostream> which includes <ios> which includes <iosfwd> which includes $platform/bits/c++io.h which includes gthr.h which includes gthr-default.h which defines _REENTRANT to 1.
That's what I also discovered.
Solution: define _REENTRANT before including anything, or include a libstdc++ header (which will define _REENTRANT and include pthread.h)
The native compiler (toolset tru64cxx65) doesn't define _REENTRANT and things seem to work out correctly. GCC's include files OTOH unconditionally define _REENTRANT before including "pthread.h" which forces boost to also include "pthread.h", if I understand things correctly. But reentrant is not defined at the point where "pthread.h" is included which leads to the problem described. I think I'm missing something here. Markus