如何编译Poco for iOS (Xcode 5)

苍温文
2023-12-01

网上找了一个编译脚本《Poco C++ ios 和 android平台编译脚本》,执行时出错:

ls: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-*: No such file or directory

进入poco看了一下,poco提供的配置(poco-1.4.6p4/build/config)中iOS的有3种:

iPhone

iPhone-clang

iPhone-clang-libc++

再进入网上找的那个脚本看下,它用的是配置1,似乎是针对老版本Xcode的,而我的Xcode 5的目录结构和编译器已发生变化,所以会出现上述错误。我改为配置2(另外还修改了原来脚本中lipo命令的错误),编译成功了。

(另外,配置3是使用C++11标准库,与配置2的区别见《Xcode中C++ Standard Library的选择》)

下面就是我修改后能正确运行了的Poco iOS编译脚本:

#!/bin/sh
#
# Description: poco编译脚本,ios和android
# 
# Created by yangchen on 2013-1-30.
# 
# Important History:
# 
# index    version     date     author     notes
# 0     1.0.1001    2013/1/30       yangchen    创建文件

###########========ios 平台======#########


./configure --config=iPhone-clang --no-tests --no-samples

#make cppunit IPHONE_SDK_VERSION_MIN=3.0 POCO_TARGET_OSARCH=armv7 -s -j4
make IPHONE_SDK_VERSION_MIN=3.0 POCO_TARGET_OSARCH=armv7 -s -j4

./configure --config=iPhoneSimulator-clang --no-tests --no-samples

#make cppunit -s -j4
make -s -j4

mkdir -p lib/iOSAll

#lipo -create  lib/iPhoneOS/armv7/libCppUnit.a  lib/iPhoneSimulator/i686/libCppUnit.a -output  lib/iOSAll/libCppUnit.a 
#lipo -create  lib/iPhoneOS/armv7/libCppUnitd.a  lib/iPhoneSimulator/i686/libCppUnitd.a -output  lib/iOSAll/libCppUnitd.a 
lipo -create lib/iPhoneOS/armv7/libPocoFoundation.a  lib/iPhoneSimulator/i686/libPocoFoundation.a -output lib/iOSAll/libPocoFoundation.a 
lipo -create lib/iPhoneOS/armv7/libPocoFoundationd.a  lib/iPhoneSimulator/i686/libPocoFoundationd.a -output  lib/iOSAll/libPocoFoundationd.a 
lipo -create lib/iPhoneOS/armv7/libPocoNet.a  lib/iPhoneSimulator/i686/libPocoNet.a -output  lib/iOSAll/libPocoNet.a 
lipo -create lib/iPhoneOS/armv7/libPocoNetd.a  lib/iPhoneSimulator/i686/libPocoNetd.a -output  lib/iOSAll/libPocoNetd.a 
lipo -create lib/iPhoneOS/armv7/libPocoUtil.a  lib/iPhoneSimulator/i686/libPocoUtil.a -output  lib/iOSAll/libPocoUtil.a 
lipo -create lib/iPhoneOS/armv7/libPocoUtild.a  lib/iPhoneSimulator/i686/libPocoUtild.a -output  lib/iOSAll/libPocoUtild.a 
lipo -create lib/iPhoneOS/armv7/libPocoXML.a  lib/iPhoneSimulator/i686/libPocoXML.a -output  lib/iOSAll/libPocoXML.a 
lipo -create lib/iPhoneOS/armv7/libPocoXMLd.a  lib/iPhoneSimulator/i686/libPocoXMLd.a -output  lib/iOSAll/libPocoXMLd.a

转载于:https://www.cnblogs.com/leaf-w/p/how-to-build-poco-ios-xcode5.html

 类似资料: