This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


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

Re: Binary apps linked against libdl


>>>>> Christopher Seawood writes:

Christopher> On 22 Apr 1999, Andreas Jaeger wrote:
>> >>>>> Christopher Seawood writes:
>> 
>> >> > sh: error in loading shared libraries: /usr/glibc2.0/lib/libc.so.6:
>> >> > undefined symbol: _dl_global_scope_end
>> 
>> You're mixing /lib/ld-linux.so.2 which is hardcoded into every binary
>> with another libdl.so.2 which isn't hardcoded:

Christopher> Doh! So I am. :-< I'm still confused as to why running the application
Christopher> explicitly using the glibc2.0 ld-linux.so.2 does not work.  From what
Christopher> you've said and what I pasted before, it appears as though it's looking
Christopher> for the 2.0.7 libdl but is complaining that the libdl it gets (apparently,
Christopher> the glibc 2.1.1 one) is missing _dl_global_scope_end.

It gets the 2.0.7 libdl.so but the 2.1.1 ld-linux.so.2. - and that's
the problem.  ld-linux.so defines some symbols!

Christopher> If db2inst execs /bin/sh (which it expects to be ksh), will ksh also use
Christopher> the glibc 2.0.7 ld-linux.so.2 or does the environment get reset on the
Christopher> (presumed) execve() or system()?  

You're running:
LD_LIBRARY_PATH=/usr/glibc2.0/lib /usr/glibc2.0/lib/ld-linux.so.2 ./db2inst
and the glibc 2.0 dynamic linker and the libraries from glibc 2.0 are
used.  Everything fine.  But now db2inst calls /bin/sh with
LD_LIBRARY_PATH still set but with /lib/ld-linux.so.2.  The
environment isn't reset - and /lib/ld-linux.so.2 is used since it's
hardcoded into the binary. -> this gives the broken result since
ld-linux and libraries from different versions can't be mixed.

If you would call:
/usr/glibc2.0/lib/ld-linux.so.2 --library-path /usr/glibc2.0/lib ./db2inst
only db2inst would be executed with glibc 2.0 libraries and /bin/sh
would use the normal libraries.

There's no way to pass information about a different dynamic linker to 
children.  You can only pass the LD_LIBRARY_PATH.

Please note:
- LD_LIBRARY_PATH is read by the dynamic linker ld-linux.so
- each binary contains a hardcoded path to /lib/ld-linux.so.2 which is 
  executed by the kernel.

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de


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