为iPhone编译FreeType? [英] Compiling FreeType for iPhone?
问题描述
我在Windows,Linux和OSX上使用FreeType没有任何问题,现在我将我的技术移植到IOS ...
而且我找不到为它编译FreeType的方法。
I'm using FreeType on Windows, Linux and OSX without a single problem, and now I was to port my tech to IOS... And I can't find a way to have FreeType compiled for it.
起初我试图将每个FT文件放入我的项目中,但这显然不起作用。
At first I tried to drop every FT file into my project, but that clearly didn't work.
然后我尝试在此教程之后创建一个静态库。
虽然我无法测试它是否适用于arm目标,但它不适用于模拟器目标。
Then I tried to make a static library following this tutorial here. While I can't test if it worked for the arm target, it doesn't work for the simulator target.
尝试链接构建的库时进入XCode,它说libfreetype-simulator.a,文件是为存档而构建的,而不是被链接的架构(i386)
,这很好,因为命令lipo -info libfreetype-simulator.a告诉我该文件是为x86_64构建的。
我尝试用./configure --i386-apple-darwin配置它,这里是日志。
但是,最终的结果是x86_64。
When trying to link the built library into XCode it says "libfreetype-simulator.a, file was built for archive which is not the architecture being linked (i386)" and that's ok because the command "lipo -info libfreetype-simulator.a" tells me that the file was built for x86_64. I tried configuring it with "./configure --i386-apple-darwin", here's the log. But still, the resulting arch was x86_64.
我可以在世界上如何为i386,iphone模拟器构建freetype?
我真的没有线索。
How in the world can I build freetype for i386, iphone simulator? I really have no clues.
推荐答案
我用的是链接在cxa的答案中。但是它已经过时了,我的配置行不适合评论。对于armv7,使用6.1 SDK进行编译,最低版本为5.1,不使用bzip2,您需要以下内容:
I used the link in cxa's answer. However it is very out of date, and my configure line did not fit in a comment. For armv7, compiling with the 6.1 SDK, with a minimum version of 5.1, without bzip2, you want something like:
./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
否则会产生链接器警告,如果留下则会发出来自Apple的警告电子邮件。另请注意,各种路径名已更改。
Note the lack of -mdynamic-no-pic
which would otherwise produce a linker warning, and a warning email from Apple, if left in. Also note that various pathnames have changed.
这篇关于为iPhone编译FreeType?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!