Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为iPhone编译FreeType?_Iphone_Ios_Config_Freetype - Fatal编程技术网

为iPhone编译FreeType?

为iPhone编译FreeType?,iphone,ios,config,freetype,Iphone,Ios,Config,Freetype,我在Windows、Linux和OSX上使用FreeType没有任何问题,现在我要把我的技术移植到IOS上。。。 我找不到一种方法来编译FreeType 起初,我试图将每个FT文件都放到我的项目中,但显然没有成功 然后我尝试创建一个静态库。 虽然我无法测试它是否适用于arm目标,但它不适用于模拟器目标 当试图将内置库链接到XCode时,会显示“libfreetype simulator.a,文件是为存档而构建的,而存档不是链接的体系结构(i386)” 这没关系,因为命令“lipo-info li

我在Windows、Linux和OSX上使用FreeType没有任何问题,现在我要把我的技术移植到IOS上。。。 我找不到一种方法来编译FreeType

起初,我试图将每个FT文件都放到我的项目中,但显然没有成功

然后我尝试创建一个静态库。 虽然我无法测试它是否适用于arm目标,但它不适用于模拟器目标

当试图将内置库链接到XCode时,会显示“libfreetype simulator.a,文件是为存档而构建的,而存档不是链接的体系结构(i386)” 这没关系,因为命令“lipo-info libfreetype simulator.a”告诉我该文件是为x86_64构建的。 我试着用“/configure--i386苹果达尔文”来配置它。 但最终的拱门仍然是x86_64

我该如何为i386构建freetype,iphone模拟器?
我真的没有任何线索。

我今天在为iOS编译FreeType时遇到了这个项目:

只需下载、在xcode中打开并编译。:)

希望这对其他尝试为iOS编译的人有所帮助。

我使用了。然而,它已经过时了,我的配置行不适合在评论中使用。对于armv7,使用6.1 SDK编译,最低版本为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
,否则会产生链接器警告,以及来自苹果的警告电子邮件(如果留在其中)。还请注意,各种路径名已更改。

对于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 clang

对于Xcode 6.1上的最小目标为7.1的iOS SDK 8.1,这可以工作:

./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=7.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.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/iPhoneOS8.1.sdk/ -miphoneos-version-min=7.0'
适用于我,x86_64。你可能需要看看


我用它来编译freetype2.5.5,得到了armv7、arm64、i386、x86_64。当然,它是一个单一的fat静态库。

也许有人会发现它有用。
SDK 8.1,XCode 6.1
i386、x86_64、arm64(用于评测)、armv7、armv7s

./configure CFLAGS="-arch i386"
make clean
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

./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=7.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.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/iPhoneOS8.1.sdk/ -miphoneos-version-min=7.0'
make clean
make
cp objs/.libs/libfreetype.a libfreetype-armv7.a

./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 arm64 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=7.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/' 'AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar' 'LDFLAGS=-arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/ -miphoneos-version-min=7.0'
make clean
make
cp objs/.libs/libfreetype.a libfreetype-arm64.a

./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 armv7s -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=7.0 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/libxml2/ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/' 'AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar' 'LDFLAGS=-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/ -miphoneos-version-min=7.0'
make clean
make
cp objs/.libs/libfreetype.a libfreetype-armv7s.a

lipo -create -output libfreetype.a libfreetype-i386.a libfreetype-x86_64.a libfreetype-armv7.a libfreetype-armv7s.a libfreetype-arm64.a 

为了使freetype能够顺利编译,将变量“CC”、“CFLAGS”、“LDFLAGS”和“AR”作为参数传递给
configure
not作为环境变量非常重要


在某个时刻,
configure
运行机器的本机gcc,如果您有指向iphonesdk的“LDFLAGS”,则会导致它失败。将变量传递到
configure
似乎可以解决这个问题。

请参阅我对这个类似问题的回答:+1,了解-mdynamic no pic部分,因为这可能会有问题,我登录多年后,我已经更新了正确的答案,谢谢!非常感谢你!它为我节省了很多时间!谢谢截至2015年9月,您的答案似乎是唯一可行的解决方案