ffmpeg won't ./configure in iOS5.1

后端 未结 2 922
梦毁少年i
梦毁少年i 2021-01-06 04:40

I am trying to build ffmpeg on iOS5.1 (armv7), when I try to run ./configure like this:

./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable         


        
相关标签:
2条回答
  • 2021-01-06 04:56

    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:

    --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. Since this is only an example, look in your ../Developer/../bin/ and use the latest arm-apple-darwin10-gcc-x.x.x that you have. 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! and doesn't work for arm, it'll work for i386 (simulator) only.

    You will need to update the assembler directive to reflect using the same gcc version:

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

    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.

    0 讨论(0)
  • 2021-01-06 05:14

    the instructions have changed since there is no longer a gcc in the xcode SDK.

    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.

    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:

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

    ./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. These instructions should keep working; you just need to replace the appropriate 7.0/8.4 values for the newer SDKs.

    OLD ANSWER

    That's what happens when you try to compile iOS code using the MacOS version of the compiler.

    You need to specify the iPhoneOS version of gcc using:

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

    0 讨论(0)
提交回复
热议问题