patches/glibc/linuxthreads-2.3.6/100-cygwin.patch
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
parent 402 197e1b49586e
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>
     1 Fixes
     2 elf/librtld.os: In function `process_envvars': : undefined reference to `__access'
     3 ...
     4 when building glibc-2.3.3 on cygwin
     5 
     6 Idea from
     7 http://sources.redhat.com/ml/bug-glibc/2002-01/msg00071/glibc-2.2-cygin-shared.patch
     8 Basically, make glibc use .oST as suffix for 'object static'
     9 instead of .oS, since cygwin has trouble distinguishing .os from .oS
    10 (Original patch had .on, but .oST is more mnemonic for 'object static')
    11 
    12 glibc-linuxthreads-2.3.3 also requires a patch, see 
    13 ../glibc-linuxthreads-2.3.3/glibc-linuxthreads-2.3.3-cygwin.patch
    14 
    15 [ rediffed against glibc-2.3.5 ]
    16 
    17 diff -aur glibc-2.3.5/linuxthreads/Makefile glibc-2.3.5-cygwin/linuxthreads/Makefile
    18 --- glibc-2.3.5/linuxthreads/Makefile	2005-02-16 12:26:38.000000000 +0100
    19 +++ glibc-2.3.5-cygwin/linuxthreads/Makefile	2005-05-11 08:32:50.453125000 +0200
    20 @@ -159,7 +159,7 @@
    21  install: $(inst_libdir)/libpthread.so
    22  $(inst_libdir)/libpthread.so: $(common-objpfx)format.lds \
    23  			      $(objpfx)libpthread.so$(libpthread.so-version) \
    24 -			      $(inst_libdir)/$(patsubst %,$(libtype.oS),\
    25 +			      $(inst_libdir)/$(patsubst %,$(libtype.oST),\
    26  							$(libprefix)pthread) \
    27  			      $(+force)
    28  	(echo '/* GNU ld script';\
    29 @@ -167,7 +167,7 @@
    30  	 echo '   the static library, so try that secondarily.  */';\
    31  	 cat $<; \
    32  	 echo 'GROUP ( $(slibdir)/libpthread.so$(libpthread.so-version)' \
    33 -	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)pthread)'\
    34 +	      '$(libdir)/$(patsubst %,$(libtype.oST),$(libprefix)pthread)'\
    35  	      ')' \
    36  	) > $@.new
    37  	mv -f $@.new $@