I'm trying to compile ffmpeg
as a standalone binary (because I want to use it in AWS lambda)
I can get things to work fine on the server where I'm compiling, but if I copy the binary and run it from another server, I get:
./ffmpeg: error while loading shared libraries: libvdpau.so.1: cannot open shared object file: No such file or directory
So it sounds like something didn't made it into the binary. From what I've read, I've to compile ffmpeg with the flags --disable-shared
and --enable-static
, which I've done:
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--bindir="$HOME/bin" \
--disable-shared \
--enable-static \
--enable-gpl \
--enable-libass \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libvpx \
--enable-libx264
PATH="$HOME/bin:$PATH" make
make install
make distclean
hash -r
Is there something I'm missing?
--enable-static
and--disable-shared
only affectlibav*
binaries. It doesn't prevent linker to use necessary shared object files.For a pure static lib, this is going to be tricky and mess. You have to build every static lib you need, then try to add additional ldflags to configure.
Another alternative is some tools packing those libs/elfs/binaries into a big one. Some of them are listed here: Pack shared libraries into the elf
Add
--extra-ldexeflags="-static"
to get a standalone ffmpeg.Even though I didn't succeed to compile everything in one binary, I've been able to upload the dependencies to AWS lambda by doing:
copy all dependencies in a folder
I wrote a python script to do that. The script relies on
lld
to list the dependencies.AWS lambda
node.js
this can be done as:.