iphone - ffmpeg 不会在 iOS5.1 中进行 ./configure

标签 iphone c ios ffmpeg

我正在尝试在 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/

相关文章:

iphone - 如何更改 iOS 上后退按钮的位置?

ios - 如何使用FBSDKLoginManager进行FB登录?

iphone - 如何连接到需要用户名和密码的网站

iphone - 在多个 Web 服务之间保留登录数据的最佳方法是什么?

ios - 是否可以在 iOS 上设置 Crashlytics 而无需在每个开发人员的工作站上安装该应用程序?

ios - 如何通过 GKSession 蓝牙发送整数数组

iphone - 从相机中剪下预定义的照片

在 C 中从 R 包调用 C 代码

c++ - 一次将代码添加到 iOS/objective-C 项目和 c++ 库?

c - 打印浮点值时的奇怪行为