public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgomp/32193]  New: Upgrading GNU/Linux to libc6_2.6~20070518-2 breaks libgomp make - FIX given
@ 2007-06-03  5:16 rob1weld at aol dot com
  2009-02-21  9:12 ` [Bug libgomp/32193] libgomp does not honor --disable-werror laurent at guerby dot net
  0 siblings, 1 reply; 5+ messages in thread
From: rob1weld at aol dot com @ 2007-06-03  5:16 UTC (permalink / raw)
  To: gcc-bugs

Compiled gcc version 4.3.0 20070602 with tzdata 2007b-1 and libc6 2.3.6.ds1-13 
everything went well enough and "make -i check" was not too bad ...

Decided to upgrade. Everything compiled fine until the _last_ library (of
course), otherwise it would have worked fine.


wget http://ftp.debian.org/debian/pool/main/t/tzdata/tzdata_2007f-6_all.deb
wget
http://ftp.debian.org/debian/pool/main/g/glibc/libc6_2.6~20070518-2_i386.deb
dpkg -i tzdata_2007f-6_all.deb
dpkg -i libc6_2.6~20070518-2_i386.deb


Notes in /etc/init.d/glibc.sh
    # The GNU libc requires 2.6 kernel (except on m68k) because we drop to
support linuxthreads
    # HPPA boxes require latest fixes (2.6.9 ) in the kernel to function
properly.
    # The GNU libc is now built with --with-kernel= >= 2.4.1 on m68k

Notes in /usr/share/doc/libc6/README

All Linux kernel versions prior to 2.6.16 are known to have some bugs that may
cause some of the tests related to pthreads in "make check" to fail. If you see
such problems, please try the test suite on the most recent Linux kernel
version that you can use, before pursuing those bugs further.



# Echo Yes, this is a "legal" command
# /lib/libc-2.6.so
GNU C Library stable release version 2.6, by Roland McGrath et al.
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.3 20070514 (prerelease) (Debian 4.1.2-7).
Compiled on a Linux >>2.6.20-1-686<< system on 2007-05-20.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
# /lib/libpthread-2.6.so
Native POSIX Threads Library by Ulrich Drepper et al
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Forced unwind support included.


Here is the problem:

if /bin/sh ./libtool --tag=CC --mode=compile /opt/gcc-4_3-build/./gcc/xgcc
-B/opt/gcc-4_3-build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/
-B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem
/usr/i686-pc-linux-gnu/sys-include -DHAVE_CONFIG_H -I.
-I/root/downloads/gcc-4_3-trunk/libgomp -I. 
-I/root/downloads/gcc-4_3-trunk/libgomp/config/linux/x86
-I/root/downloads/gcc-4_3-trunk/libgomp/config/linux
-I/root/downloads/gcc-4_3-trunk/libgomp/config/posix
-I/root/downloads/gcc-4_3-trunk/libgomp  -Wall -Werror -ftls-model=initial-exec
-Wc,-pthread -O2 -g -O2  -MT proc.lo -MD -MP -MF ".deps/proc.Tpo" -c -o proc.lo
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c; \
        then mv -f ".deps/proc.Tpo" ".deps/proc.Plo"; else rm -f
".deps/proc.Tpo"; exit 1; fi
libtool: compile:  /opt/gcc-4_3-build/./gcc/xgcc -B/opt/gcc-4_3-build/./gcc/
-B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem
/usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include
-DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_3-trunk/libgomp -I.
-I/root/downloads/gcc-4_3-trunk/libgomp/config/linux/x86
-I/root/downloads/gcc-4_3-trunk/libgomp/config/linux
-I/root/downloads/gcc-4_3-trunk/libgomp/config/posix
-I/root/downloads/gcc-4_3-trunk/libgomp -Wall -Werror -pthread
-ftls-model=initial-exec -O2 -g -O2 -MT proc.lo -MD -MP -MF .deps/proc.Tpo -c
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c  -fPIC -DPIC -o
.libs/proc.o
cc1: warnings being treated as errors
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c: In function
'gomp_init_num_threads':
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c:78: error: implicit
declaration of function 'pthread_getaffinity_np'
make[4]: *** [proc.lo] Error 1
make[4]: Leaving directory `/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp'
make[1]: *** [all-target-libgomp] Error 2
make[1]: Leaving directory `/opt/gcc-4_3-build'
make: *** [all] Error 2



The function pthread_getaffinity_np is used in
gcc-4_3-trunk/libgomp/config/linux/affinity.c and
gcc-4_3-trunk/libgomp/config/linux/proc.c in functions gomp_init_affinity and
gomp_init_num_threads .



Also see this thread:
bootstrap broken on powerpc: implicit declaration of function
'pthread_getaffinity_np'
http://gcc.gnu.org/ml/gcc/2007-04/msg00814.html


Following Andrew's advice I found this (first file is libc6_2.3.6, second is
libc6_2.6~20070518-2):

# diff -Naur
/opt/gcc-4_3-build-libc6_2.3.6.ds1-13/i686-pc-linux-gnu/libgomp/config.log
/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/config.log
--- /opt/gcc-4_3-build-libc6_2.3.6.ds1-13/i686-pc-linux-gnu/libgomp/config.log 
2007-06-02 08:46:43.000000000 -0700
+++ /opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/config.log     2007-06-02
20:06:44.000000000 -0700


@@ -798,109 +798,19 @@
 configure:16707: test -s conftest
 configure:16710: $? = 0
 configure:16732: /opt/gcc-4_3-build/./gcc/xgcc -B/opt/gcc-4_3-build/./gcc/
-B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem
/usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -o
conftest -O2 -g -O2  -pthread   conftest.c  >&5
-/tmp/ccMWvc5l.o: In function `main':
-/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/conftest.c:37: undefined
reference to `pthread_tryjoin_np'
-collect2: ld returned 1 exit status
-configure:16738: $? = 1
-configure: failed program was:
-| /* confdefs.h.  */
...
-| #define HAVE_GETLOADAVG 1
-| /* end confdefs.h.  */
-| #ifndef _GNU_SOURCE
-|           #define _GNU_SOURCE 1
-|           #endif
-|           #include <pthread.h>
-|           pthread_t th; void *status;
-| int
-| main ()
-| {
-| pthread_tryjoin_np (th, &status);
-|   ;
-|   return 0;
-| }
-configure:16762: WARNING: The kernel might not support futex or gettid
syscalls.
-If so, please configure with --disable-linux-futex
+configure:16738: $? = 0
+configure:16742: test -z 
+                        || test ! -s conftest.err
+configure:16745: $? = 0
+configure:16748: test -s conftest
+configure:16751: $? = 0
 configure:16862: /opt/gcc-4_3-build/./gcc/xgcc -B/opt/gcc-4_3-build/./gcc/
-B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem
/usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -o
conftest -O2 -g -O2  -pthread   conftest.c  >&5
-/tmp/ccIw6RE3.o: In function `main':
-/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/conftest.c:36: undefined
reference to `pthread_getaffinity_np'
-/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/conftest.c:41: undefined
reference to `pthread_setaffinity_np'
-/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/conftest.c:43: undefined
reference to `pthread_attr_getaffinity_np'
-/opt/gcc-4_3-build/i686-pc-linux-gnu/libgomp/conftest.c:44: undefined
reference to `pthread_attr_setaffinity_np'
-collect2: ld returned 1 exit status
-configure:16868: $? = 1
-configure: failed program was:
-| /* confdefs.h.  */
...
-| #define HAVE_GETLOADAVG 1
-| /* end confdefs.h.  */
-| #define _GNU_SOURCE
-|    #include <pthread.h>
-| int
-| main ()
-| {
-| cpu_set_t cpuset;
-|    pthread_attr_t attr;
-|    pthread_getaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
-|    if (CPU_ISSET (0, &cpuset))
-|      CPU_SET (1, &cpuset);
-|    else
-|      CPU_ZERO (&cpuset);
-|    pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
-|    pthread_attr_init (&attr);
-|    pthread_attr_getaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
-|    pthread_attr_setaffinity_np (&attr, sizeof (cpu_set_t), &cpuset);
-|   ;
-|   return 0;
-| }
+configure:16868: $? = 0
+configure:16872: test -z
+                        || test ! -s conftest.err
+configure:16875: $? = 0
+configure:16878: test -s conftest
+configure:16881: $? = 0
 configure:16899: checking for clock_gettime in -lrt
