This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Building glibc 2.19 for OS/ABI UNIX - System V
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Shaun Jackman <sjackman at gmail dot com>
- Cc: libc-help <libc-help at sourceware dot org>
- Date: Thu, 24 Jul 2014 22:54:47 -0400
- Subject: Re: Building glibc 2.19 for OS/ABI UNIX - System V
- Authentication-results: sourceware.org; auth=none
- References: <CADX6M3qF-6Wd25Pn2Aa_GjdtGaG6Owp=hieR=TYpnXxSvtSbtA at mail dot gmail dot com> <CAE2sS1gWG3z5Q7VhoaH4Lf0UgOC0wjy4Fs4gt1cD5stdOs2aFw at mail dot gmail dot com> <CADX6M3o67SvrNT6LVeA8LCWgqFAWP4jO1EoW8+S0JymhtP2XGw at mail dot gmail dot com> <CAE2sS1h74HZRZJxoL+AzzZbZZBhqRBmxSEG3+jnJ1MNckP06KQ at mail dot gmail dot com> <CADX6M3q+DPNbfXH-EwvdtN=bZbfVuv=3kQ72ZNU15YyZE7zmuw at mail dot gmail dot com> <CAE2sS1gmMvW=YW43oX4qCaLULWcAHyw8=w7pv2WKqMbW0b7=Dw at mail dot gmail dot com> <CADX6M3rDZbx80JDCagYUZ9EAcFYOTKrATu7pGFNqHbHVtTozqA at mail dot gmail dot com>
On Thu, Jul 24, 2014 at 6:58 PM, Shaun Jackman <sjackman@gmail.com> wrote:
>> (a) Copy new versions of all the new libraries you need to your
>> system. Rewriting the program header e.g. INTERP and adding DT_RPATH
>> to force the application to search in a special place first. This
>> option is great since you use the dyanmic loader to your advantage to
>> ensure the right libraries are used.
>
> This worked really well! I used PatchELF to modify the dynamic loader
> and the RPATH of the executable. It'll have to be done on deployment
> to each system, because the location of the new glibc is in the user's
> home directory, but it's possible. I don't suppose there's support to
> expand environment variables like ${HOME} in the ELF header, is there?
>
> patchelf --set-interpreter ${libc}/lib/ld-linux-x86-64.so.2
> --set-rpath ${prefix}/lib foo
>
> [patchelf]: https://nixos.org/patchelf.html
Given your deployment restrictions this is likely your best option.
Particularly given that you don't want to require an admin to install
the application.
To answer your other question: there are dynamic string tokens (DST)
you can use.
See: http://man7.org/linux/man-pages/man8/ld.so.8.html
However, IIRC they are expanded only for DT_RPATH, but I'd verify that
they don't also expand for INTERP.
It doesn't seem like a bad enhancement to expand DSTs for INTERP to
allow self-contained deployments like the one you are designing.
Cheers,
Carlos.