while building GCC linking libstdc++.so with the correct libgcc_s.so.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ciao,

  on my  Slackware64 14.2  x86_64-pc-linux-gnu, I'm  using GCC  9.1.0; I
install multiple versions  of GCC under "/opt", always  from the release
tarballs.  Slackware's GCC 5.3.0 package  is also installed, so that the
shared libraries are under "/usr/lib64":

$ls -1 /usr/lib64/libstdc* /usr/lib64/libgcc*
/usr/lib64/libgccpp.la*
/usr/lib64/libgccpp.so@
/usr/lib64/libgccpp.so.1@
/usr/lib64/libgccpp.so.1.0.3*
/usr/lib64/libgcc_s.so@
/usr/lib64/libgcc_s.so.1*
/usr/lib64/libstdc++.a
/usr/lib64/libstdc++.la*
/usr/lib64/libstdc++.so@
/usr/lib64/libstdc++fs.a
/usr/lib64/libstdc++fs.la*
/usr/lib64/libstdc++.so.5@
/usr/lib64/libstdc++.so.5.0.7*
/usr/lib64/libstdc++.so.6@
/usr/lib64/libstdc++.so.6.0.21*

  When  I build  a  GCC release,  I  use this  script  to configure  the
package:

#!/bin/bash

set -x
/bin/mkdir ~/var/tmp/build-gcc
cd ~/var/tmp/build-gcc
~/var/build/devel/gcc-9.1.0/configure           \
    --prefix=/opt/gcc/9.1.0                     \
    --libdir=/opt/gcc/9.1.0/lib64               \
    --enable-languages=fortran,c,c++            \
    --disable-multilib                          \
    \
    --with-gmp-include=/usr/local/include       \
    --with-gmp-lib=/usr/local/lib64             \
    \
    --with-mpfr-include=/usr/local/include      \
    --with-mpfr-lib=/usr/local/lib64            \
    \
    --with-mpc-include=/usr/local/include       \
    --with-mpc-lib=/usr/local/lib64

### end of file

everything seems to work when using  the C language; but, while building
some packages using C++ (in  this specific case: Libexpat's test suite),
an error is raised:

libtool: link: g++ -g -O2 -Wall -Wextra -fexceptions -fno-strict-aliasing -fno-strict-aliasing -o .libs/runtestspp runtestspp.o  libruntests.a ../lib/.libs/libexpat.so -Wl,-rpath -Wl,/usr/local/lib
/opt/gcc/9.1.0/lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib64/libstdc++.so: undefined reference to `libiconv'
/opt/gcc/9.1.0/lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib64/libstdc++.so: undefined reference to `libiconv_close'
/opt/gcc/9.1.0/lib64/gcc/x86_64-pc-linux-gnu/9.1.0/../../../../lib64/libstdc++.so: undefined reference to `libiconv_open'
collect2: error: ld returned 1 exit status

  I am not sure, but the problem might be this:

$ldd /opt/gcc/9.1.0/lib64/libstdc++.so
        linux-vdso.so.1 (0x00007ffc8f7a7000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fe02f949000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe02f580000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe03002b000)
        libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fe02f369000)

the  library "libstdc++.so"  is  linked with  "/usr/lib64/libgcc_s.so.1"
rather than "/opt/gcc/9.1.0/lib64/libgcc_s.so.1" as it should be.

  An ugly workaround for building packages is to build them with:

   LDFLAGS="-liconv"

  I  have other  GCC  versions installed,  and they  all  have the  same
problem (unsurprisingly, I used the same build script):

$ldd /opt/gcc/8*/lib64/libstdc++.so
/opt/gcc/8.2.0/lib64/libstdc++.so:
        linux-vdso.so.1 (0x00007ffe8d257000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f56b5a8c000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f56b56c3000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f56b6117000)
        libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007f56b54ac000)
/opt/gcc/8.3.0/lib64/libstdc++.so:
        linux-vdso.so.1 (0x00007ffdf294e000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fae9c52d000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fae9c164000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fae9cbb9000)
        libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fae9bf4d000)

  I have these settings, but I doubt they are the problem:

$echo $LD_LIBRARY_PATH
/usr/local/lib64:/usr/lib64

$echo $LD_RUN_PATH
/usr/local/lib64:/usr/lib64

$cat /etc/ld.so.conf
/lib64
/usr/lib64
/usr/local/lib64
/usr/x86_64-slackware-linux/lib64

  I do not know how to fix this.  Any idea?

TIA
-- 
Marco Maggi



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux