patches/glibc/2.6/180-gcc-4.3-sysinclude-path.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
permissions -rw-r--r--
complibs/cloog: fix linking with libm

In Ubuntu 11.04 and 11.10, the default options for ld have changed.
--no-copy-dt-needed-entries and --as-needed are now enabled by default, which
causes errors like:

[EXTRA] Checking CLooG/ppl
[DEBUG] ==> Executing: 'make' '-j3' '-s' 'check'
[ALL ] Making check in .
[ALL ] config.status: creating include/cloog/cloog-config.h
[ALL ] config.status: include/cloog/cloog-config.h is unchanged
[ALL ] libtool: link: i686-build_pc-linux-gnu-gcc -Wall -fomit-frame-pointer
-pipe -o cloog cloog.o -L/<snip>/build/static/lib ./.libs/libcloog.a -lm
/<snip>/build/static/lib/libppl_c.a /<snip>/build/static/lib/libpwl.a
/<snip>/build/static/lib/libppl.a /<snip>/build/static/lib/libgmpxx.a
/<snip>/build/static/lib/libgmp.a -lstdc++
[ALL ] /usr/bin/ld: /<snip>/build/static/lib/libppl.a(MIP_Problem.o):
undefined reference to symbol 'sqrt@@GLIBC_2.0'
[ALL ] /usr/bin/ld: note: 'sqrt@@GLIBC_2.0' is defined in DSO
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so so try adding
it to the linker command line
[ALL ] /usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/libm.so:
could not read symbols: Invalid operation
[ALL ] collect2: ld returned 1 exit status
[ERROR] make[2]: *** [cloog] Error 1
[ERROR] make[1]: *** [check-recursive] Error 1

See:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

This patch fixes these errors by placing '-lm' at the right place on the command
line as libppl requires libm when linking cloog.

Signed-off-by: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
yann@748
     1
Patch pointed to by Ryan ARNOLD on the libc-help ML.
yann@748
     2
See: http://sourceware.org/ml/libc-help/2008-06/msg00063.html
yann@748
     3
yann@748
     4
Forwarded to crosstool-NG by Ioannis E. VENETIS:
yann@748
     5
See: http://sourceware.org/ml/libc-help/2008-06/msg00063.html
yann@748
     6
yann@748
     7
GCC 4.3 changed the location of some of the header files.  I don't
yann@748
     8
understand why you'd be getting these errors while building GCC since
yann@748
     9
it provides them.
yann@748
    10
yann@748
    11
With regard to GLIBC, Roland checked in some changes so that the GLIBC
yann@748
    12
build system could find the new locations of the GCC provided header
yann@748
    13
files.
yann@748
    14
yann@748
    15
diff -durN glibc-2.6.orig/configure.in glibc-2.6/configure.in
yann@748
    16
--- glibc-2.6.orig/configure.in	2007-06-08 05:16:36.000000000 +0200
yann@748
    17
+++ glibc-2.6/configure.in	2008-06-24 18:38:46.000000000 +0200
yann@748
    18
@@ -911,8 +911,12 @@
yann@748
    19
 # header directory and add that to the list.  NOTE: Only does the right
yann@748
    20
 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
yann@748
    21
 if test -n "$sysheaders"; then
yann@748
    22
-  ccheaders=`$CC -print-file-name=include`
yann@748
    23
-  SYSINCLUDES="-nostdinc -isystem $ccheaders \
yann@748
    24
+  SYSINCLUDES=-nostdinc
yann@748
    25
+  for d in include include-fixed; do
yann@748
    26
+    i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
yann@748
    27
+    SYSINCLUDES="$SYSINCLUDES -isystem $i"
yann@748
    28
+  done
yann@748
    29
+  SYSINCLUDES="$SYSINCLUDES \
yann@748
    30
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
yann@748
    31
   if test -n "$CXX"; then
yann@748
    32
     cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
yann@748
    33
diff -durN glibc-2.6.orig/configure glibc-2.6/configure
yann@748
    34
--- glibc-2.6.orig/configure	2008-06-24 18:35:34.000000000 +0200
yann@748
    35
+++ glibc-2.6/configure	2008-06-24 18:38:46.000000000 +0200
yann@748
    36
@@ -4562,8 +4562,12 @@
yann@748
    37
 # header directory and add that to the list.  NOTE: Only does the right
yann@748
    38
 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
yann@748
    39
 if test -n "$sysheaders"; then
yann@748
    40
-  ccheaders=`$CC -print-file-name=include`
yann@748
    41
-  SYSINCLUDES="-nostdinc -isystem $ccheaders \
yann@748
    42
+  SYSINCLUDES=-nostdinc
yann@748
    43
+  for d in include include-fixed; do
yann@748
    44
+    i=`$CC -print-file-name="$d"` && test "x$i" != "x$d" &&
yann@748
    45
+    SYSINCLUDES="$SYSINCLUDES -isystem $i"
yann@748
    46
+  done
yann@748
    47
+  SYSINCLUDES="$SYSINCLUDES \
yann@748
    48
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
yann@748
    49
   if test -n "$CXX"; then
yann@748
    50
     cxxversion=`$CXX -dumpversion 2>&5` &&