I managed to build properly for both iPhone device and iPhoneSimulator.
Eventhough Xcode5.0.1 does not support llvm for commandline, you can download 'CommandLine Tools for Maverick'. If you install it then you can use llvm. So you can use build configurations for 'iPhone' and 'iPhoneSimulator' (no need to use 'iPhone-clang-libc++' and 'iPhone-clang-libc++' configuration)
And the 'nm' tool was showing the problem correctly. There was something wrong when I was building for iPhoneSimulator.
So, I'm gonna show you the quick fix for those.
1) go to your downloaded 'poco-1.4.6p2-all' directory
2) open build/config/iPhone file
vim build/config/iPhone
3) and Change following two lines
CC = $(shell ls $(TOOL_PREFIX)/llvm-gcc-$(GCC_VER)* | tail -1)
CXX = $(shell ls $(TOOL_PREFIX)/llvm-g++-$(GCC_VER)* | tail -1)
to this
CC = /usr/bin/llvm-gcc
CXX = /usr/bin/llvm-g++
This is because the original script tries to call 'llvm-gxx' in thr wrong place.
The 'CommandLine Tools for Maverick' will create symbolic link for 'llvm-gxx' in the '/usr/bin' directory.
Sorry for not beautiful script but hardwired one.
4) and find 'CXXFLAGS', and specify the 'openssl' include & lib directory like this.
(Of cource you need to have it built beforehand.)
CXXFLAGS = $(OSFLAGS) -Wall -Wno-sign-compare -L(Your openssl source directory)/lib/iOS -I(Your openssl source directory)/include
5) Now you're done with that configuration file. Save it and close.
6) Next, open build/config/iPhoneSimulator file
vim build/config/iPhoneSimulator
7) Find the 'OSFLAGS' and comment it out like this
# OSFLAGS = -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN)
8) Done. save it and close it.
9) Now fire following commands for building libraries for 'iPhone' device.
./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
if you need to build libraries for other architecture, please add it.
10) Done. Now fire following commands to build libraries for '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
The final line above, and changed to build config files are the solution for my problem... I am not that well aware of compiler&linker stuffs so I'm not sure what really is the problem with original scripts..
11) Done. Finally, compare the library contents of those 2 like this.
nm lib/iPhoneOS/armv7/libPocoFoundation.a | grep digestToHex
nm lib/iPhoneSimulator/i686/libPocoFoundation.a | grep digestToHex
you should see the signatures of compiled C++ function 'digestToHex' identical like this for example..
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) If you need 'fat library' then call the 'lipo' command from your terminal. For example,
you can make a simple shell script firing following command repeatedly for all *.a files.
lipo -create -output "${UNIVERSAL_DIR}/${FILE1}" "${SIMULATOR_DIR}/${FILE1}" "${ARMV7_DIR}/${FILE1}"
That's all.