我在Windows,Linux和OSX上使用FreeType没有任何问题,现在我打算把我的技术移植到IOS上。我找不到一种方法来为它编译FreeType。
一开始,我试着把每个FT文件都放到我的项目中,但这显然不起作用。
然后,我尝试在this tutorial here之后创建一个静态库。虽然我不能测试它是否适用于arm目标,但它不适用于模拟器目标。
当尝试将构建的库链接到XCode时,它会显示“libfreetype-模拟器.a,文件是为不是要链接的体系结构(I386)的归档构建的”,这是可以的,因为命令"lipo -info libfreetype-模拟器.a“告诉我该文件是为x86_64构建的。我尝试使用"./configure --i386-apple-darwin",here's the log对其进行配置。但是,由此产生的拱门仍然是x86_64。
我怎么才能为i386,iphone模拟器构建freetype呢?我真的毫无头绪。
发布于 2013-05-29 22:50:25
我用了link in cxa's answer。然而,它非常过时,并且我的配置行不适合在注释中。对于armv7,使用6.1SDK编译,最低版本为5.1,没有bzip2,您需要类似以下内容:
./configure '--without-bzip2' '--prefix=/usr/local/iphone' '--host=arm-apple-darwin' '--enable-static=yes' '--enable-shared=no' 'CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' 'CFLAGS=-arch armv7 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=5.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/' 'AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar' 'LDFLAGS=-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/ -miphoneos-version-min=5.1'请注意,缺少-mdynamic-no-pic,否则会产生一个链接器警告,如果留在里面,还会产生来自苹果的警告电子邮件。还请注意,不同的路径名已更改。
发布于 2012-09-09 01:46:30
我今天在尝试为iOS编译FreeType时偶然发现了这个项目:https://github.com/cdave1/freetype2-ios
只需下载,在xcode中打开,然后编译。:)
希望这篇文章对任何其他想要为iOS编译的人有所帮助。
发布于 2013-11-21 15:51:47
对于Xcode 5,gcc已经移动了位置,因此配置应该是:
./configure --without-zlib --without-png --without-bzip2 '--prefix=/usr/local/iPhone' '--host=arm-apple-darwin' '--enable-static=yes' '--enable-shared=no' 'CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' 'CFLAGS=-arch armv7 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=6.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/' 'AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar' 'LDFLAGS=-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/ -miphoneos-version-min=6.1'CC的位置可以通过运行以下命令找到:
$ xcrun -find -sdk iphoneos clanghttps://stackoverflow.com/questions/6425643
复制相似问题