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

Han Jiang oglops at gmail.com
Sun Aug 17 08:27:27 CEST 2014


my lasted attemp in the build script is

# comment out the "require_pkg_config librtmp ..." line
# this line assumes you have installed librtmp to your /usr/lib64
# but here i want a "static" build
sed -i.bak '/enabled librtmp/s/^/# /' configure
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure
--prefix=${OUTPUT_DIR:-$TARGET_DIR} --extra-cflags="-I$TARGET_DIR/include
-static" --extra-ldflags="-L$TARGET_DIR/lib -lm -static"
--extra-version=static --disable-debug --disable-shared --enable-static
--extra-cflags=--static --pkg-config-flags="-static" --disable-ffplay
--disable-ffserver --disable-doc --enable-gpl --enable-pthreads
--enable-postproc --enable-gray --enable-runtime-cpudetect --enable-libfaac
--enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
--enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib
--enable-nonfree --enable-version3 --enable-libvpx --disable-devices
--enable-librtmp

and the error is

make: *** [ffprobe_g] Error 1
make: *** Waiting for unfinished jobs....
libavformat/libavformat.a(rtpproto.o): In function `rtp_parse_addr_list':
rtpproto.c:(.text+0x456): 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.2/../../../../lib64/libpthread.a(libpthread.o):
In function `sem_open':
(.text+0x685b): warning: the use of `mktemp' is dangerous, better use
`mkstemp'
libavformat/libavformat.a(librtmp.o): In function `rtmp_read_seek':
librtmp.c:(.text+0x30): undefined reference to `RTMP_SendSeek'
libavformat/libavformat.a(librtmp.o): In function `rtmp_read_pause':
librtmp.c:(.text+0x8d): undefined reference to `RTMP_Pause'
libavformat/libavformat.a(librtmp.o): In function `rtmp_close':
librtmp.c:(.text+0xaa): undefined reference to `RTMP_Close'
libavformat/libavformat.a(librtmp.o): In function `rtmp_open':
librtmp.c:(.text+0x124): undefined reference to `RTMP_LogSetLevel'
librtmp.c:(.text+0x12e): undefined reference to `RTMP_LogSetCallback'
librtmp.c:(.text+0x4da): undefined reference to `RTMP_Init'
librtmp.c:(.text+0x4e5): undefined reference to `RTMP_SetupURL'
librtmp.c:(.text+0x506): undefined reference to `RTMP_Connect'
librtmp.c:(.text+0x518): undefined reference to `RTMP_ConnectStream'
librtmp.c:(.text+0x588): undefined reference to `RTMP_EnableWrite'
librtmp.c:(.text+0x5b8): undefined reference to `RTMP_Close'
libavformat/libavformat.a(librtmp.o): In function `rtmp_get_file_handle':
librtmp.c:(.text+0x9): undefined reference to `RTMP_Socket'
libavformat/libavformat.a(librtmp.o): In function `rtmp_write':
librtmp.c:(.text+0xc9): undefined reference to `RTMP_Write'
libavformat/libavformat.a(librtmp.o): In function `rtmp_read':
librtmp.c:(.text+0xd9): undefined reference to `RTMP_Read'
collect2: error: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1



On Sun, Aug 17, 2014 at 1:31 PM, Han Jiang <oglops at gmail.com> wrote:

> Hi all , i was using this build script to build ffmpeg statically on
> centos 7.
> i forked this repo from stvs's build script. the only difference is i
> added --enable-librtmp,
>
> https://github.com/oglops/ffmpeg-static
>
> but i have got this error :  "ERROR: librtmp not found".
> according to this SO link
> http://stackoverflow.com/questions/9634496/building-ffmpeg-with-librtmp-for-android
> i commented out the following line
> enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h
> RTMP_Socket
>
> but i get a new error when running ./configure.
>
>
> libavformat/libavformat.a(librtmp.o): In function `rtmp_read_seek':
> librtmp.c:(.text+0x30): undefined reference to `RTMP_SendSeek'
> libavformat/libavformat.a(librtmp.o): In function `rtmp_read_pause':
> librtmp.c:(.text+0x8d): undefined reference to `RTMP_Pause'
> libavformat/libavformat.a(librtmp.o): In function `rtmp_close':
> librtmp.c:(.text+0xaa): undefined reference to `RTMP_Close'
> libavformat/libavformat.a(librtmp.o): In function `rtmp_open':
> librtmp.c:(.text+0x124): undefined reference to `RTMP_LogSetLevel'
> librtmp.c:(.text+0x12e): undefined reference to `RTMP_LogSetCallback'
> librtmp.c:(.text+0x4da): undefined reference to `RTMP_Init'
> librtmp.c:(.text+0x4e5): undefined reference to `RTMP_SetupURL'
> librtmp.c:(.text+0x506): undefined reference to `RTMP_Connect'
> librtmp.c:(.text+0x518): undefined reference to `RTMP_ConnectStream'
> librtmp.c:(.text+0x588): undefined reference to `RTMP_EnableWrite'
> librtmp.c:(.text+0x5b8): undefined reference to `RTMP_Close'
> libavformat/libavformat.a(librtmp.o): In function `rtmp_get_file_handle':
> librtmp.c:(.text+0x9): undefined reference to `RTMP_Socket'
> libavformat/libavformat.a(librtmp.o): In function `rtmp_write':
> librtmp.c:(.text+0xc9): undefined reference to `RTMP_Write'
> libavformat/libavformat.a(librtmp.o): In function `rtmp_read':
> librtmp.c:(.text+0xd9): undefined reference to `RTMP_Read'
> collect2: error: ld returned 1 exit status
> make: *** [ffprobe_g] Error 1
>
>
> it seems it can't find the include folder, but actually the build script
> has set that env var already. pkg_config_path is also set.
>
> ps: actually if i copy compiled librtmp files to /usr/lib64 it works , but
> since i want to build a "static" build on a system i have no root access
> to(in office), i can't do that.
>
> full config.log here :  http://pastebin.com/pJgYHw3C
>
> i saw it says it can't find lssl or lcrypto. but openssl is installed in
> my system already.
>
> [oglop at localhost ffmpeg-static-git]$ ldconfig -p | grep libssl
>         libssl3.so (libc6,x86-64) => /lib64/libssl3.so
>         libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10
>         libssl.so (libc6,x86-64) => /lib64/libssl.so
> [oglop at localhost ffmpeg-static-git]$ ldconfig -p | grep libcrypto
>         libcrypto.so.10 (libc6,x86-64) => /lib64/libcrypto.so.10
>         libcrypto.so (libc6,x86-64) => /lib64/libcrypto.so
>
> i tried various suggestion from here too
>
> http://stackoverflow.com/questions/20721445/undefined-reference-when-compiling-ffmpeg-with-librtmp-on-android
>
> by adding
>
> --enable-librtmp   --extra-cflags=-I/$TARGET_DIR/include
> --extra-ldflags=-L$TARGET_DIR/lib"
>
> but i got the same error as he did:
> ...
> undefined reference to 'RTMP_Read'
> ...
>
>
>
>


More information about the ffmpeg-user mailing list