,,,
-conftest.c:32: error: 'dllexport' attribute directive ignored
+conftest.c:33: error: 'dllexport' attribute directive ignored
 configure:17357: $? = 1
 configure: failed program was:
 | /* confdefs.h.  */
@@ -980,6 +890,7 @@
 | #define HAVE_SEMAPHORE_H 1
 | #define HAVE_SYS_TIME_H 1
 | #define HAVE_GETLOADAVG 1
+| #define HAVE_PTHREAD_AFFINITY_NP 1
 | #define HAVE_CLOCK_GETTIME 1
 | #define HAVE_TLS 1
 | #define HAVE_ATTRIBUTE_VISIBILITY 1
@@ -1066,10 +977,10 @@
,,,
 ## ---------------- ##
 ## Cache variables. ##
@@ -1309,6 +1220,7 @@
 #define HAVE_GETLOADAVG 1
 #define HAVE_INTTYPES_H 1
 #define HAVE_MEMORY_H 1
+#define HAVE_PTHREAD_AFFINITY_NP 1
 #define HAVE_SEMAPHORE_H 1
 #define HAVE_STDINT_H 1
 #define HAVE_STDLIB_H 1


Again that is "-" works and "+" is broken. 

In the follow-up message http://gcc.gnu.org/ml/gcc/2007-04/msg00884.html Martin
ends up with the same problem as I have but on a different platform and not as
a result of having made an upgrade and breaking things.

