[FFmpeg-user] how to build ffmpeg into one static program without any dependent dynamic library
qw
applemax82 at 163.com
Mon Jul 16 14:48:22 EEST 2018
Hi,
Static glibc/zlib/libstdc++ are installed as below:
yum install glibc-static zlib-static libstdc++-static
Therefore libm.a/libz.a/libpthread.a/libdl.a are installed
/usr/lib64/libm.a
/usr/lib64/libz.a
/usr/lib64/libpthread.a
/usr/lib64/libdl.a
I use the following command to configure and build ffmpeg 4.0
./configure --disable-ffplay --disable-indev=sndio --disable-outdev=sndio \
--extra-ldflags='-L/usr/lib' \
--extra-libs='-lz -lm -lpthread -lstdc++ -ldl' \
--disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-libxcb-shape \
--enable-gpl --enable-stripping
make
When I use ldd the check ffmpeg's dependent dynamic libraries, libz.so.1/libm.so.6/libpthread.so.0/libdl.so.2 are still ffmpeg's dependent dynamic libraries.
ldd ./ffmpeg
linux-vdso.so.1 => (0x00007fff8cffe000)
libm.so.6 => /lib64/libm.so.6 (0x00007f4b36d72000)
libasound.so.2 => /lib64/libasound.so.2 (0x00007f4b36a73000)
libva.so.2 => /lib64/libva.so.2 (0x00007f4b36851000)
libz.so.1 => /lib64/libz.so.1 (0x00007f4b3663b000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f4b36414000)
libva-drm.so.2 => /lib64/libva-drm.so.2 (0x00007f4b36211000)
libva-x11.so.2 => /lib64/libva-x11.so.2 (0x00007f4b3600b000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f4b35ccc000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4b35ab0000)
libc.so.6 => /lib64/libc.so.6 (0x00007f4b356ed000)
/lib64/ld-linux-x86-64.so.2 (0x000055f02297c000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f4b354e8000)
librt.so.1 => /lib64/librt.so.1 (0x00007f4b352e0000)
libdrm.so.2 => /lib64/libdrm.so.2 (0x00007f4b350d1000)
libXext.so.6 => /lib64/libXext.so.6 (0x00007f4b34ebe000)
libXfixes.so.3 => /lib64/libXfixes.so.3 (0x00007f4b34cb8000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f4b34a90000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f4b3488b000)
How can I make ffmpeg link with specified static libraries, i.e. libm.a/libz.a/libpthread.a/libdl.a? Thanks!
Regards
Andrew
At 2018-07-09 18:01:14, "Reindl Harald" <h.reindl at thelounge.net> wrote:
>
>Am 09.07.2018 um 11:39 schrieb Moritz Barsnick:
>>> Can I specify which static libraries are used and which dynamic libraries are used to build ffmpeg?
>>
>> If both static and dynamic libraries are found, the linkers will by
>> default prefer the dynamic one.
>>
>> Choices can be manipulated, but no build system I know of supports
>> this, because it would make ./configure and the Makefiles too
>> complicated
>
>--extra-ldflags='-I/rpmbuild/BUILD/ffmpeg-20180617/x264-static
>-L/rpmbuild/BUILD/ffmpeg-20180617/x264-static -ldl'
>
>this links my /rpmbuild/BUILD/ffmpeg-20180617/x264-static/x264.a built
>in the first step of 'ffmpeg-latest.spec' and on that machine x264-devel
>from the distribution is present too
>
>see my first repsone to that question with the wholke spec-file
>_______________________________________________
>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