Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

c++ - How can I compile Boost 1.54.0 (1.54) for the iOS simulator (6.1) on OS X 10.8.4?

I have successfully managed to compile several of the Boost libraries and create a framework for use with OS X, iOS, and the iOS simulator using this script: https://github.com/wuhao5/boost/blob/188e905626dbd522f65950102ed0c8ce77cb28e8/boost.sh based on Peter Goodliffe's work here: http://goodliffe.blogspot.com/2010/09/building-boost-framework-for-ios-iphone.html with Boost 1.53.0 using clang and linking against libc++.

The script fails when compiling for the iOS simulator with Boost 1.54.0 with the following error:/bin/sh: line 1: -ftemplate-depth-128: command not found.

I did quite a bit of digging and here is what I know:

  • In boost.sh, the iOS simulator bjam and compiler options include "-arch i386"
  • The release notes for Boost 1.54.0 state that "Boost no longer supports the 80386 target CPU"
  • Boost 1.53.0 appears to compile fine for OS X, iOS, and the iOS simulator using the same script
  • Boost 1.54.0 appears to compile fine for OS X and iOS itself using the same script

Here is what I think I know:

  • When passing "-d13" to bjam (to generate debug information), it appears that the variable "CONFIG_COMMAND" is not being set when building for the iOS simulator. For the other configurations, this variable is set to the path to clang and includes the compiler options. For the simulator, it is empty which I believe leads to the error above as when bjam attempts to run the compiler using this variable, it instead runs some appended options which begin with the template depth. Therefore, the CONFIG_COMMAND variable does not appear to be being set properly causing the failure.

I have no idea why it's not being set as I don't know enough about the Boost build system to sift through the rest of the 100+MB output it generated with the "-d13" flag. I suspect an incompatibility with the "-arch i386" option was introduced with 1.54.0. I've tried changing this to "-arch i486" and "-arch x86_32" but the same problem occurs.

Has anyone else had success with this? I'd like to use Boost.Log which is why I'm even attempting this.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I got it building with the boost.sh given here by changing the line in buildBoostForiPhoneOS()

./bjam -j16 --build-dir=iphonesim-build --stagedir=iphonesim-build/stage --toolset=darwin architecture=x86 target-os=iphone macosx-version=iphonesim-${IPHONE_SDKVERSION} link=static stage

to

./bjam -j16 --build-dir=iphonesim-build --stagedir=iphonesim-build/stage --toolset=darwin-${IPHONE_SDKVERSION}~iphonesim architecture=x86 target-os=iphone macosx-version=iphonesim-${IPHONE_SDKVERSION} link=static stage

Modified boost.sh with Boost pkg download and unpacking. Just need to run and all done!

Boost 1.54
MacOSx 10.8.4
Xcode 4.6.3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...