[FFmpeg-user] how to build ffmpeg into one static program without any dependent dynamic library

Moritz Barsnick barsnick at gmx.net
Wed Jul 4 14:28:31 EEST 2018


On Wed, Jul 04, 2018 at 13:19:57 +0200, Moritz Barsnick wrote:
> On Wed, Jul 04, 2018 at 18:52:06 +0800, qw wrote:
> > ldd /usr/local/bin/ffmpeg 
> > linux-vdso.so.1 =>  (0x00007ffee27f4000)
> > libm.so.6 => /lib64/libm.so.6 (0x00007f8504516000)
> > libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f85042ed000)
> > libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f85040e9000)
> > libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007f8503ee5000)
> > libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f8503cdc000)
> > libasound.so.2 => /lib64/libasound.so.2 (0x00007f85039de000)
> > libva.so.2 => /lib64/libva.so.2 (0x00007f85037bc000)
> > libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f8503595000)
> > libdl.so.2 => /lib64/libdl.so.2 (0x00007f8503391000)
> > libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f8503089000)
> > librt.so.1 => /lib64/librt.so.1 (0x00007f8502e80000)
> > libva-drm.so.2 => /lib64/libva-drm.so.2 (0x00007f8502c7d000)
> > libz.so.1 => /lib64/libz.so.1 (0x00007f8502a67000)
> > liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f8502840000)
> > libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8502624000)
> > libva-x11.so.2 => /lib64/libva-x11.so.2 (0x00007f850241e000)
> > libX11.so.6 => /lib64/libX11.so.6 (0x00007f85020df000)
> > libnuma.so.1 => /lib64/libnuma.so.1 (0x00007f8501ed3000)
> > libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8501cbd000)
> > libc.so.6 => /lib64/libc.so.6 (0x00007f85018f9000)
> > /lib64/ld-linux-x86-64.so.2 (0x00005629c1296000)
> > libXau.so.6 => /lib64/libXau.so.6 (0x00007f85016f5000)
> > libdrm.so.2 => /lib64/libdrm.so.2 (0x00007f85014e5000)
> > libXext.so.6 => /lib64/libXext.so.6 (0x00007f85012d3000)
> > libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f85010cd000)
> 
> All those dynamic/shared dependant libraries you see above: You need to
> provide static versions of them when linking ffmpeg.

Actually, what comes to mind is that a lot of them are "system"
features picked up by ffmpeg configure. If you don't need the x11grab
indev, which I assume pulls in all those X11 dependencies (incl. libdrm
and libxcb), you could explicitly disable it on the configure command
line. I also notice libva, which you can also explicitly disable. With
the others, one would have to check which ffmpeg pulls in, and for
which features each is needed. (That's not documented well.)

Cheers,
Moritz


More information about the ffmpeg-user mailing list