Building Ffmpeg iOS Libraries for Armv7, Armv7S, Arm64, I386 and Universal

Building ffmpeg iOS libraries for armv7, armv7s, arm64, i386 and universal

I have use below scripts for making FFmpeg build for arm64

https://github.com/kewlbear/FFmpeg-iOS-build-script

https://github.com/bbcallen/ijkplayer/blob/fc70895c64cbbd20f32f1d81d2d48609ed13f597/ios/tools/do-compile-ffmpeg.sh#L7

You have to add libbz2.dylib and libiconv.dylib framework in your xCode project.

Installing ffmpeg ios libraries armv7, armv7s, i386 and universal on Mac with 10.8

After a couple of days I have made step by step instructions for this install:

FFmpeg Build Instructions MAC 10.8 or better

Copy ffmpeg-2.0.tar.bz2 (https://ffmpeg.org/releases/ffmpeg-1.0.7.tar.bz2, https://ffmpeg.org/download.html) and Unzip to Documents folder

Make sure you have the latest Command Line Tools under Xcode >; Preferences >; Downloads >; Components

Install gas-preprocessor

  1. Click on the ZIP icon to download https://github.com/mansr/gas-preprocessor.
  2. Copy gas-preprocessor.pl to /usr/bin directory.
  3. Change permission of gas-preprocessor.pl by setting the privilege to Read & Write for all.

Bug in xcrun starting in version 10.8

open terminal and paste in following command and press enter:

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer/"

cd to ffmpeg-2 folder and paste in following command and press enter:

mkdir armv7
mkdir armv7s
mkdir i386
mkdir -p universal/lib

To config armv7s library paste in following command and press enter:

./configure --prefix=armv7s --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" --extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=6.1" --extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -miphoneos-version-min=6.1" --arch=arm --cpu=cortex-a9 --enable-pic

(Note same rule as above: if config fails go to
Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/
and make sure that the sdk folder is iPhoneOS6.1.sdk, if not change
the config command to reflect iPhoneOSx.x.sdk and change all targets
to x.x)

To build and install armv7s library paste in following command and press enter:

make clean && make && make install

To config i386 (so simulator will work ) library paste in following command and press enter:

./configure --prefix=i386 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-avresample --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" --extra-cflags="-arch i386" --extra-ldflags="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" --arch=i386 --cpu=i386 --enable-pic --disable-asm

(Note: this is not the same command as the previous two config
commands, if you just arrow up to them this will fail)

To build and install i386 library paste in following command and press enter:

make clean && make && make install

To make universal library ( which is the library added to xcode ) paste in following command and press enter:

cd armv7/lib
for file in *.a
do
cd ../..
xcrun -sdk iphoneos lipo -output universal/lib/$file -create -arch armv7 armv7/lib/$file -arch armv7s armv7s/lib/$file -arch i386 i386/lib/$file
echo "Universal $file created."
cd -
done
cd ../..

VALID_ARCHS = arm64 armv7 armv7s not generating any armv7s

XCode has dropped support for armv7s since XCode 6 I think, the ${ARCHS_STANDARD} now only include armv7, arm64 and simulator will include i386, x86_64, so your fat static library/framework will only include them.

To support armv7s, add it under ${ARCHS_STANDARD} in Architectures field and build again.

Cannot compile for armv7s here valid architectures are armv6, armv7 and i386

The last product I know of with armv6 is iPhone 3G, even iPhone 3GS is with armv7.
Apple has removed the support for armv6 in a way you cannot compile to that processor architecture and even if you would successfully compile you would have a problem submitting the app to Apple (the build won't be accepted automatically). Moreover, You cannot compile to an OS below 4.3 (it would give you errors also) so there are some restrictions - I'm saying that because I think old devices also can't support new OS. So, it is just a matter of days that there won't be any old iPhone with an OS you can support with Apple's platform.

So, my recommendation is to change the build and valid architectures to armv7, armv7s & i386 (if you need it).

This shall work and you really don't have a choice. you should know that most users doesn't own those old devices. If you still want to support those maybe you should consider add a new app specific for "new" devices, but know that you couldn't update the old version because of what explained earlier.



Related Topics



Leave a reply



Submit