0

在为 OSX 编译 ffmpeg 时,我可以简单地使用:

./configure --enable-librtmp --enable-gpl

命令并获得可以使用 rtmp 流进行 I/O 的构建。

如果我尝试使用以下方法为 iOS 编译:

./configure \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-mmx \
--enable-gpl \
--enable-shared \
--enable-librtmp \
--enable-avresample \
--enable-cross-compile \
--enable-pic \
--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs /iPhoneOS6.1.sdk" \
--target-os=darwin \
--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2" \
--extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=6.1" \
--extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.1" \
--arch=arm \
--cpu=cortex-a9 \
--prefix=compiled/armv7s 

它错误地说ERROR: librtmp cannot be found。具体来说:

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.1 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -Wl,-dynamic,-search_paths_first -I/usr/local/include -L/usr/local/lib -o /var/folders/4m/8hcrycqx777_ksz6d32nrn_m0000gp/T//ffconf.b2zp97z8 /var/folders/4m/8hcrycqx777_ksz6d32nrn_m0000gp/T//ffconf.VhdlpSe1.o -lrtmp -lz -lssl -lcrypto -lm -lbz2 -lz
ld: warning: ld: warning: ignoring file /usr/local/lib/librtmp.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (armv7s): /usr/local/lib/librtmp.dylibignoring file /usr/local/lib/libz.a, file was built for archive which is not the architecture being linked (armv7s): /usr/local/lib/libz.a

Undefined symbols for architecture armv7s:
  "_RTMP_Socket", referenced from:
      _check_RTMP_Socket in ffconf.VhdlpSe1.o
     (maybe you meant: _check_RTMP_Socket)
ld: symbol(s) not found for architecture armv7s
collect2: ld returned 1 exit status
ERROR: librtmp not found

我已经openssl使用ios-openssl在 github 上找到并librtmp通过rtmpdump

4

1 回答 1

2

我最终编译librtmpopenssl使用ios-librtmpand ios-openssl,安装rtmpdumpopenssl使用brew, export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig,然后更改/usr/local/lib/pkgconfigfor libcrypto.pclibssl.pcopenssl.pc和中的文件,librtmp.pc以指向 iOS i386、armv7 和 armv7s 编译库。

于 2013-04-22T15:19:25.900 回答