[OS X TeX] OT: getting library version

Peter Dyballa Peter_Dyballa at Web.DE
Sat May 31 15:09:00 CEST 2008


Am 31.05.2008 um 11:28 schrieb Bruno Voisin:

>> By the way, I've spent the last hour or so looking for how to get  
>> the version number of a library (other than looking at the name  
>> and trying to guess), without any success. For binaries you can  
>> try the -v or --version options, but what about libraries?

Libraries that are linked statically to a programme don't need to  
show a version number – you can't exchange a static library of  
version a with one of version b. Dynamic libraries (dylibs) usually  
show their version number in their file names:

-rwxr-xr-x   1 root  admin  502268  9 Mai 13:20 /sw/lib/libpng.3.dylib
lrwxr-xr-x   1 root  admin      10  9 Mai 13:20 /sw/lib/libpng.a ->  
libpng12.a
lrwxr-xr-x   1 root  admin      14  9 Mai 13:20 /sw/lib/libpng.dylib - 
 > libpng12.dylib
-rwxr-xr-x   1 root  admin  502268  9 Mai 13:20 /sw/lib/libpng12.0.dylib
-rw-r--r--   1 root  admin  578848  9 Mai 13:20 /sw/lib/libpng12.a
lrwxr-xr-x   1 root  admin      16  9 Mai 13:20 /sw/lib/ 
libpng12.dylib -> libpng12.0.dylib

OK, bad example! Fink gives its libraries sometimes other versioning  
information. Apple does not cheat that much:

-rw-r--r--   1 root  wheel  1926220  7 Nov  2006 /usr/X11R6/lib/ 
libX11.6.2.dylib
lrwxr-xr-x   1 root  wheel       16 22 Nov  2006 /usr/X11R6/lib/ 
libX11.6.dylib -> libX11.6.2.dylib
-rw-r--r--   1 root  wheel  2829964 12 Sep  2006 /usr/X11R6/lib/libX11.a
lrwxr-xr-x   1 root  wheel       16 22 Nov  2006 /usr/X11R6/lib/ 
libX11.dylib -> libX11.6.2.dylib

Here two sym-links with simpler names point to the proper X11 library  
version 6.2.

>>
>> Some googling pointed to otool, and indeed a few time ago Jonathan  
>> Kew posted the instruction "otool -L" to get a list of linked  
>> libraries with version numbers, so I tried "otool -L /usr/local/ 
>> bin/fontforge" hoping it would yield that info for libpng and  
>> libfontconfig, to which fontforge is linked statically. It didn't  
>> work and then I realized "otool -L" yields only dynamic library  
>> info. I tried also stuff like "otool -fv /usr/X11/lib/ 
>> libpng12.dylib" but couldn't make any sense out of the answer.
>>

The otool utility can be fooled so to report "incorrect" version  
info. In Fink you won't get correct info, except you use Fink to make  
it describe what it has installed or provides. Martin Constabel's  
advice with the strings command can mostly work – in Tiger it fails  
on the well versioned X11 related dylibs ...

--
Greetings

   Pete

One person with a belief is a social power equal to ninety-nine who  
have only interests.
				– John Stuart Mill






More information about the macostex-archives mailing list