Reputation: 12917
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.
Upvotes: 4
Views: 3008
Reputation: 3524
Late answer, but here is a working config that supports Boost.Locale on iOS using the iconv library (boost v1_64_0). An implementation is available from https://github.com/Cogosense/iOSBoostFramework that uses a Makefile to build a boost framework for armv7, armv7s, arm64, i386, and x86_64 architectures.
To build 32bit ARM create a user-config.jam with the following content:
using clang-darwin : arm
: xcrun --sdk iphoneos clang++
: <cxxflags>"-miphoneos-version-min=8.0 -arch armv7s -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -stdlib=libc++ -std=c++11 -D_LITTLE_ENDIAN -Wall -pedantic -Wno-unused-variable"
<linkflags>"-arch armv7s"
<striper>
;
the architecture can also be set to armv7, change the value of cxxflags to your liking, but the -arch flag is required.
build boost for the 32bit iPhone target with the following build command:
BOOST_BUILD_USER_CONFIG=<path-to-arm32-jam-config>/user-config.jam \
SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-platform-path) \
./b2 -sICONV_PATH=$SDK_PATH/Developer/SDKs/iPhoneOS.sdk/usr \
toolset=clang-darwin-arm \
target-os=iphone
To build 64bit ARM create a user-config.jam with the following content:
using clang-darwin : arm64
: xcrun --sdk iphoneos clang++
: <cxxflags>"-miphoneos-version-min=8.0 -arch arm64 -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -stdlib=libc++ -std=c++11 -D_LITTLE_ENDIAN -Wall -pedantic -Wno-unused-variable"
<linkflags>"-arch arm64"
<striper>
;
build boost for the 64bit iPhone target with the following build command:
BOOST_BUILD_USER_CONFIG=<path-to-arm64-jam-config>/user-config.jam \
SDK_PATH=$(xcrun --sdk iphoneos --show-sdk-platform-path) \
./b2 -sICONV_PATH=$SDK_PATH/Developer/SDKs/iPhoneOS.sdk/usr \
toolset=clang-darwin-arm64 \
target-os=iphone
To build 32bit x86 simulator create a user-config.jam with the following content:
using clang-darwin : x86
: xcrun --sdk iphonesimulator clang++
: <cxxflags>"-miphoneos-version-min=8.0 -arch i386 -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -stdlib=libc++ -std=c++11 -Wall -pedantic -Wno-unused-variable"
<linkflags>"-arch i386"
<striper>
;
build boost for the 32bit iPhone Simulator with the following build command:
BOOST_BUILD_USER_CONFIG=<path-to-x86-jam-config>/user-config.jam \
SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-platform-path)
./b2 -sICONV_PATH=$SDK_PATH/Developer/SDKs/iPhoneSimulator.sdk/usr \
toolset=clang-darwin-i386 \
target-os=iphone
To build 64bit x86 simulator create a user-config.jam with the following content:
using clang-darwin : x86_64
: xcrun --sdk iphonesimulator clang++
: <cxxflags>"-miphoneos-version-min=8.0 -arch x86_64 -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -stdlib=libc++ -std=c++11 -Wall -pedantic -Wno-unused-variable"
<linkflags>"-arch x86_64"
<striper>
;
build boost for the 64bit iPhone Simulator with the following build command:
BOOST_BUILD_USER_CONFIG=<path-to-x86_64-jam-config>/user-config.jam \
SDK_PATH=$(xcrun --sdk iphonesimulator --show-sdk-platform-path)
./b2 -sICONV_PATH=$SDK_PATH/Developer/SDKs/iPhoneSimulator.sdk/usr \
toolset=clang-darwin-x86_64 \
target-os=iphone
Upvotes: 1
Reputation: 85
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.
Upvotes: 5
Reputation: 3233
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++"
Upvotes: 2