当我尝试运行时,我试图在iOS5.1 (armv7)上构建ffmpeg。/配置如下:
./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.如果您认为配置出错,请确保您使用的是来自SVN的最新版本。如果最新版本失败,请将问题报告给irc.freenode.net上的ffmpeg-user@mplayerhq.hu邮件列表或IRC #ffmpeg。包含配置生成的日志文件"config.err“,因为这将有助于解决问题。
有人能在iOS5.1中提供正确的参数吗?
预先感谢
发布于 2012-04-02 21:58:57
由于xcode中不再有gcc,说明已经改变了。
您需要做的是指定cc是使用xcrun的iphoneos编译器,所以在前面我们只放置到gcc的路径的地方,我们现在将引用xcrun for clang。
我从git下载了最新的ffmpeg,确保路径上有gas-preprocess.pl的副本,然后将--cc=行更改为:
--cc='xcrun -sdk iphoneos clang -mios-version-min=5.1'(这假设您正在构建并且仍然在运行ios 5.1 -如果您正在更新,则将值更改为更新的版本。我为我指定了7.0,但我也使用了iOS 8.4SDK,因此配置行如下所示:
./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.4SDK构建ffmpeg。这些说明应该继续工作;您只需要为较新的SDK替换适当的7.0/8.4值即可。
旧答案
当您试图使用编译器的iOS版本编译MacOS代码时,就会发生这种情况。
您需要使用以下方法指定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文件。
发布于 2012-04-08 20:12:23
您的配置脚本有一些问题,我可以判断。首先,您正在使用:
--cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 这是错误的。您应该使用特定于体系结构的gcc编译器,因此在您的情况下(armv7)您应该使用,例如:
--cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1请注意,您访问的是苹果自己的gcc的arm-apple-darwin10-gcc-4.2.1版本。由于这只是一个示例,请查看您的../Developer/../bin/并使用您所拥有的最新arm-apple-darwin10-gcc-x.x.x。我看到有很多的答案,所以,建议你这样做,这是完全错误的!而且对arm不起作用,它只适用于i386 (模拟器)。
您需要更新汇编程序指令以反映使用相同的gcc版本:
--as='gas-preprocessor/gas-preprocessor.pl /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1'另外,不要将-arch armv7放在--extra-cflags中,您可能会得到一个error: unrecognized command line option "-arch"
最后,根据您的情况,除了您已经拥有的内容之外,我还可以建议以下几点:
--disable-bzlib --disable-gpl --disable-shared --enable-static --disable-mmx --disable-debug --disable-neon并改变这一点:
--extra-cflags='-pipe -Os -gdwarf-2 -isysroot /applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -m${thumb_opt:-no-thumb} -mthumb-interwork'希望这能有所帮助。
https://stackoverflow.com/questions/9982528
复制相似问题