tl;dr: read the compile guide, and set a PREFIX and / or
I did something I don’t normally do and compiled ffmpeg today, since the ffmpeg-user mailing list requires/strongly prefers/only supports current git head. I was doing this as I had some broken AVI files and wondered if they were salvageable:
Since it’s been a while since I’ve last compiled ffmpeg, I figured I’d grab a static build from John Van Sickle, but that was slightly out of date.
I then grabbed the ffmpeg sources,
configure‘d what I thought was sensible, but got:
error while loading shared libraries: libavdevice.so.59: cannot open shared object file: No such file or directory. My system libavdevice library was version 58. Hmm. I thought I had compiled statically, but:
./ffmpeg: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=6b4340cce612e0ccba534da4100c363d4aa578ef, for GNU/Linux 4.4.0, not stripped
Hmm. Dynamically linked?
I must confess that I had gotten used to running the odd compiled binary ‘out of the box’* after a
make without further interaction; taking easy compilation for granted.
Building dynamic is easier in the long run; but I didn’t want to clobber the system, package-managed binaries or libraries. Fortunately that’s what the
PREFIX configure option makes possible, in particular: “
PREFIX/lib: contains the generated libraries (e.g. libavutil, libavcodec, libavformat etc. in the case of FFmpeg)“.
* It is still possible to run out of the box by telling ffmpeg where to find the libraries, by prefixing the command with