Using Multiple versions of glibc using LD_LIBRARY_PATH env variable.

Carlos O'Donell carlos@systemhalted.org
Tue Dec 30 16:22:00 GMT 2008


On Mon, Dec 29, 2008 at 2:06 PM, Kangkook Jee <aixer77@gmail.com> wrote:
>  $ export LD_LIBRARY_PATH=/tmp/lib-2.9/lib:$LD_LIBRARY_PATH
>  $ echo $LD_LIBRARY_PATH
>  /tmp/lib-2.9/lib
>  $ /bin/ls
>  Segmentation fault (core dumped)

This doesn't work because /bin/ls has a INTERP program header that
requests /lib/ld-linux.so.2 and this dynamic loader does correctly
match the C library in /tmp/lib-2.9/lib/.

It would be nicer if it didn't SIGSEGV and printed an error.

> What I did next was using 'ld-linux.so.2' loader and it could exeute the
> command.
>
>  $/tmp/lib-2.9/lib/ld-linux.so.2 --library-path /tmp/lib-2.9/lib /bin/ls

This is the correct way to load the application with an alternate libc.

> But I still want to find cleaner solution to have multiple versions of glic
> in a single machine. Can anyone help me with this?

Replace /lib/ld-linux.so.2 with an application that checks an
environment variable and execs the right dynamic loader with the
correct options.

Cheers,
Carlos.



More information about the Libc-help mailing list