Wednesday, November 16, 2011

Native libraries porting to iOS

Recently I spent a bit of time working on porting (getting built) some native libraries with Android NDK and iOS. The port to Android NDK deserves it's own post, that I might write down later.

As for iOS, I primarily needed openssl, curl, zlib and found nice little script, that helps you with the build:
http://code.google.com/p/ios-static-libraries. Just comment out what you don't need and you should be good to go. It's quite easy to repurpose the script to pull the source from your local repos if needed.

One of the problem I had was that I have only iOS SDK 5.0 on the machine and the libcurl build for iPhone device was breaking because "cpp" compiler (export CXXCPP=${DEVROOT}/usr/bin/cpp
) was not found . Apple provided "cpp" compiler for the emulator, but conveniently left it out from the iPhone device toolchain. The easy fix for that is to create the symbolic link in the /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin directory:
ln -s llvm-cpp-4.2 cpp

Hope this saves you a bit of time.

No comments: