[FFmpeg-user] How can I see what version of a library is linked? (e.g. libmp3lame)

Zak ffmpeg-user-email at m.allo.ws
Tue Jun 12 12:39:56 EEST 2018


On 2018-06-12 at 4:11 AM EDT, Carl Eugen Hoyos wrote:
> 2018-06-12 4:42 GMT+02:00, Zak <ffmpeg-user-email at m.allo.ws>:
> 
> These two questions cannot be answered by ffmpeg, by
> any executable, I suspect security considerations are
> among the reasons why this is impossible.
> 
> Iirc, ldd does not work on osx, "otool -L ffmpeg" will tell you.
> 
> Version information (that may not be available for all
> external libs but certainly for some) is a missing feature.
> 
> Carl Eugen

Yes, the following works on MacOS:

bash$ otool -L /path/to/ffmpeg

/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 
1.0.5)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
# ...snip...

By default, it follows symlinks all the way to a real file, and it 
prints the compatibility version and current version, which is nice.

I can't figure out how to see what the executable actually requires, in 
the case where it was given a newer version than it requires. So it 
loads libz.1.dylib verson 1.2.5, but what version does FFmpeg really 
NEED? Is 1.0.0 good enough? Or does FFmpeg need >= 1.1.0? Or >= 1.2.0? 
Does the FFmpeg executable actually include such specific information, 
or will it fail if and when it looks up a symbol and can't find it? I 
have this question about otool on MacOS and also ldd on Linux.

Sad note:

libmp3lame is not dynamically linked by FFmpeg on either my Mac or my 
Kubuntu box. It must be statically linked, which means the version 
information is lost - unless I disassemble ffmpeg or something. On 
Kubuntu, the default behavior of GNU ld should be to use the dynamic 
link version if possible (I think), and it is possible to dynamically 
link libmp3lame.so. I may try recompiling FFmpeg and looking for the 
linker call with something like -lmp3lame or -llibmp3lame, and see if it 
is preceded by an instruction to statically link it.

It looks like Danny Mitchell's compiled version of ffmpeg also has 
libmp3lame statically linked, or else it doesn't have it at all. And 
Danny Mitchell's ldd ffmpeg output lists a large number of dynamically 
linked libraries that I didn't enable or link in any way, so I'm 
guessing the MP3 encoder was not disabled. But maybe it was disabled. My 
ffmpeg only has one MP3 encoder (libmp3lame), although it seems to have 
possibly up to six decoders (I don't know whether to count MP3onMP4, for 
instance). I am unaware of any MP3 encoder aside from libmp3lame that is 
supported by FFmpeg, and I don't see any on that ldd output from Danny 
Mitchell.

It would be nice for FFmpeg to record the versions of statically linked 
libraries, but it looks like it would be hard.

Zak


More information about the ffmpeg-user mailing list