public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/26161]  New: Configure tests for pthread.h sometimes need to use -pthread
@ 2006-02-07 17:12 roger at eyesopen dot com
  2006-02-07 20:24 ` [Bug bootstrap/26161] " fxcoudert at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: roger at eyesopen dot com @ 2006-02-07 17:12 UTC (permalink / raw)
  To: gcc-bugs

The problem is that on some systems, including Tru64 and I believe AIX, the
compiler has to be passed the -pthread command line option in order to use
#include <pthread.h>

Effectively, the first lines of /usr/include/pthread.h contain the lines:

#ifndef _REENTRANT
#error POSIX pthreads are only available with the use of -pthreads
#endif

For this reason the autoconf tests of pthread.h in libstdc++-v3 and libgomp
always fail.  Fortunately, this was previously not serious, as the target
configurations would include pthread.h anyway, and all the relevant source
libraries are compiled with -pthread.  In directories where they don't, GCC
has workarounds, such as in gcc/gcc-posix.h which contains the lines:

/* Some implementations of <pthread.h> require this to be defined.  */
#ifndef _REENTRANT
#define _REENTRANT 1
#endif

#include <pthread.h>

This issue escalcated to a bootstrap failure in libgomp recently, which now
aborts whilst configuring libgomp when pthread.h isn't detected.  Prior to
this change, libgomp built fine and the test results were quite reasonable
on Alpha/Tru64. [Stretching the definition of a regression :-)]


I believe that what is needed is a "local" configure test for pthread.h that
first decides whether the compiler supports -pthread (for example, GCC on IRIX
currently does not), and then uses this flag testing for headers.  This is
perhaps similar to the related patch I posted recently, where we need to test
system header with the same compiler options we'll be using to build the source
files:  http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00139.html  See the
related definitions of THREADCXXFLAGS and THREADLDFLAGS in libjava's
configure.ac.


Unfortunately, my autoconf-fu isn't strong enough to tackle this.


The temporary work-around is to use --disable-libgomp.  The long-term fix
would be to port libgomp to use GCC's gthreads library.  But in the meantime,
it would be good to correct the test for pthread.h and/or add a PTHREAD_CFLAGS
that can be used any project.

I'm happy to test patches on affected systems.  However, it should be trivial
to re-create a model system with the above lines and using -D_REENTRANT as the
compiler option that needs to be passed.


-- 
           Summary: Configure tests for pthread.h sometimes need to use -
                    pthread
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roger at eyesopen dot com
  GCC host triplet: alpha*-*-osf*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26161


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-02-17 19:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-07 17:12 [Bug bootstrap/26161] New: Configure tests for pthread.h sometimes need to use -pthread roger at eyesopen dot com
2006-02-07 20:24 ` [Bug bootstrap/26161] " fxcoudert at gcc dot gnu dot org
2006-02-07 21:15 ` roger at eyesopen dot com
2006-02-08  4:04 ` roger at eyesopen dot com
2006-02-08 14:18 ` pinskia at gcc dot gnu dot org
2006-02-08 15:12 ` fxcoudert at gcc dot gnu dot org
2006-02-17 10:15 ` fxcoudert at gcc dot gnu dot org
2006-02-17 19:01 ` fxcoudert at gcc dot gnu dot org
2006-02-17 19:07 ` fxcoudert at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).