[x264-devel] Compiling x264 for iOS (problem report)

Alexey Kuzmin aukuzmin at me.com
Wed Jan 23 08:26:48 CET 2013


Greeting!

I would like to share with some compilation problem while I was prepared libx264.a. Then I was linked libx264 with the ffmpeg compilation and meat some problem.

All Steps:

1. Source downloading of the libx264

> git clone git://git.videolan.org/x264.git

2. Compiling libx264 for iOS (let's say it will be for armv7s)

> CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc ./configure \
--host=arm-apple-darwin \
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk \
--prefix=armv7s \
--extra-cflags="-arch armv7s -mcpu=cortex-a9" \
--extra-ldflags="-arch armv7s -L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system" \
--enable-static \

On that step I have compiled library and includes. Compiles library I was copy to the /usr/local/lib and includes I was copy to the /usr/local/include

3. Source downloading of the ffmpeg

> git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

4. Some preparation for ffmpeg compilation 

- Installing mac ports (if not installed)
- Installing pkgconfig (> sudo port install pkgconfig)
- Downloading gas-preprocessor.pl and copy it to the /usr/local/bin
- Then change permitition for gas-preprocessor.pl (> chown 777 /usr/local/bin/gas-preprocessor.pl)

So for now we are ready to compile and install ffmpeg with libx264

5. Compiling and installing ffmpeg

> ./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.0.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.0 -I/usr/local/include" \
--extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -miphoneos-version-min=6.0  -L/usr/local/lib" \
--arch=arm \
--cpu=cortex-a9 \
--disable-asm \
--enable-libx264 \
--enable-gpl \

> make clean && make && make install

The main thing here is --enable-libx264 option and paths to the libx264 in --extra-cflags and --extra-ldflags

6. Putting all together 

- Create new Xcode project
- Copy libraries from libx264 to the project
- Copy libraries from ffmpeg to the project
- In the project in the AppDelegate.m file in method didFinishLaunchingWithOptions I added one ffmpeg call avcodec_register_all();

After running the project I found one warning from XCode

PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in l070 from /Users/aukuzmin/Projects/x264/h264/lib/libx264.a(pixel-a.o). To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie


I was trying to find out what's going on and I found next thing. When I was configuring libx264 it is compiling with -mdynamic-no-pic flag. I opened configure file and made next:

And after that I compiled libx264 one more time copied lib to the /usr/local/lib and compiled ffmpeg one more time. Then copy compiled libs to the Xcode and run the demo project.
So warning wash't dismiss.

So my question is:

How can I compile libx264 without any warning?

P.S. My system is OS X 10.8.2, Xcode 4.5.2, iOS SDK 6.0

Thank you,
Alexey




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20130123/ca3377ae/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2013-01-23 at 13.24.38.png
Type: image/png
Size: 333501 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20130123/ca3377ae/attachment-0001.png>


More information about the x264-devel mailing list