简体   繁体   English

在iOS5.1中,ffmpeg不会./configure

[英]ffmpeg won't ./configure in iOS5.1

I am trying to build ffmpeg on iOS5.1 (armv7), when I try to run ./configure like this: 我试图在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

I get the following error: 我收到以下错误:

/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. 如果您认为configure出错,请确保您使用的是SVN的最新版本。 If the latest version fails, report the problem to the ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. 如果最新版本失败,请将问题报告给irc.freenode.net上的ffmpeg-user@mplayerhq.hu邮件列表或IRC #ffmpeg。 Include the log file "config.err" produced by configure as this will help solving the problem. 包括configure生成的日志文件“config.err”,因为这有助于解决问题。

Could somebody please provide the correct parameters in iOS5.1? 有人可以在iOS5.1中提供正确的参数吗?

Thanks in advance 提前致谢

the instructions have changed since there is no longer a gcc in the xcode SDK. 由于xcode SDK中不再有gcc ,因此说明已更改。

What you need to do is specify that cc is the iphoneos compiler using xcrun, so where we previously just put the path to gcc , we're now going to put a reference to xcrun for clang . 你需要做的是指定cc是使用xcrun的iphoneos编译器,所以我们之前只是将路径放到gcc ,我们现在要为xcrun提供一个对clang的引用。

I downloaded the latest ffmpeg from git, made sure I had a copy of gas-preprocess.pl on the path, and then changed the --cc= line to read: 我从git下载了最新的ffmpeg,确保路径上有gas-preprocess.pl的副本,然后将--cc=行更改为:

--cc='xcrun -sdk iphoneos clang -mios-version-min=5.1'

(this assumes you're building and still targetting ios 5.1 - if you're targetting newer, then you change the value to the newer release. I specified 7.0 for mine, but I'm also using the iOS 8.4 SDK, so the configure line looks like: (这假设您正在构建并仍然针对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

which builds ffmpeg from the ios8.4 SDK. 从ios8.4 SDK构建ffmpeg。 These instructions should keep working; 这些说明应该继续有效; you just need to replace the appropriate 7.0 / 8.4 values for the newer SDKs. 您只需要为较新的SDK替换适当的7.0 / 8.4值。

OLD ANSWER 老答复

That's what happens when you try to compile iOS code using the MacOS version of the compiler. 当您尝试使用MacOS版本的编译器编译iOS代码时会发生这种情况。

You need to specify the iPhoneOS version of gcc using: 您需要使用以下命令指定iPhone的iPhone版本:

./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

The first step when trying to debug problems with configure is to look at the config.log file which is generated as part of the run. 尝试使用configure调试问题时,第一步是查看作为运行的一部分生成的config.log文件。

There is a few things wrong with your configure script, that I can tell. 我可以告诉你的配置脚本有一些问题。 First of all, you are using: 首先,您正在使用:

--cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 

This is wrong. 这是错的。 You should be using the architecture specific gcc compilers, so in your case (armv7) you should be using, for example: 您应该使用特定于体系结构的gcc编译器,因此在您的情况下(armv7)您应该使用,例如:

--cc=/applications/xcode.app/contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1

Notice you're calling upon the arm-apple-darwin10-gcc-4.2.1 version of apple's own gcc. 请注意,你正在使用arm-apple-darwin10-gcc-4.2.1版本的apple自己的gcc。 Since this is only an example, look in your ../Developer/../bin/ and use the latest arm-apple-darwin10-gcc-xxx that you have. 由于这仅是一个示例,请查看您的../Developer/../bin/并使用您../Developer/../bin/的最新arm-apple-darwin10-gcc-xxx I see that there are a lot of answers on SO that suggest you do it the way you have done it, this is just flat out wrong! 我看到有很多答案在SO上表明你按照你的方式做到这一点,这是完全错误的! and doesn't work for arm, it'll work for i386 (simulator) only. 并且不适用于手臂,它仅适用于i386(模拟器)。

You will need to update the assembler directive to reflect using the same gcc version: 您需要更新汇编程序指令以反映使用相同的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'

Additionally, don't put an -arch armv7 in your --extra-cflags , you may get an error: unrecognized command line option "-arch" 另外,不要在--extra-cflags放置-arch armv7 --extra-cflags ,您可能会收到error: unrecognized command line option "-arch"

Lastly and depending on your situation, might I suggest the following, in addition to what you already have: 最后,根据您的情况,除了您已经拥有的内容之外,我可以建议以下内容:

--disable-bzlib --disable-gpl --disable-shared --enable-static --disable-mmx --disable-debug --disable-neon

and change to this: 并改为:

--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'

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM