Error
  • Copy failed
12February

How To Port Boost To iOS

How To Port Boost To iOS

For a new project I had to port the core library component of an existing Android app to iOS. One important part of this core libarary was written in C++ using some methods of the boost library. My first task was checking if boost libaray can even be used on iOS and how much time the integration task will take. Business as usal, I started some web-research and found some nice tutorials how to use boost for iOS quickly. However most of this solutions were not really suitable because the boost library needed to be built for each architecture - x86 for the simulator and armv6, armv7 and armv7s for the different Apple devices. Moreover a lot of configuration in the project the boost libarary needs be integrated in, was necessary. So I countiuned my research and finally found a quite nice article that discribed how to create a framework containing the different boost libararies for each architecture. The framework can be easily used only a few compiler flags need to be set.

UPDATE 06.06.13

If have compiled this boostoniphone repo working for the current xCode 4.6.2 (4H1003) and iOS SDK 6.1 on Mac OS X 10.8.3.

Short guidance how to create the boost-framework for iOS

First Step

IMPORTANT: Before executing the script in the terminal, install the XCode Command Line Tool! I wasted about one hour of google search for this insight ;)

To install the Command Line Tool go to  "XCode/Preferences..." and then on the tap "Downloads". Make sure that "Command Line Tools" is installed.

Second Step

Now open the terminal window go to your boostoniphone-master directory and enter "sh boost.sh" hit enter and here we go, lean back grap a cup of coffee and wait until the script has finished.
No? My placent anticipation was stopped here. A lot of unplacent erorrs scrolled down my terminal window. To solve this problem took me about one day. Looking back this problem was only a bagatelle.

The execution of the script stop with the non-saying error message "Aborted: Lipo thread failed". I had no idea what this message means. I spent a couple of hours to read dozens of google results regarding this error, however I did not find any suitable solution. So I maximized my terminal-window do get a better overview and started scrolling up the output lines. Finally I found the magic hint that saved my day.


"invalidate-value-string from module feature error: "iphone-6.0" is not a known valule of feature <macosx-version>"


I have installed the latest version of XCode (4.6 4H127) and the latest iOS SDK 6.1. In script file boost.sh the variable "IPHONE_SDKVERSION" was set to 6.0 however this iOS SDK was not available on my Mac. So I have changed the line to "IPHONE_SDKVERSION:=6.1", started the script again and after about 10 minutes the script finished successfully. Don't worry the duration of creation task depends on the hardware of your Mac and takes at least five minutes.

 

UPDATE 06.06.13

To support the "new" armv7s architecture it was necessary to recompile the boost framework. For this reason I have downloaded an already modified repo from github that includes the compiler flags for creating also a framework supporting armv7s. For me it worked out of the box, unzipping, executing, waiting a couple of minutes and fine.

Here is the link to the boostoniphone repo I have used. 

cheers,
Chris

Posted in iOS, Blog

Comments (26)

Leave a comment

You are commenting as guest. Optional login below.