complibs/cloog: fix linking with libm
author"Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854a70abdbfa342
parent 2853 5182fa901f30
child 2855 6a7dfa57d63a
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>
patches/cloog-ppl/0.15.10/100-add_on_libs_position.patch
patches/cloog-ppl/0.15.11/100-add_on_libs_position.patch
patches/cloog-ppl/0.15.6/100-add_on_libs_position.patch
patches/cloog-ppl/0.15.7/100-add_on_libs_position.patch
patches/cloog-ppl/0.15.8/100-add_on_libs_position.patch
patches/cloog-ppl/0.15.9/100-add_on_libs_position.patch
scripts/build/companion_libs/cloog.sh
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/cloog-ppl/0.15.10/100-add_on_libs_position.patch	Fri Jan 27 13:31:16 2012 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +diff -Naurd cloog-ppl-0.15.10-a/configure cloog-ppl-0.15.10-b/configure
     1.5 +--- cloog-ppl-0.15.10-a/configure	2010-08-27 21:14:33.000000000 +0200
     1.6 ++++ cloog-ppl-0.15.10-b/configure	2012-01-27 13:28:49.262987773 +0100
     1.7 +@@ -11168,7 +11168,7 @@
     1.8 + fi
     1.9 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1.10 + 
    1.11 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    1.12 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    1.13 + 
    1.14 + $as_echo "#define CLOOG_PPL_BACKEND 1" >>confdefs.h
    1.15 + 
    1.16 +diff -Naurd cloog-ppl-0.15.10-a/configure.in cloog-ppl-0.15.10-b/configure.in
    1.17 +--- cloog-ppl-0.15.10-a/configure.in	2010-08-27 21:13:48.000000000 +0200
    1.18 ++++ cloog-ppl-0.15.10-b/configure.in	2012-01-27 13:28:49.262987773 +0100
    1.19 +@@ -343,7 +343,7 @@
    1.20 + 	#endif
    1.21 + 	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
    1.22 + 
    1.23 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    1.24 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    1.25 + 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
    1.26 + 
    1.27 + else
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/patches/cloog-ppl/0.15.11/100-add_on_libs_position.patch	Fri Jan 27 13:31:16 2012 +0100
     2.3 @@ -0,0 +1,24 @@
     2.4 +diff -Naurd cloog-ppl-0.15.11-a/configure cloog-ppl-0.15.11-b/configure
     2.5 +--- cloog-ppl-0.15.11-a/configure	2011-04-01 06:22:53.000000000 +0200
     2.6 ++++ cloog-ppl-0.15.11-b/configure	2012-01-27 13:29:42.698987517 +0100
     2.7 +@@ -11238,7 +11238,7 @@
     2.8 + fi
     2.9 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2.10 + 
    2.11 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    2.12 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    2.13 + 
    2.14 + $as_echo "#define CLOOG_PPL_BACKEND 1" >>confdefs.h
    2.15 + 
    2.16 +diff -Naurd cloog-ppl-0.15.11-a/configure.in cloog-ppl-0.15.11-b/configure.in
    2.17 +--- cloog-ppl-0.15.11-a/configure.in	2010-08-27 21:13:48.000000000 +0200
    2.18 ++++ cloog-ppl-0.15.11-b/configure.in	2012-01-27 13:29:42.698987517 +0100
    2.19 +@@ -343,7 +343,7 @@
    2.20 + 	#endif
    2.21 + 	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
    2.22 + 
    2.23 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    2.24 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    2.25 + 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
    2.26 + 
    2.27 + else
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/cloog-ppl/0.15.6/100-add_on_libs_position.patch	Fri Jan 27 13:31:16 2012 +0100
     3.3 @@ -0,0 +1,24 @@
     3.4 +diff -Naurd cloog-ppl-0.15.6-a/configure cloog-ppl-0.15.6-b/configure
     3.5 +--- cloog-ppl-0.15.6-a/configure	2009-08-10 23:18:07.000000000 +0200
     3.6 ++++ cloog-ppl-0.15.6-b/configure	2012-01-27 13:25:08.858988857 +0100
     3.7 +@@ -12917,7 +12917,7 @@
     3.8 + 
     3.9 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    3.10 + 
    3.11 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    3.12 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    3.13 + 
    3.14 + cat >>confdefs.h <<\_ACEOF
    3.15 + #define CLOOG_PPL_BACKEND 1
    3.16 +diff -Naurd cloog-ppl-0.15.6-a/configure.in cloog-ppl-0.15.6-b/configure.in
    3.17 +--- cloog-ppl-0.15.6-a/configure.in	2009-08-10 23:18:07.000000000 +0200
    3.18 ++++ cloog-ppl-0.15.6-b/configure.in	2012-01-27 13:25:08.862988846 +0100
    3.19 +@@ -354,7 +354,7 @@
    3.20 + 	#endif
    3.21 + 	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
    3.22 + 
    3.23 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    3.24 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    3.25 + 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
    3.26 + 
    3.27 + else
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/patches/cloog-ppl/0.15.7/100-add_on_libs_position.patch	Fri Jan 27 13:31:16 2012 +0100
     4.3 @@ -0,0 +1,24 @@
     4.4 +diff -Naurd cloog-ppl-0.15.7-a/configure cloog-ppl-0.15.7-b/configure
     4.5 +--- cloog-ppl-0.15.7-a/configure	2009-08-12 03:33:31.000000000 +0200
     4.6 ++++ cloog-ppl-0.15.7-b/configure	2012-01-27 13:26:13.970988501 +0100
     4.7 +@@ -12902,7 +12902,7 @@
     4.8 + 
     4.9 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    4.10 + 
    4.11 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    4.12 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    4.13 + 
    4.14 + cat >>confdefs.h <<\_ACEOF
    4.15 + #define CLOOG_PPL_BACKEND 1
    4.16 +diff -Naurd cloog-ppl-0.15.7-a/configure.in cloog-ppl-0.15.7-b/configure.in
    4.17 +--- cloog-ppl-0.15.7-a/configure.in	2009-08-12 03:33:31.000000000 +0200
    4.18 ++++ cloog-ppl-0.15.7-b/configure.in	2012-01-27 13:26:13.970988501 +0100
    4.19 +@@ -345,7 +345,7 @@
    4.20 + 	#endif
    4.21 + 	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
    4.22 + 
    4.23 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    4.24 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    4.25 + 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
    4.26 + 
    4.27 + else
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/patches/cloog-ppl/0.15.8/100-add_on_libs_position.patch	Fri Jan 27 13:31:16 2012 +0100
     5.3 @@ -0,0 +1,24 @@
     5.4 +diff -Naurd cloog-ppl-0.15.8-a/configure cloog-ppl-0.15.8-b/configure
     5.5 +--- cloog-ppl-0.15.8-a/configure	2010-02-11 19:05:30.000000000 +0100
     5.6 ++++ cloog-ppl-0.15.8-b/configure	2012-01-27 13:27:09.710988253 +0100
     5.7 +@@ -12902,7 +12902,7 @@
     5.8 + 
     5.9 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    5.10 + 
    5.11 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    5.12 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    5.13 + 
    5.14 + cat >>confdefs.h <<\_ACEOF
    5.15 + #define CLOOG_PPL_BACKEND 1
    5.16 +diff -Naurd cloog-ppl-0.15.8-a/configure.in cloog-ppl-0.15.8-b/configure.in
    5.17 +--- cloog-ppl-0.15.8-a/configure.in	2010-02-11 19:05:31.000000000 +0100
    5.18 ++++ cloog-ppl-0.15.8-b/configure.in	2012-01-27 13:27:09.710988253 +0100
    5.19 +@@ -345,7 +345,7 @@
    5.20 + 	#endif
    5.21 + 	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
    5.22 + 
    5.23 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    5.24 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    5.25 + 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
    5.26 + 
    5.27 + else
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/patches/cloog-ppl/0.15.9/100-add_on_libs_position.patch	Fri Jan 27 13:31:16 2012 +0100
     6.3 @@ -0,0 +1,24 @@
     6.4 +diff -Naurd cloog-ppl-0.15.9-a/configure cloog-ppl-0.15.9-b/configure
     6.5 +--- cloog-ppl-0.15.9-a/configure	2010-03-23 22:29:47.000000000 +0100
     6.6 ++++ cloog-ppl-0.15.9-b/configure	2012-01-27 13:28:03.866987993 +0100
     6.7 +@@ -12902,7 +12902,7 @@
     6.8 + 
     6.9 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    6.10 + 
    6.11 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    6.12 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    6.13 + 
    6.14 + cat >>confdefs.h <<\_ACEOF
    6.15 + #define CLOOG_PPL_BACKEND 1
    6.16 +diff -Naurd cloog-ppl-0.15.9-a/configure.in cloog-ppl-0.15.9-b/configure.in
    6.17 +--- cloog-ppl-0.15.9-a/configure.in	2010-03-23 22:29:47.000000000 +0100
    6.18 ++++ cloog-ppl-0.15.9-b/configure.in	2012-01-27 13:28:03.866987993 +0100
    6.19 +@@ -345,7 +345,7 @@
    6.20 + 	#endif
    6.21 + 	], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR(Can't find correct version of PPL.) ])
    6.22 + 
    6.23 +-	LIBS="$LIBS -lppl_c -lppl -lgmpxx"
    6.24 ++	LIBS="-lppl_c -lppl -lgmpxx $LIBS"
    6.25 + 	AC_DEFINE([CLOOG_PPL_BACKEND], 1, [Use the PPL backend])
    6.26 + 
    6.27 + else
     7.1 --- a/scripts/build/companion_libs/cloog.sh	Fri Jan 27 13:13:00 2012 +0100
     7.2 +++ b/scripts/build/companion_libs/cloog.sh	Fri Jan 27 13:31:16 2012 +0100
     7.3 @@ -45,7 +45,7 @@
     7.4  
     7.5      CT_DoExecLog CFG                            \
     7.6      CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
     7.7 -    LDFLAGS="-lm"                               \
     7.8 +    LIBS="-lm"                                  \
     7.9      "${cloog_src_dir}/configure"                \
    7.10          --build=${CT_BUILD}                     \
    7.11          --host=${CT_HOST}                       \