我正在尝试在 iOS5.1 (armv7) 上构建 ffmpeg,当我尝试像这样运行 ./configure 时:
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver
--enable-cross-compile --arch=arm --target-os=darwin
--cc=/applications/xcode.app/contents/Developer/usr/bin/gcc
--as='gas-preprocessor/gas-preprocessor.pl /applications/xcode.app/contents/Developer/usr/bin/gcc'
--sysroot=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
--cpu=cortex-a8 --extra-cflags='-arch armv7'
--extra-ldflags='-arch armv7 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk'
--enable-pic
我收到以下错误:
/applications/xcode.app/contents/Developer/usr/bin/gcc
is unable to create an executable file.
C compiler test failed.
If you think configure made a mistake, make sure you are using the latest version from SVN. If the latest version fails, report the problem to the ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "config.err" produced by configure as this will help solving the problem.
有人可以提供 iOS5.1 中的正确参数吗?
提前致谢
最佳答案
说明已经更改,因为 xcode SDK 中不再有 gcc
。
你需要做的是指定 cc 是使用 xcrun 的 iphoneos 编译器,所以我们之前只是把路径放在 gcc
的地方,我们现在要放一个对 的引用xcrun
用于 clang
。
我从 git 下载了最新的 ffmpeg,确保路径上有 gas-preprocess.pl 的副本,然后将 --cc=
行更改为:
--cc='xcrun -sdk iphoneos clang -mios-version-min=5.1'
(这假设您正在构建并且仍然以 ios 5.1 为目标 - 如果您以更新的版本为目标,那么您将值更改为更新的版本。我为我指定了 7.0,但我也在使用 iOS 8.4 SDK,所以配置行看起来像:
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver \
--enable-cross-compile --arch=arm --target-os=darwin \
--cc='xcrun -sdk iphoneos clang -mios-version-min=7.0' \
--sysroot=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk \
--cpu=cortex-a8 --extra-cflags='-arch armv7' \
--extra-ldflags='-arch armv7 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk' \
--enable-pic
从 ios8.4 SDK 构建 ffmpeg。这些说明应该继续工作;您只需为较新的 SDK 替换适当的 7.0
/8.4
值。
旧答案
这就是当您尝试使用 MacOS 版本的编译器编译 iOS 代码时发生的情况。
您需要指定 gcc 的 iPhoneOS 版本:
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver
--enable-cross-compile --arch=arm --target-os=darwin
--cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
--as='gas-preprocessor/gas-preprocessor.pl /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc'
--sysroot=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
--cpu=cortex-a8 --extra-cflags='-arch armv7'
--extra-ldflags='-arch armv7
-isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk'
--enable-pic
尝试使用 configure
调试问题时,第一步是查看作为运行一部分生成的 config.log
文件。
关于iphone - ffmpeg 不会在 iOS5.1 中进行 ./configure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9982528/