我正在使用Poco库1.4.5-all,最近我将我的Xcode升级到了5.0.1。 不知怎的,我有问题链接Poco库的iPhone设备构建,所以我设法通过使用最新的Poco库(poco-1.4.6p2-all)为iPhone设备正确链接
因为Xcode5.0.1没有llvm支持命令行,所以我必须像这样为iPhone设备构建Poco库。 (更改'build / config / iPhone-clang-libc ++'文件中的CXXFLAGS以与openssl库链接)
./configure --config=iPhone-clang-libc++ -static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL
make IPHONE_SDK_VERSION_MIN=5.0 POCO_TARGET_OSARCH=arm64 -s -j4
make IPHONE_SDK_VERSION_MIN=5.0 POCO_TARGET_OSARCH=armv7 -s -j4
make IPHONE_SDK_VERSION_MIN=5.0 POCO_TARGET_OSARCH=armv6 -s -j4
因此在为iPhone设备构建时效果很好。
问题是为iPhone模拟器构建。有很多'未定义的架构i386符号'错误。
这是我为iPhoneSimulator构建Poco库所做的。
我解雇了以下命令。
./configure --config=iPhoneSimulator-clang-libc++ -static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL
make
结果有问题。 (有很多'未定义的架构i386符号'错误。)
我检查了这两个库之间的区别。 'nm'工具结果如下所示。
i686(有问题)
00000050 T __ZN4Poco12DigestEngine11digestToHexERKNSt3__16vectorIhNS1_9allocatorIhEEEE
000001e8 S __ZN4Poco12DigestEngine11digestToHexERKNSt3__16vectorIhNS1_9allocatorIhEEEE.eh
00000198 s __ZZN4Poco12DigestEngine11digestToHexERKNSt3__16vectorIhNS1_9allocatorIhEEEEE6digits
armv7(ok)
0000001c T __ZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEE
00000280 S __ZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEE.eh
00000228 s __ZZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEEE6digits
这可以解决这个问题吗?
有没有人成功为iPhoneSimulator构建?
提前致谢。 布鲁斯。
答案 0 :(得分:0)
我设法为iPhone设备和iPhoneSimulator正确构建。
尽管Xcode5.0.1不支持llvm for commandline,但您可以下载'CommandLine Tools for Maverick'。如果你安装它,那么你可以使用llvm。所以你可以使用'iPhone'和'iPhoneSimulator'的构建配置(不需要使用'iPhone-clang-libc ++'和'iPhone-clang-libc ++'配置)
'nm'工具正确显示问题。当我为iPhoneSimulator构建时出现了问题。
所以,我会告诉你快速解决这些问题。
1)转到您下载的'poco-1.4.6p2-all'目录
2)打开build / config / iPhone文件
vim build/config/iPhone
3)并在两行后改变
CC = $(shell ls $(TOOL_PREFIX)/llvm-gcc-$(GCC_VER)* | tail -1)
CXX = $(shell ls $(TOOL_PREFIX)/llvm-g++-$(GCC_VER)* | tail -1)
到这个
CC = /usr/bin/llvm-gcc
CXX = /usr/bin/llvm-g++
这是因为原始脚本试图在thr错误的地方调用'llvm-gxx'。 '针对Maverick的CommandLine工具'将在'/ usr / bin'目录中为'llvm-gxx'创建符号链接。
抱歉没有漂亮的剧本,但硬连线的。
4)找到'CXXFLAGS',并指定'openssl'include&像这样的lib目录。 (你需要事先建好它。)
CXXFLAGS = $(OSFLAGS) -Wall -Wno-sign-compare -L(Your openssl source directory)/lib/iOS -I(Your openssl source directory)/include
5)现在您已完成该配置文件。保存并关闭。
6)接下来,打开build / config / iPhoneSimulator文件
vim build/config/iPhoneSimulator
7)找到'OSFLAGS'并将其评论为
# OSFLAGS = -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN)
8)完成。保存并关闭它。
9)现在激活以下命令,为“iPhone”设备构建库。
./configure --config=iPhone -static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL
make IPHONE_SDK_VERSION_MIN=5.0 POCO_TARGET_OSARCH=armv7 -s -j4
如果您需要为其他架构构建库,请添加它。
10)完成。现在触发以下命令来构建“iPhoneSimulator”的库
make clean
./configure --config=iPhoneSimulator -static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL
make IPHONE_SDK_VERSION_MIN=5.0 POCO_TARGET_OSARCH=i686 -s -j4
上面的最后一行,并更改为构建配置文件是我的问题的解决方案...我不是很清楚编译器和链接器的东西,所以我不知道原始脚本的问题是什么?
11)完成。最后,比较那些2的库内容。
nm lib/iPhoneOS/armv7/libPocoFoundation.a | grep digestToHex
nm lib/iPhoneSimulator/i686/libPocoFoundation.a | grep digestToHex
您应该看到已编译的C ++函数'digestToHex'的签名与此类似。
brucewang@Bruce-ui-MacBook ~/Downloads/poco-1.4.6p2-all $ nm lib/iPhoneOS/armv7/libPocoFoundation.a | grep digestToHex [ruby-1.9.3-p125]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list
0000001c T __ZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEE
00000280 S __ZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEE.eh
00000228 s __ZZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEEE6digits
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list
brucewang@Bruce-ui-MacBook ~/Downloads/poco-1.4.6p2-all $ nm lib/iPhoneSimulator/i686/libPocoFoundation.a | grep digestToHex [ruby-1.9.3-p125]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list
00000050 T __ZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEE
00000268 S __ZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEE.eh
00000218 s __ZZN4Poco12DigestEngine11digestToHexERKSt6vectorIhSaIhEEE6digits
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm: no name list
brucewang@Bruce-ui-MacBook ~/Downloads/poco-1.4.6p2-all $
12)如果您需要'胖库',请从终端调用'lipo'命令。例如, 您可以为所有* .a文件重复执行一个简单的shell脚本命令。
lipo -create -output "${UNIVERSAL_DIR}/${FILE1}" "${SIMULATOR_DIR}/${FILE1}" "${ARMV7_DIR}/${FILE1}"
就是这样。
答案 1 :(得分:0)
因此,对于运行OSX10.8 + XCode5的人来说,小牛解决方案并不真正有用。我找到了另一种解决方案。
另一种选择是使用clang编译器。我还没有测试过这个,请谨慎。它似乎确实编译..除此之外不确定
在poco目录中打开build / config / iPhone并用这个替换CC和CXX:
CC = $(shell xcrun -find -sdk iphoneos clang)
CXX = $(shell xcrun -find -sdk iphoneos clang++)
我遇到了这个解决方案here