磕磕碰碰,Xcode6.1编译x264库

来源:互联网 发布:信息泄露 知乎 编辑:程序博客网 时间:2024/05/29 08:18

此篇文章的环境:xcode6.1 sdk8.1
编译的版本:真机armv7 arm64 


这两天在编译x264的库,按照网上的方法

一,x264库的编译
首先到http://www.videolan.org/developers/x264.html下载x264的库,然后解压。

打开shell,进入x264的目录,执行如下语句

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

make,make install;

发现,出现No working C compiler found.错误,原因是 没有在/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc 下面找到gcc,因为上面的语句是 在xcode4.2编译的,现在xcode6.1了,那个路径下没有gcc了,后来根据查找各种资料,各种尝试,希望遇到同样问题的不要走弯路,最后的命令如下:

armv7

CC=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc ./configure --host=arm-apple-darwin --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system' --enable-pic --disable-asm

运行完了以后再运行make就可以找到libx264.a库

arm64

CC=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc ./configure --host=arm-apple-darwin --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk --extra-cflags='-arch arm64' --extra-ldflags='-arch arm64 -L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system' --enable-pic --disable-asm

运行完了以后再运行make就可以找到libx264.a库
0 0
原创粉丝点击