我正在尝试编译librtmp,因此我可以构建FFmpeg,支持ARM处理器的RTMP。
我已经拥有了工具链,并且FFmpeg的单独构建也很成功,并且从ARM处理器内部进行测试也是成功的。
我的理解:
- Ffmpeg
-- Librtmp
--- Openssl
--- zlib
构建FFmepg需要此层次结构。
到目前为止,我已经为ARM构建了openssl,为ARM构建了zlib,我可以看到它位于右侧的ARM输出文件夹中。
先决条件:
export LD_LIBRARY_PATH=/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/lib/
export CCPREFIX="/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/arm-unknown-linux-uclibcgnueabi-"
export CFLAGS="-I/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/include"
export LDFLAGS="-L/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/lib/"
1-构建zlib的步骤:
export CC=arm-linux-gcc
./configure --prefix=/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr
make
make install
构建openssl的步骤:
export cross=arm-linux-
./Configure dist --prefix=/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr
make CC="${cross}gcc" AR="${cross}ar r" RANLIB="${cross}ranlib"
make install
构建librtmp的3-步骤:
make CROSS_COMPILE=arm-linux- INC=-I/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/include LIB=-L/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/lib
以上1,2步是成功的,第3步,我明白了:
make CROSS_COMPILE=arm-linux- INC=-I/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/include LIB=-L/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/lib
make[1]: Entering directory '/home/user/Downloads/ip_code/rtmpdump/librtmp'
arm-linux-gcc -shared -Wl,-soname,librtmp.so.1 -o librtmp.so.1 rtmp.o log.o amf.o hashswf.o parseurl.o -lssl -lcrypto -lz
/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.0/../../../../arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -lssl
/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.0/../../../../arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -lcrypto
/opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/bin/../lib/gcc/arm-unknown-linux-uclibcgnueabi/4.4.0/../../../../arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
Makefile:92: recipe for target 'librtmp.so.1' failed
make[1]: *** [librtmp.so.1] Error 1
make[1]: Leaving directory '/home/user/Downloads/ip_code/rtmpdump/librtmp'
Makefile:76: recipe for target 'librtmp/librtmp.a' failed
make: *** [librtmp/librtmp.a] Error 2
但在输出文件夹中我可以看到正确的文件:
[user@localhost rtmpdump]$ cd /opt/toolchain_gnueabi-4.4.0_ARMv5TE/usr/lib
[user@localhost lib]$ ls
bin libavcodec.a libgmp.so.10.0.2 libz.so
certs libavdevice.a libiberty.a libz.so.1
engines libavfilter.a libmpfr.la libz.so.1.2.11
gcc libavformat.a libmpfr.so man
include libavutil.a libmpfr.so.4 misc
ldscripts libcrypto.a libmpfr.so.4.0.1 openssl.cnf
lib libfakeroot-0.so libpostproc.a pkgconfig
libaacplus.a libfakeroot.la libssl.a private
libaacplus.la libfakeroot.so libswresample.a share
libaacplus.so libgmp.la libswscale.a
libaacplus.so.2 libgmp.so libx264.a
libaacplus.so.2.0.2 libgmp.so.10 libz.a
[user@localhost lib]$
知道如何编译吗?
由于
答案 0 :(得分:0)
仅供参考:rtmpdump显然是其他操作系统的要求......我昨天编译了没有rtmpdump / librtmp的FFmpeg,在./configure时的'启用协议'中,我可以看到RTMP / RTMPS等还有...
非常惊讶,我在目标ARM设备上运行已编译的FFmpeg,它运行没有任何问题:我猜ffmpeg(对于ARM)内部已经有支持,而我正在与rtmpdump搏斗。
Enabled protocols:
async httpproxy rtmpte
cache https rtmpts
concat icecast rtp
crypto md5 srtp
data mmsh subfile
ffrtmpcrypt mmst tcp
ffrtmphttp pipe tee
file prompeg tls_openssl
ftp rtmp udp
gopher rtmpe udplite
hls rtmps unix
http rtmpt
问题解决了!