Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Boost.Locale with iconv for iOS

I'm currently trying to build Boost.Locale for iOS, but I can't get it to find the iconv lib (I'm successfully building other parts of Boost for iOS, such as thread or filesystem).

I've tried to let Boost.Build find it by itself, I've tried to set the ICONV_PATH variable to point at the iPhoneOS SDK iconv lib. Checking the Jamfile in Boost.Locale, I stumbled upon that rule:

lib iconv 
  : 
  : <search>$(ICONV_PATH)/lib <link>shared <runtime-link>shared
  :
  : <include>$(ICONV_PATH)/include 
  ;

So I thought setting -sICONV_PATH to /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr would be enough, as this directory contains a lib and an include folder which contain the iconv lib and header, but Boost still fails to find it, and spits:

iconv (libc)             : no
iconv (separate)         : no
icu                      : no
icu (lib64)              : no
Boost.Locale needs either iconv or ICU library to be built.

Note that I always invoke b2 with the --reconfigure option, and thus it's not the result of the caching of a previous invocation (which would have a trailing (cached) in the list above.

So, is there a way to correctly point Boost at the iconv implementation present in the iOS SDK? I'd like to avoid building a separate iconv if possible.

like image 792
JBL Avatar asked Feb 08 '23 16:02

JBL


2 Answers

I was running into similar problems. After some digging and some red herrings I learned that boost detects iconv by compiling the has_iconv.cpp program. In my case (using the boost.sh script that a lot of people seem to use for compiling for iOS) there were a lot of compilation errors in config.log caused by an incorrect using-syntax in user-config.jam . So the problem - at least for me - wasn't getting ICONV_PATH set but making the detection program compile at all! Perhaps you have a similar problem.

I did a full write up of finding in my blog if you're interested.

like image 91
AlexK Avatar answered Feb 16 '23 04:02

AlexK


You should receive the following log output when building

If iconv library is not found on Darwin/Mac OS X builds make sure there is no multiple iconv installations and provide -sICONV_PATH build option to point to correct location of iconv library.

First you need to Bootstrap the location, where $ICU = ICU root directory and the directory in which the build ICU build products are ("bin/", "include/", etc.):

.\bootstrap --with-icu=$ICU

Then

.\b2 boost.locale.icu=on boost.locale.std=off -sICU_PATH="$ICU" --with-chrono --with-locale --with-system --with-thread link=static stage cxxflags="-miphoneos-version-min=9.0 -stdlib=libc++"
like image 32
Danoli3 Avatar answered Feb 16 '23 04:02

Danoli3