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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  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 ` fxcoudert at gcc dot gnu dot org
  2006-02-07 21:15 ` roger at eyesopen dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-02-07 20:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2006-02-07 20:24 -------
I tried to give it a look on alphaev68-dec-osf5.1b, but I couldn't get to the
point of configuring libgomp :)

cc -c -DHAVE_CONFIG_H -g  -I. -I../../gcc/libiberty/../include   -Wc++-compat
../../gcc/libiberty/floatformat.c -o ./floatformat.o
cc: Error: ../../gcc/libiberty/floatformat.c, line 343: In this statement, the
libraries on this platform do not yet support compile-time evaluation of the
constant expression "0.0/0.0". (constfoldns)
        dto = NAN;


Doesn't the following work?

Index: libgomp/configure.tgt
===================================================================
--- libgomp/configure.tgt       (revision 110617)
+++ libgomp/configure.tgt       (working copy)
@@ -29,6 +29,10 @@
        config_path="linux/alpha linux posix"
        ;;

+    alpha*-dec-osf*)
+       XCFLAGS="${XCFLAGS} -pthread"
+       ;;
+
     ia64*-*-linux*)
        config_path="linux/ia64 linux posix"
        ;;


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: roger at eyesopen dot com @ 2006-02-07 21:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from roger at eyesopen dot com  2006-02-07 21:15 -------
I've discovered your bootstrap failure is PR16787.  It'll take a while for me
to try out your XCFLAGS fix on my slow machine.  I'll also propose a fix for
PR16787.


-- 


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: roger at eyesopen dot com @ 2006-02-08  4:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from roger at eyesopen dot com  2006-02-08 04:04 -------
Subject: Re:  Configure tests for pthread.h sometimes
 need to use -pthread


On 7 Feb 2006, fxcoudert at gcc dot gnu dot org wrote:
> I tried to give it a look on alphaev68-dec-osf5.1b, but I couldn't
> get to the point of configuring libgomp :)
>
> cc -c -DHAVE_CONFIG_H -g  -I. -I../../gcc/libiberty/../include   -Wc++-compat
> ../../gcc/libiberty/floatformat.c -o ./floatformat.o
> cc: Error: ../../gcc/libiberty/floatformat.c, line 343: In this statement, the
> libraries on this platform do not yet support compile-time evaluation of the
> constant expression "0.0/0.0". (constfoldns)
>         dto = NAN;


Hi FX,

Could you try the following for me, and I'll submit it to gcc-patches?
Unfortunately, my OSF_DEV PAK has expired so I rely on gcc for hosting
GCC.



2006-02-07  Roger Sayle  <roger@eyesopen.com>
            R. Scott Bailey  <scott.bailey@eds.com>

        PR bootstrap/16787
        * floatformat.c: Include <float.h> where available.
        (NAN): Use value of DBL_QNAN if defined, and NAN isn't.


Index: floatformat.c
===================================================================
*** floatformat.c       (revision 110738)
--- floatformat.c       (working copy)
***************
*** 1,5 ****
  /* IEEE floating point support routines, for GDB, the GNU Debugger.
!    Copyright 1991, 1994, 1999, 2000, 2003, 2005
     Free Software Foundation, Inc.

  This file is part of GDB.
--- 1,5 ----
  /* IEEE floating point support routines, for GDB, the GNU Debugger.
!    Copyright 1991, 1994, 1999, 2000, 2003, 2005, 2006
     Free Software Foundation, Inc.

  This file is part of GDB.
*************** Foundation, Inc., 51 Franklin Street - F
*** 31,36 ****
--- 31,41 ----
  #include <string.h>
  #endif

+ /* On some platforms, <float.h> provides DBL_QNAN.  */
+ #ifdef STDC_HEADERS
+ #include <float.h>
+ #endif
+
  #include "ansidecl.h"
  #include "libiberty.h"
  #include "floatformat.h"
*************** Foundation, Inc., 51 Franklin Street - F
*** 44,51 ****
--- 49,60 ----
  #endif

  #ifndef NAN
+ #ifdef DBL_QNAN
+ #define NAN DBL_QNAN
+ #else
  #define NAN (0.0 / 0.0)
  #endif
+ #endif

  static unsigned long get_field (const unsigned char *,
                                  enum floatformat_byteorders,


Roger
--


-- 


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  2006-02-07 17:12 [Bug bootstrap/26161] New: Configure tests for pthread.h sometimes need to use -pthread roger at eyesopen dot com
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-08 14:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-02-08 14:18 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-08 14:18:12
               date|                            |


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  2006-02-07 17:12 [Bug bootstrap/26161] New: Configure tests for pthread.h sometimes need to use -pthread roger at eyesopen dot com
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-02-08 15:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2006-02-08 15:12 -------
(In reply to comment #3)
> 2006-02-07  Roger Sayle  <roger@eyesopen.com>
>             R. Scott Bailey  <scott.bailey@eds.com>
> 
>         PR bootstrap/16787
>         * floatformat.c: Include <float.h> where available.
>         (NAN): Use value of DBL_QNAN if defined, and NAN isn't.

It does work for me on alphaev68-dec-osf5.1b, enabling to build libiberty with
the system cc.

But the build dies later with:

yacc --name-prefix=__gettext --output plural.c ../../gcc/intl/plural.y
usage: yacc -svdlt [-b prefix] [-p sym_prefix] [-P path] [-N num] file


-- 


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  2006-02-07 17:12 [Bug bootstrap/26161] New: Configure tests for pthread.h sometimes need to use -pthread roger at eyesopen dot com
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-02-17 10:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2006-02-17 10:15 -------
(In reply to comment #1)
> Index: libgomp/configure.tgt
> ===================================================================
> --- libgomp/configure.tgt       (revision 110617)
> +++ libgomp/configure.tgt       (working copy)
> @@ -29,6 +29,10 @@
>         config_path="linux/alpha linux posix"
>         ;;
> 
> +    alpha*-dec-osf*)
> +       XCFLAGS="${XCFLAGS} -pthread"
> +       ;;
> +
>      ia64*-*-linux*)
>         config_path="linux/ia64 linux posix"
>         ;;

Forget this patch, I manage to test it and it's not working. I'll find
something during the week-end, now that I am able to test it directly on Tru64.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-02-08 14:18:12         |2006-02-17 10:15:46
               date|                            |


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  2006-02-07 17:12 [Bug bootstrap/26161] New: Configure tests for pthread.h sometimes need to use -pthread roger at eyesopen dot com
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-02-17 19:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from fxcoudert at gcc dot gnu dot org  2006-02-17 19:01 -------
Subject: Bug 26161

Author: fxcoudert
Date: Fri Feb 17 19:01:04 2006
New Revision: 111205

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111205
Log:
        PR bootstrap/26161
        * configure.ac: Remove AC_CHECK_HEADER for pthread.h. Add comment
        for the other pthread check.
        * configure: Regenerate.
        * config.h.in: Regenerate.

Modified:
    trunk/libgomp/ChangeLog
    trunk/libgomp/config.h.in
    trunk/libgomp/configure
    trunk/libgomp/configure.ac


-- 


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


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

* [Bug bootstrap/26161] Configure tests for pthread.h sometimes need to use -pthread
  2006-02-07 17:12 [Bug bootstrap/26161] New: Configure tests for pthread.h sometimes need to use -pthread roger at eyesopen dot com
                   ` (6 preceding siblings ...)
  2006-02-17 19:01 ` fxcoudert at gcc dot gnu dot org
@ 2006-02-17 19:07 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-02-17 19:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from fxcoudert at gcc dot gnu dot org  2006-02-17 19:07 -------
Fixed.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


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).