Compiling x264 for iOS 5

2019-04-02 18:19发布

问题:

I'm trying to compile the latest version of libx264 to iOS 5 arm.

In mid-2010, the Gabriel script for building worked.

It doesn't anymore.

It says "No working C compiler found."

Can anyone give me straight answer? It's 2012 and no one in google seems to have compiled it.

回答1:

Update: I've added the needed files to the github repository below. https://github.com/rodisbored/ffmpeg_x264_iOS5_build

I took gabriel's script and modified it. I've been meaning to post the complete script online, but here's the part(s) you need. Pop it into Gabriel's script. This works with XCode 4.2. I haven't updated to 4.3 to test whether the path names are still valid, but I think you can figure out where to update from the below.

For armv6

CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc ./configure --host=arm-apple-darwin --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk --prefix='dist' --extra-cflags='-arch armv6' --extra-ldflags='-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system -arch armv6' --enable-pic --disable-asm --enable-static

For armv7

CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc ./configure --host=arm-apple-darwin --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk --prefix='dist' --extra-cflags='-arch armv7' --extra-ldflags='-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system -arch armv7' --enable-pic --enable-static

To link these to ffmpeg, make sure you put the path of the library and and headers into the --extra-cflags and --extra-ldflags. If you don't, it'll complain about not finding the libx264 library. The below is what you need to turn this all on.

--enable-libx264 \
--enable-encoder=libx264 \
--enable-encoder=libx264rgb \
--enable-gpl


回答2:

Simply you can try these lines:

# you are now outside x264 dir.

export SDKVERSION="6.1"

cd x264

make clean

CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
    ./configure \
        --host=arm-apple-darwin \
        --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk \
        --prefix=build/armv7s \
        --extra-cflags='-arch armv7s' \
        --extra-ldflags="-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDKVERSION}.sdk/usr/lib/system -arch armv7s" \
        --enable-pic --enable-static

# ok now, you get the right Makefile.


回答3:

I've updated the Gabriel/rodisbored build_x264 script so that it works with Xcode 4.6 and iOS SDK 6.1. My version also builds the library such that it can run in the simulator. See https://github.com/kristopherjohnson/kxmovie/blob/master/build_x264

Unfortunately, I gave up on trying to fix the accompanying build_ffmpeg_x264.sh script, and instead updated the Rakefile from https://github.com/kolyvan/kxmovie. So, to see my scripts for building x264 and FFmpeg, look at https://github.com/kristopherjohnson/kxmovie



标签: ffmpeg x264