[FFmpeg-user] How to build ffmpeg statically with librtmp support

Han Jiang oglops at gmail.com
Mon Aug 18 09:21:12 CEST 2014


i found a working solution .  but don't understand why it is like this, can
someone explain it?

first i compiled openssl

cd build/openssl*
./config --prefix=/usr/tmp/tmp/ffmpeg-static/target no-shared
make
make install

then librtmp

cd build/rtmp*

# patch rtmpdump makefile to include -ldl
sed -i.bak -e '/^LIB_OPENSSL\=/s/lcrypto/lcrypto \-ldl/' Makefile

make SYS=posix -j $jval SHARED=
INC=-I/usr/tmp/tmp/ffmpeg-static/target/include
LDFLAGS=-L/usr/tmp/tmp/ffmpeg-static/target/lib
make install prefix=/usr/tmp/tmp/ffmpeg-static/target SHARED=

at last

./configure --enable-librtmp  --prefix=/usr/tmp/tmp/ffmpeg-
static/target --extra-cflags="-I/usr/tmp/tmp/ffmpeg-static/target/include
-static" --extra-ldflags="-L/usr/tmp/tmp/ffmpeg-static/target/lib -lm
-static" --extra-version=static --disable-debug --disable-shared
--enable-static --extra-cflags=--static --extra-libs="-ldl"

this way it works. but i'm confused by the "build openssl" part, actually i
have openssl installed in my system, but without doing this, it doesn't
work , it either says can not find -lssl or -ldl or something,  do i have
to compile openssl like this in order to have librtmp built ?


On Mon, Aug 18, 2014 at 11:30 AM, Han Jiang <oglops at gmail.com> wrote:

> if i remove the -static from the configure command line , by using
> ./configure --enable-librtmp  --prefix=/usr/tmp/tmp/ffmpeg-
> static/target --extra-cflags="-I/usr/tmp/tmp/ffmpeg-static/target/include"
> --extra-ldflags="-L/usr/tmp/tmp/ffmpeg-static/target/lib -lm"
> --extra-version=static --disable-debug --disable-shared --enable-static
> --extra-cflags=--static
>
> i can compile without error, but when i check the dependencies using ldd
>
> i saw the following ( it's not static ) :
>
> bash-4.1$ ldd target/bin/ffmpeg
>         linux-vdso.so.1 =>  (0x00007fffa8923000)
>         libm.so.6 => /lib64/libm.so.6 (0x000000334e400000)
>         libxvidcore.so.4 => /usr/lib64/libxvidcore.so.4
> (0x0000003362800000)
>         libssl.so.10 => /usr/lib64/libssl.so.10 (0x0000003358000000)
>         libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x0000003355c00000)
>         libz.so.1 => /lib64/libz.so.1 (0x000000334f000000)
>         librt.so.1 => /lib64/librt.so.1 (0x000000334f400000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x000000334ec00000)
>         libc.so.6 => /lib64/libc.so.6 (0x000000334e000000)
>         libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2
> (0x0000003357c00000)
>         libkrb5.so.3 => /lib64/libkrb5.so.3 (0x0000003356c00000)
>         libcom_err.so.2 => /lib64/libcom_err.so.2 (0x0000003355800000)
>         libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x0000003357400000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x000000334e800000)
>         /lib64/ld-linux-x86-64.so.2 (0x000000334dc00000)
>         libkrb5support.so.0 => /lib64/libkrb5support.so.0
> (0x0000003356800000)
>         libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x0000003357000000)
>         libresolv.so.2 => /lib64/libresolv.so.2 (0x000000334fc00000)
>         libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003350000000)
>
> how can i compile it statically but at the same time with librtmp support ?
> i need rtmps but the built in rtmp support doesnt support it ( i didn't
> see it in ffmpeg -protocols if i compile ffmpeg without --enable-librtmp )
>
>
>
>
>
> On Mon, Aug 18, 2014 at 10:26 AM, Han Jiang <oglops at gmail.com> wrote:
>
>> first i compiled rtmpdump as follows
>>
>> git clone git://git.ffmpeg.org/rtmpdump
>> cd rtmpdump
>> make SYS=posix SHARED=
>> make install prefix=/usr/tmp/tmp/ffmpeg-static/target  SHARED=
>>
>> i checked in the target dir , the .a and .pc files are there.
>>
>> then in ffmpeg folder i run configure as
>>
>> ./configure --enable-librtmp  --prefix=/usr/tmp/tmp/ffmpeg-static/target
>> --extra-cflags="-I/usr/tmp/tmp/ffmpeg-static/target/include -static"
>> --extra-ldflags="-L/usr/tmp/tmp/ffmpeg-static/target/lib -lm -static"
>> --extra-version=static --disable-debug --disable-shared --enable-static
>> --extra-cflags=--static
>>
>>
>>
>> last few lines in config.log are
>>
>> gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
>> -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
>> -I/usr/tmp/tmp/ffmpeg-static/target/include
>> -L/usr/tmp/tmp/ffmpeg-static/target/lib
>> -I/usr/tmp/tmp/ffmpeg-static/target/include -static --static -std=c99
>> -fomit-frame-pointer -pthread -I/usr/tmp/tmp/ffmpeg-static/target/include
>> -Wl,-z,relro -L/usr/tmp/tmp/ffmpeg-static/target/lib -c -o
>> /var/tmp/ffconf.x1d7jHtY.o /var/tmp/ffconf.QmzlWFCG.c
>> gcc -L/usr/tmp/tmp/ffmpeg-static/target/lib
>> -L/usr/tmp/tmp/ffmpeg-static/target/lib -lm -static -Wl,--as-needed
>> -I/usr/tmp/tmp/ffmpeg-static/target/include -Wl,-z,relro
>> -L/usr/tmp/tmp/ffmpeg-static/target/lib -o /var/tmp/ffconf.9ub8uUUT
>> /var/tmp/ffconf.x1d7jHtY.o -lrtmp -lssl -lcrypto -ldl -lz -lm -lbz2 -lz
>> -pthread -lrt
>> /usr/bin/ld: cannot find -lssl
>> collect2: ld returned 1 exit status
>> ERROR: librtmp not found
>>
>>
>> On Mon, Aug 18, 2014 at 7:32 AM, Carl Eugen Hoyos <cehoyos at ag.or.at>
>> wrote:
>>
>>> Han Jiang <oglops <at> gmail.com> writes:
>>>
>>> > https://github.com/oglops/ffmpeg-static
>>>
>>> Unfortunately, build scripts are not supported here.
>>>
>>> Please post your actual configure line (no variables,
>>> minimal configure line that allows to reproduce the
>>> issue preferred) and a repeated call to make including
>>> its output.
>>>
>>> If you miss a feature in our configure script, please
>>> tell us.
>>>
>>> Carl Eugen
>>>
>>> _______________________________________________
>>> ffmpeg-user mailing list
>>> ffmpeg-user at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>
>>
>>
>


More information about the ffmpeg-user mailing list