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

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Jul 4 20:15:17 EEST 2018

2018-07-04 12:52 GMT+02:00, qw <applemax82 at 163.com>:

> I have download ffmpeg 4.0,

Just in case you forgot: On this mailing list, only current
FFmpeg git head is supported.

> and want to build it into one static program,

May I ask why?
(One of the options you use make it difficult to guess.)

> i.e. ffmpeg, without any dependent dynamic library.

As said, the easiest way is to use musl (and as said,
only x86_64 is supported, developers do not want to
document that x86_32 is incompatible).

> I can find this kind of static ffmpeg from
> 'https://johnvansickle.com/ffmpeg/'. But I fail to build
> static ffmpeg myself.
> My steps are shown as follows:
> ./configure --disable-ffplay --disable-indev=sndio --disable-outdev=sndio \
> --enable-version3 --enable-asm --enable-x86asm --enable-avfilter \
> --enable-static --disable-shared --enable-gpl --enable-nonfree
> --prefix=/usr/local/ \
> --enable-stripping

The following options have no effect, remove them:
--enable-asm --enable-x86asm --enable-avfilter
--enable-static --disable-shared --prefix=/usr/local/

--enable-version3 has no effect in above configure line.
(Is is needed for amr encoding, libsmb, libvmaf - which
doesn't work afair - and a few unusual things.)

--enable-nonfree has an effect but I suspect you don't
want it, please remove it.

In addition to what Moritz suggested, I believe you want
something like --extra-cflags=-static to convince your
linker to use the static libraries once you installed them.

Carl Eugen

More information about the ffmpeg-user mailing list