Checking for libc vs. glibc using Python

M.-A. Lemburg mal at lemburg.com
Thu Oct 21 11:47:28 EDT 1999


Charles G Waldman wrote:
> 
> M.-A. Lemburg writes:
>  >
>  > What does the output of ldd look like for glibc and libc on other
>  > platforms (e.g. Redhat, *BSD, etc.) ? On SuSE 6.2 Linux I get:
>  >
>  >         libX11.so.6 => /usr/i486-linux-libc5/lib/libX11.so.6 (0x40014000)
>  >         libdl.so.1 => /usr/i486-linux-libc5/lib/libdl.so.1 (0x400b5000)
>  >         libm.so.5 => /usr/i486-linux-libc5/lib/libm.so.5 (0x400b8000)
>  >         libc.so.5 => /usr/i486-linux-libc5/lib/libc.so.5 (0x400c1000)
>  >
>  > for a program linked against libc5 and
>  >
>  >         libc.so.6 => /lib/libc.so.6 (0x40021000)
>  >         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
>  >
>  > for one linked against libc6 (glibc).
> 
> RedHat 6.0 looks exactly the same (except the path prefixes on the
> right differ),
> 
> Solaris output looks is also very similar:
>         libX11.so.4 =>   /usr/lib/libX11.so.4
>         libsocket.so.1 =>        /usr/lib/libsocket.so.1
>         libnsl.so.1 =>   /usr/lib/libnsl.so.1
>         libdl.so.1 =>    /usr/lib/libdl.so.1
>         libc.so.1 =>     /usr/lib/libc.so.1

Hmm, not quite :-) libc.so.1 -- that was a looong time ago ?! Seems
that Redhat chose a different naming scheme here.

>         libXext.so.0 =>  /usr/openwin/lib/libXext.so.0
>         libmp.so.2 =>    /usr/lib/libmp.so.2
> 
> Don't have access to BSD at the moment, and the Irix box I tried seems
> to not have an `ldd' command. :-(   There's probably some Irix
> equivalent, or maybe just a configuration problem on the machine I
> tried, but I don't have time to go digging around right now.

I guess a simple text scan of the file will be the most portable
solution.
 
>  > Note that I can't deduce the glibc version from the above output.
> 
> Why not? You can clearly tell if you're getting libc.so.5 or
> libc.so.6.  Do you need more information than that?

Not really, but if I distribute binaries which contain e.g. glibc2.1
APIs and someone wants to run these on a glibc2.0 system it probably
won't work. I don't think I have to bother about libc5 systems since
they all should have installed the latest versions by now... well,
hopefully (and there's no way to even deduce the version from just
scanning the file, AFAIK).

Thanks for all the help,
-- 
Marc-Andre Lemburg
______________________________________________________________________
Y2000:                                                    71 days left
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/






More information about the Python-list mailing list