ios编译libfreetype,并适应armv7,armv7s,arm64
2014-03-12 18:05
627 查看
在github里看到人人网发布的一个CCHtmlLabel的RichText控件,可以显示复杂的html结构的富文本,配置好之后发现在模拟器上面能顺利跑起来,但在真机上却编译失败。
看error log的意思是指没有armv7s的slice,再看了一下CCHtmlLabel所用的libfreetype库,是2011年编译的,有点旧,当时iphone4s才刚出呢,当然没有armv7s了。
于是到SourceForge下载了freetype的源代码,编译成lib后再替换原来的libfreetype.a,再次用Xcode编译整个游戏项目,发现还是有个linker的错误:undefined
reference to `BZ2_bzDecompressInit'。
这个简单,在xcode里添加对libbz2.1.0.dylib的引用即可。
有需要的请到这里下载: http://download.csdn.net/detail/visualcatsharp/7076545
下面再记录一下编译的过程
mkdir /var/tmp/build-armv7
./configure CFLAGS="-arch i386"
make
cp objs/.libs/libfreetype.a libfreetype-i386.a
./configure CFLAGS="-arch x86_64";make clean;make
cp objs/.libs/libfreetype.a libfreetype-x86_64.a
make clean
./configure --prefix=/var/tmp/build-armv7 --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch armv7 -pipe -std=c99 -Wno-extended-offsetof
-Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=4.2 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-miphoneos-version-min=4.2"
make
cp objs/.libs/libfreetype.a libfreetype-arm7.a
make clean
./configure --prefix=/var/tmp/build-armv7 --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch armv7s -pipe -std=c99 -Wno-extended-offsetof
-Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=4.2 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-miphoneos-version-min=4.2"
make
cp objs/.libs/libfreetype.a libfreetype-arm7s.a
make clean
./configure --prefix=/var/tmp/build-armv7 --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch arm64 -pipe -std=c99 -Wno-extended-offsetof
-Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=6.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-miphoneos-version-min=6.0"
make clean; make
cp objs/.libs/libfreetype.a libfreetype-arm64.a
lipo -create -output libfreetype.a libfreetype-i386.a libfreetype-x86_64.a libfreetype-arm7.a libfreetype-arm7s.a libfreetype-arm64.a
lipo -info libfreetype.a
看error log的意思是指没有armv7s的slice,再看了一下CCHtmlLabel所用的libfreetype库,是2011年编译的,有点旧,当时iphone4s才刚出呢,当然没有armv7s了。
于是到SourceForge下载了freetype的源代码,编译成lib后再替换原来的libfreetype.a,再次用Xcode编译整个游戏项目,发现还是有个linker的错误:undefined
reference to `BZ2_bzDecompressInit'。
这个简单,在xcode里添加对libbz2.1.0.dylib的引用即可。
有需要的请到这里下载: http://download.csdn.net/detail/visualcatsharp/7076545
下面再记录一下编译的过程
mkdir /var/tmp/build-armv7
./configure CFLAGS="-arch i386"
make
cp objs/.libs/libfreetype.a libfreetype-i386.a
./configure CFLAGS="-arch x86_64";make clean;make
cp objs/.libs/libfreetype.a libfreetype-x86_64.a
make clean
./configure --prefix=/var/tmp/build-armv7 --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch armv7 -pipe -std=c99 -Wno-extended-offsetof
-Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=4.2 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-miphoneos-version-min=4.2"
make
cp objs/.libs/libfreetype.a libfreetype-arm7.a
make clean
./configure --prefix=/var/tmp/build-armv7 --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch armv7s -pipe -std=c99 -Wno-extended-offsetof
-Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=4.2 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-miphoneos-version-min=4.2"
make
cp objs/.libs/libfreetype.a libfreetype-arm7s.a
make clean
./configure --prefix=/var/tmp/build-armv7 --host=arm-apple-darwin --enable-static=yes --enable-shared=no CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc CFLAGS="-arch arm64 -pipe -std=c99 -Wno-extended-offsetof
-Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=6.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk" AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar LDFLAGS="-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
-miphoneos-version-min=6.0"
make clean; make
cp objs/.libs/libfreetype.a libfreetype-arm64.a
lipo -create -output libfreetype.a libfreetype-i386.a libfreetype-x86_64.a libfreetype-arm7.a libfreetype-arm7s.a libfreetype-arm64.a
lipo -info libfreetype.a
相关文章推荐
- iOS开发~静态库.a中的armv7,armv7s,arm64,i386,x86_64含义
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a
- iOS 中的 armv7,armv7s,arm64,i386,x86_64 都是什么
- IOS生成同时支持armv7,armv7s,i386 x86_64的静态库.a文件
- IOS生成同时支持armv7,armv7s,i386,x86_64,arm64的静态库.a文件
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86
- iOS开发中指令集armv7s,armv7和arm64的关系
- iOS 中的 armv7,armv7s,arm64,i386,x86_64 都是什么
- iOS关于armv7,armv7s,arm64,i386,x86_64等问题
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a
- IOS设备之armv6,armv7,armv7s,arm64
- iOS关于armv7,armv7s,arm64,i386,x86_64
- 编译iOS arm64 armv7 armv7s x86-64的第三方静态库
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a
- iOS 中的 armv7,armv7s,arm64,i386,x86_64 都是什么
- iOS下完美编译ffmpeg+x264,支持armv7, armv7s, 模拟器 (验证不通过,估计和ffmpeg版本有关)
- iOS开发~制作同时支持armv7,armv7s,arm64,i386,x86_64的静态库.a
- iOS下完美编译ffmpeg+x264,支持armv7, armv7s, 模拟器
- iOS 中的 armv7,armv7s,arm64,i386,x86_64