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

qw applemax82 at 163.com
Mon Jul 9 11:21:40 EEST 2018


Hi,


I use the following command to configure and build static ffmpeg :


./configure --disable-ffplay --disable-indev=sndio --disable-outdev=sndio \
--extra-libs='-static -L/usr/lib' --extra-cflags='--static' \
--enable-gpl --enable-stripping


make reports some warnings :
libavformat/libavformat.a(rtpproto.o): In function `rtp_resolve_host':
/export/qiang/buildDir/jdcloud_vod_ffmpeg/JD_FFmpeg/libavformat/rtpproto.c:140: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x6a23): warning: the use of `mktemp' is dangerous, better use `mkstemp'
libavformat/libavformat.a(rtpproto.o): In function `rtp_resolve_host':
/export/qiang/buildDir/jdcloud_vod_ffmpeg/JD_FFmpeg/libavformat/rtpproto.c:140: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x6a23): warning: the use of `mktemp' is dangerous, better use `mkstemp'


However, ffmpeg is static without any dependent dynamic library.


If I want to use Intel qsv codec, the option of '--enable-libmfx' should be added. Then configure will report error :
/bin/ld: cannot find -lva
/bin/ld: cannot find -lva-drm


The reason why it fails is that, there is no static libva library.


Can I specify which static libraries are used and which dynamic libraries are used to build ffmpeg?


Thanks!


Regards


Andrew


At 2018-07-04 22:20:07, "Moritz Barsnick" <barsnick at gmx.net> wrote:
>On Wed, Jul 04, 2018 at 20:52:29 +0800, qw wrote:
>> Thanks for your help.
>> I use CentOS 7.4 to build static ffmpeg.
>
>Could you please show us:
>$ objdump -p /usr/local/bin/ffmpeg | grep NEEDED
>
>Furthermore, please make sure the following packages are installed:
>glibc-devel
>glibc-static # covers libc, libm, libdl(?), librt, libpthread dependencies
>zlib-static # covers libz dependency
>
>Please add the following ffmpeg configure options:
>  --disable-libxcb # gets rid of libxcb* dependencies
>  --disable-xlib # gets rid of libX* dependencies
>  --disable-lzma # gets rid of liblzma dependency
>  --disable-vaapi # gets rid of libva dependency
>  --disable-alsa # gets rid of libasound dependency
>
>(At the loss of a few features.)
>
>And then build once more.
>
>Again: Can you not just install the required dynamic libs on the
>target?
>
>Moritz
>_______________________________________________
>ffmpeg-user mailing list
>ffmpeg-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>To unsubscribe, visit link above, or email
>ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list