首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为iPhone编译FreeType?

为iPhone编译FreeType?
EN

Stack Overflow用户
提问于 2011-06-21 21:02:55
回答 7查看 8.5K关注 0票数 9

我在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呢?我真的毫无头绪。

EN

回答 7

Stack Overflow用户

回答已采纳

发布于 2013-05-29 22:50:25

我用了link in cxa's answer。然而,它非常过时,并且我的配置行不适合在注释中。对于armv7,使用6.1SDK编译,最低版本为5.1,没有bzip2,您需要类似以下内容:

代码语言:javascript
复制
./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,否则会产生一个链接器警告,如果留在里面,还会产生来自苹果的警告电子邮件。还请注意,不同的路径名已更改。

票数 13
EN

Stack Overflow用户

发布于 2012-09-09 01:46:30

我今天在尝试为iOS编译FreeType时偶然发现了这个项目:https://github.com/cdave1/freetype2-ios

只需下载,在xcode中打开,然后编译。:)

希望这篇文章对任何其他想要为iOS编译的人有所帮助。

票数 11
EN

Stack Overflow用户

发布于 2013-11-21 15:51:47

对于Xcode 5,gcc已经移动了位置,因此配置应该是:

代码语言:javascript
复制
./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的位置可以通过运行以下命令找到:

代码语言:javascript
复制
$ xcrun -find -sdk iphoneos clang
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6425643

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档