It ended up that no solution was given and there were no more follow-ups.

I don't know that the config.logs should be that different but I do know my fix
made no use of the info - perhaps it will help someone else.


My file /usr/include/pthread.h makes no mention of pthread_getaffinity_np .

Here is some of my file: /usr/include/nptl/pthread.h

#ifdef __USE_GNU
/* Yield the processor to another thread or process.
   This function is similar to the POSIX `sched_yield' function but
   might be differently implemented in the case of a m-on-n thread
   implementation.  */
extern int pthread_yield (void) __THROW;
/* Limit specified thread TH to run only on the processors represented
   in CPUSET.  */
extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
                                   __const cpu_set_t *__cpuset) __THROW;

/* Get bit set in CPUSET representing the processors TH can run on.  */
extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
                                   cpu_set_t *__cpuset) __THROW;
#endif


We are using the command:
/opt/gcc-4_3-build/./gcc/xgcc -B/opt/gcc-4_3-build/./gcc/
-B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem
/usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include
-DHAVE_CONFIG_H -I. -I/root/downloads/gcc-4_3-trunk/libgomp -I.
-I/root/downloads/gcc-4_3-trunk/libgomp/config/linux/x86
-I/root/downloads/gcc-4_3-trunk/libgomp/config/linux
-I/root/downloads/gcc-4_3-trunk/libgomp/config/posix
-I/root/downloads/gcc-4_3-trunk/libgomp -Wall -Werror -pthread
-ftls-model=initial-exec -O2 -g -O2 -MT proc.lo -MD -MP -MF .deps/proc.Tpo -c
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c  -fPIC -DPIC -o
.libs/proc.o


Tossing a "-v" on that provides:

...
 /usr/local/include
 /usr/include
End of search list.
GNU C version 4.3.0 20070602 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.3.0 20070602 (experimental), GMP version
4.2.1, MPFR version 2.2.1-p5.
warning: MPFR header version 2.2.1-p5 differs from library version 2.2.0.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 2616d23dcd2c1ab70f081aa4f37a5c4a
cc1: warnings being treated as errors
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c: In function
'gomp_init_num_threads':
/root/downloads/gcc-4_3-trunk/libgomp/config/linux/proc.c:78: error: implicit
declaration of function 'pthread_getaffinity_np'


The file: gcc-4_3-trunk/libgomp/libgomp.h says "#include <pthread.h>", so we
don't have the proper include path for _my_ situation.


File: /usr/share/doc/libc6/ChangeLog.nptl - Last updated 2007-05-14 - says:

What always will work is to use the API glibc provides.  Compile and run the
following little program to get the version information:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <stdio.h>
#include <gnu/libc-version.h>
int main (void) { puts (gnu_get_libc_version ()); return 0; }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


The file: gcc-4_3-trunk/libgomp/libgomp.h says "#include <pthread.h>".

Change that to:

/* #include <pthread.h> */
#include <nptl/pthread.h>


And the build completes a minutes later - no errors.


Just add the above function to the configure to check the libc6 version
and set a define to select between "pthread.h" and "nptl/pthread.h" and it
would work.

We need both defines since it works fine on libc6 2.3.6.ds1-13 on
i686-pc-linux-gnu without my fix but breaks with libc6_2.6~20070518-2 unless it
is applied.

We might as well apply this fix to configure in the weeks to come since as soon
as someone upgrades their libc they will break libgomp this way.


-- 
           Summary: Upgrading GNU/Linux to libc6_2.6~20070518-2 breaks
                    libgomp make - FIX given
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgomp
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rob1weld at aol dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2022-11-28 22:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-32193-4@http.gcc.gnu.org/bugzilla/>
2012-09-27  5:22 ` [Bug libgomp/32193] libgomp does not honor --disable-werror vapier at gentoo dot org
2012-12-23 23:31 ` vapier at gentoo dot org
2022-11-03  8:16 ` vapier at gcc dot gnu.org
2022-11-28 22:13 ` pinskia at gcc dot gnu.org
2007-06-03  5:16 [Bug libgomp/32193] New: Upgrading GNU/Linux to libc6_2.6~20070518-2 breaks libgomp make - FIX given rob1weld at aol dot com
2009-02-21  9:12 ` [Bug libgomp/32193] libgomp does not honor --disable-werror laurent at guerby dot net

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