scripts/build/companion_libs/cloog.sh
author "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
Fri Jan 27 13:31:16 2012 +0100 (2012-01-27)
changeset 2854 a70abdbfa342
parent 2758 47199f966983
child 2927 ddaae597fd7c
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@1380
     1
# This file adds the functions to build the CLooG library
yann@1380
     2
# Copyright 2009 Yann E. MORIN
yann@1380
     3
# Licensed under the GPL v2. See COPYING in the root of this package
yann@1380
     4
yann@1380
     5
do_cloog_get() { :; }
yann@1380
     6
do_cloog_extract() { :; }
yann@1380
     7
do_cloog() { :; }
yann@1380
     8
yann@1380
     9
# Overide functions depending on configuration
yann@1808
    10
if [ "${CT_CLOOG}" = "y" ]; then
yann@1380
    11
yann@1380
    12
# Download CLooG
yann@1380
    13
do_cloog_get() {
yann@1380
    14
    CT_GetFile "cloog-ppl-${CT_CLOOG_VERSION}"  \
yann@1380
    15
        ftp://gcc.gnu.org/pub/gcc/infrastructure
yann@1380
    16
}
yann@1380
    17
yann@1380
    18
# Extract CLooG
yann@1380
    19
do_cloog_extract() {
yann@1530
    20
    local _t
yann@1530
    21
yann@1530
    22
    # Version 0.15.3 has a dirname 'cloog-ppl' (with no version in it!)
yann@1530
    23
    # while versions 0.15.4 onward do have the version in the dirname.
yann@2757
    24
    # But, because the infrastructure properly creates the extracted
yann@2757
    25
    # directories (with tar's --strip-components), we can live safely...
yann@2757
    26
    CT_Extract "cloog-ppl-${CT_CLOOG_VERSION}"
yann@2757
    27
    CT_Patch "cloog-ppl" "${CT_CLOOG_VERSION}"
yann@2757
    28
yann@2758
    29
    if [ "${CT_CLOOG_NEEDS_AUTORECONF}" = "y" ]; then
yann@2757
    30
        CT_Pushd "${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
yann@2704
    31
        CT_DoExecLog CFG ./autogen.sh
yann@2757
    32
        CT_Popd
yann@2262
    33
    fi
yann@1380
    34
}
yann@1380
    35
yann@1380
    36
do_cloog() {
yann@2757
    37
    local cloog_src_dir="${CT_SRC_DIR}/cloog-ppl-${CT_CLOOG_VERSION}"
yann@1537
    38
yann@1380
    39
    mkdir -p "${CT_BUILD_DIR}/build-cloog-ppl"
yann@1380
    40
    cd "${CT_BUILD_DIR}/build-cloog-ppl"
yann@1380
    41
yann@1380
    42
    CT_DoStep INFO "Installing CLooG/ppl"
yann@1380
    43
yann@1380
    44
    CT_DoLog EXTRA "Configuring CLooG/ppl"
yann@1892
    45
yann@2349
    46
    CT_DoExecLog CFG                            \
yann@1537
    47
    CFLAGS="${CT_CFLAGS_FOR_HOST}"              \
benoit@2854
    48
    LIBS="-lm"                                  \
yann@2757
    49
    "${cloog_src_dir}/configure"                \
yann@1537
    50
        --build=${CT_BUILD}                     \
yann@1537
    51
        --host=${CT_HOST}                       \
yann@1893
    52
        --prefix="${CT_COMPLIBS_DIR}"           \
yann@1893
    53
        --with-gmp="${CT_COMPLIBS_DIR}"         \
yann@1893
    54
        --with-ppl="${CT_COMPLIBS_DIR}"         \
yann@1892
    55
        --with-bits=gmp                         \
yann@2381
    56
        --with-host-libstdcxx='-lstdc++'        \
yann@2381
    57
        --disable-shared                        \
yann@2381
    58
        --enable-static
yann@1380
    59
yann@1380
    60
    CT_DoLog EXTRA "Building CLooG/ppl"
yann@2275
    61
    CT_DoExecLog ALL make ${JOBSFLAGS} libcloog.la
yann@1380
    62
yann@1890
    63
    if [ "${CT_COMPLIBS_CHECK}" = "y" ]; then
yann@1380
    64
        CT_DoLog EXTRA "Checking CLooG/ppl"
yann@2275
    65
        CT_DoExecLog ALL make ${JOBSFLAGS} -s check
yann@1380
    66
    fi
yann@1380
    67
yann@1380
    68
    CT_DoLog EXTRA "Installing CLooG/ppl"
yann@2199
    69
    CT_DoExecLog ALL make install-libLTLIBRARIES install-pkgincludeHEADERS
yann@1397
    70
yann@1380
    71
    CT_EndStep
yann@1380
    72
}
yann@1380
    73
yann@1808
    74
fi # CT_CLOOG