This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Linking a C++ program against non-primary libc



Hi,
    I have a glibc2 Linux system (RH 5.0) and want to link C++ programs
against libc5 using egcs 1.0.2. All of the libc5 related libraries and
include files are in /usr/i486-linux-libc5, I just don't know how to
make the linker link against the correct libraries.

First I copied:
/usr/local/lib/gcc-lib/i586-pc-linux-gnu
to:
/usr/local/lib/gcc-lib/i486-linux-libc5

and modified /usr/local/lib/gcc-lib/i486-linux-libc5/egcs-2.90.27/specs,
changing dynamic-linker from /lib/ld-linux.so.2 to /lib/ld-linux.so.1.

I then compiled everything with:

    -b i486-linux-libc5 -nostdinc \
    -nostdinc -I/usr/i486-linux-libc5/include \
    -I/usr/local/lib/gcc-lib/i486-linux-libc5/egcs-2.90.27/include \
    -I/usr/local/include/g++

to use the libc5 include files.

What I can't work out is what options to pass to the linker to make it
link
against eveything in /usr/i486-linux-libc5/lib and not /usr/lib and /lib
(including crt1.o and crti.o etc).

I have actually managed to get a successful link, using -nostdlib and
manually putting all the necessary libraries on the link line. Thats about
as far as I got since the resulting executable wouldn't run as the dynamic
linker couldn't find libstdc++.so.2.8 (the egcs one) even though it was
definitly mapped in /etc/ld.so.cache. When I tried to run it on a libc5
system, it wasn't linking with libm or libc.

Anyway, I'm very confused by all of this, not having sufficient knowledge
of how the linker works. Any ideas would be much appreciated.

Thanks,
Ben

+---------------------------------------------------------+
|\\ + //   Ben Ross                                \\ ^ //|
| \- -/    ben@proximity.com.au                     \` '/ |
|  \|/     http://www.proximity.com.au/~ben/         \~/  |
+---+-------------------------------------------------+---+



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]