static gcc 4.0.2 with shared libraries

Donatas Vyzas donatas@viesulas.ktu.lt
Fri Nov 4 17:46:00 GMT 2005


Hi!

I am trying to compile gcc 4.0.2 on HP-UX 11.0 with shared
libraries(languages c and c++), but I want that all gcc stuff(executables)
would be static. I am trying to do this with gcc 3.2, which is located in
/usr/local/. I want to have both compilers. I have already successfully
compiled gcc 4.0.2 on this machine, with --disable-shared first, and with
--enable-shared after that. My configure and making scripts are:

$ cat conf_gcc
#!/bin/sh
../gcc-4.0.2/configure --prefix=/usr/local/gcc --enable-threads
--with-gnu-as --enable-languages=c,c++ --disable-nls --enable-shared
--disable-nls --disable-checking --with-ld=/usr/ccs/bin/ld

$ cat gmake_gcc
#!/bin/sh
gmake CFLAGS='-O' LIBCFLAGS='-g -O2' LIBCXXFLAGS='-g -O2
-fno-implicit-templates' LDFLAGS='-L/usr/local/lib' bootstrap-lean

So I have gcc 3.2 in /usr/local and gcc 4.0.2 in /usr/local/gcc . But
there are several problems with this. One problem is, that
/usr/local/gcc/bin/* executables (that is 4.0.2 version's gcc,g++
etc.) uses shared libgcc_s.sl which is provided with gcc 3.2:

$ ldd /usr/local/gcc/bin/gcc
        /usr/lib/libc.2 =>      /usr/lib/libc.2
        /usr/lib/libdld.2 =>    /usr/lib/libdld.2
        /usr/lib/libc.2 =>      /usr/lib/libc.2
        /usr/local/lib/libiconv.sl.5 => /usr/local/lib/libiconv.sl.5
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../libgcc_s.sl =>
/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../libgcc_s.sl
        /usr/lib/libc.2 =>      /usr/lib/libc.2
        /usr/lib/libc.2 =>      /usr/lib/libc.2

path
"/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../libgcc_s.sl" is
the same as "/usr/local/lib/libgcc_s.sl" and this happens to be the shared
library from gcc 3.2 version, and not the 4.0.2!!!. The most stragest
thing, is that this dynamic linking path is expressed in this way.  Why
all this unnesesary line "gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../"
needed, and how it is generated? It is even more stanger, that I am using
gcc 3.2, and not the gcc 3.1 (I used to use it before).

So my questions are:

1. Is it possible that when I was removing gcc 3.1 and installing 3.2, any
used shared gcc libraries(like /usr/local/lib/libgcc_s.sl) were not
removed and updated, since they were used by some process at that time? If
yes, how can I get version info from libgcc_s.sl shared library to make
sure(now gcc -v shows 3.2)?

2. How can I specify, when building gcc 4.0.2, that I want gcc(and other)
executables be static(but at the same time gcc to build shared libraries)?
Even if knew how to do it, how can I be sure, that the correct version of
libraries will be used(like now 4.0.2 gcc executable uses 3.2 version
shared libraries)?

3. Why did after linking gcc 4.0.2, dynamic linker used path
"/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.1/../../../libgcc_s.sl"
instead of "/usr/local/lib/libgcc_s.sl"(they have the same meaning)?

4. Why did gcc 4.0.2 executables used gcc 3.2 shared libraries? Is it
because I have set environment variable LDFLAGS='-L/usr/local/lib', and
linker uses the first libgcc_s.sl library it could find (I have
set it because the linker could not find libiconv shared library, which
is located in /usr/local/lib. I even could disable libiconv support in
gcc if I knew how)?

Thank you for your time,

Donatas



More information about the Gcc-help mailing list