[FFmpeg-devel] [HOWTO] Building FFmpeg for iPhone

David Conrad lessen42
Sat Oct 3 00:32:51 CEST 2009


On Oct 2, 2009, at 6:19 PM, M?ns Rullg?rd wrote:

> David Conrad <lessen42 at gmail.com> writes:
>
>> On Oct 2, 2009, at 4:58 PM, M?ns Rullg?rd wrote:
>>
>>> 4a. For iPhone 3GS or iPod Touch 3G 32GB/64GB, use this command:
>>>   ./configure
>>> --cc=/Developer/Platforms/iPhoneOS.platform/Developer/
>>> usr/bin/arm-apple-darwin9-gcc-4.2.1 --as='gas-preprocessor.pl /
>>> Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-
>>> darwin9-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/
>>> Developer/SDKs/iPhoneOS3.1.sdk --enable-cross-compile --target-
>>> os=darwin --arch=arm --cpu=cortex-a8 --enable-pic
>>> 4b. For other iPhone or iPod Touch models, use this command:
>>>   ./configure
>>> --cc=/Developer/Platforms/iPhoneOS.platform/Developer/
>>> usr/bin/arm-apple-darwin9-gcc-4.2.1 --as='gas-preprocessor.pl /
>>> Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-
>>> darwin9-gcc-4.2.1' --sysroot=/Developer/Platforms/iPhoneOS.platform/
>>> Developer/SDKs/iPhoneOS3.1.sdk --enable-cross-compile --target-
>>> os=darwin --arch=arm --cpu=arm1176jzf-s
>>> 5.  Run make.
>>>
>>> It is important to specify a correct --cpu option, and not merely an
>>> architecture version.  Failure to specify the exact CPU will give a
>>> broken build.
>>
>> You should add -arch armv7 to cflags and ldflags for 4a and -arch
>> armv6 for 4b (the warning about -force_cpusubtype_ALL indicates that
>> this will be required in the future.) This sets a specific cpu  
>> subtype
>> for the mach-o file, which allows you lipo together binaries.
>
> I tried that, and got this error:
>
> cc1: error: unrecognized command line option "-arch"
>
> The warning is harmless, and only shows that Apple's compiler team are
> a bunch of idiots, but we knew that already.

Oops, -arch is only recognized by "gcc" not "arm-apple-darwin9- 
gcc-4.2.1". So you'd need --cc=/Developer/Platforms/iPhoneOS.platform/ 
Developer/usr/bin/gcc

The advantage of specifying it is that you can have a single binary  
that has full NEON opts, but still works on the older devices.



More information about the ffmpeg-devel mailing list