glibc and $ORIGIN

Ryan Arnold ryan.arnold@gmail.com
Tue May 5 22:19:00 GMT 2009


On Tue, May 5, 2009 at 5:05 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Tuesday 05 May 2009 17:44:16 Fabiano Sidler wrote:
>> I'd like to build a system unfixed to absolute paths, so with
>>
>>   LDFLAGS += '-z origin'
>>   LD_RUN_PATH = '$ORIGIN/../lib'
>>
>> Unfortunately, the glibc seems not to support it. Am I wrong or
>> is there a work-around for this?
>
> $ORIGIN on the glibc libs themselves will not work.  $ORIGIN on any other ELF
> should work just fine.  the ldso must always be in /lib/.
> -mike
>

There are ways to get around this but they're not for the faint of
heart.  The following wiki shows how one can tell the compiler that
the loader lives elsewhere:

http://sources.redhat.com/glibc/wiki/Testing/Builds

And one can debug using the following trick:

http://sources.redhat.com/glibc/wiki/Debugging/Development_Debugging#head-0f2b610260f23db5655a16e911aa7134c6bcc0ba

Most people only use this for debugging GLIBC builds.  I don't
recommend it for production environments unless the entire toolchain
is standalone.

A better alternative is a chroot jail with GLIBC installed into the
chroot / directory.

Ryan S. Arnold



More information about the Libc-help mailing list