Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Rainer Weikusat Newsgroups: comp.os.linux.development.apps Subject: Re: Linking problem Date: Fri, 16 Dec 2011 17:46:42 +0000 Lines: 36 Message-ID: <871us4z9x9.fsf@sapphire.mobileactivedefense.com> References: <20111215001104.13eda1b8@efreet.linux> <8762himaw3.fsf@sapphire.mobileactivedefense.com> <20111215162948.60b95d1c@efreet.linux> <874nx17375.fsf@sapphire.mobileactivedefense.com> <20111215234243.40f9ed06@efreet.linux> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: individual.net cR6PPYlYmvo7JtP5J1cInQMJZhIFSQH8xVOhzVS+wsVOzCjB0= Cancel-Lock: sha1:FcJFpgiip53Pw+hEt8b9AHxvPzk= sha1:V+ExTRXb5n0Rq95W/ZtYtSMko2c= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Xref: x330-a1.tempe.blueboxinc.net comp.os.linux.development.apps:334 Kevin Nathan writes: > On Fri, 16 Dec 2011 00:47:10 +0000 > Rainer Weikusat wrote: > >>Forget --sysroot. You need to add your include directories with -I, >>add your library directories with -L and add them again with -Wl,-R >>and that's it. If the binaries are still linked against system >>libraries you don't want, something is still missing in your custom >>library directory. > > That was the ticket! I am 99% there, now. By using this: > > export LDFLAGS=" -Wl,-R /home/username/progroot/lib/ [...] > all the libs listed in "ldd program" are properly pointed to my local > libs locations. However, I still have one lib that will not get the > local subdir: /lib/ld-linux.so.2 (the dynamic loader). I have to deal with a couple of 'legacy' Debian 5 installations where I have a 'manually compiled' glibc-2.11 in /usr/local/glibc-2.11 in order to get access to some newer kernel features. There are also a couple of additional libraries linked with this C library which need to be used in place of the system-provided ones. I'm using this script as 'gcc frontend': [rw@error]~/build/ipsec-tools/build $cat /usr/local/glibc-2.11/bin/gcc #!/bin/sh # G2_11=/usr/local/glibc-2.11 exec gcc -isystem $G2_11/include -L $G2_11/lib -Wl,-dynamic-linker -Wl,$G2_11/lib/ld-linux.so.2 -Wl,-R$G2_11/lib "$@" An example configure invocation could then look like this: CC=/usr/local/glibc-2.11/bin/gcc ./configure ....