Wednesday 29 September 2010

Building a Boost framework for iOS (iPhone, iPad, etc)

Several Boost versions have ticked past since I last posted about building a Boost framework for use with the iPhone. Each version of Boost requires subtly different build steps, and each version better supports building iPhone versions out of the box.

The good news: Boost 1.44.0 builds for iPhone a lot more easily than previous versions.
The bad news: making a framework is still not easy.

But first, why?

First, let's answer the obvious question: Why would you want to bother building a framework at all?

Quite simply: to make your life easier.

Using the native Boost build, you (may) need to link against a number of different Boost libraries in your application. And then you need to do a clever dance to ensure you link against either the i386 (simulator) or armv6/armv7 (iPhone devices) versions, depending on your build configuration.

That is tedious and annoying, and not the way it should be. Other Apple "libraries" are provided as a "framework" which you just need to mention once in Xcode, and then the build system works out how to link to the correct version and how to find the right headers.

So, if we can turn Boost into a framework life would be so much easier.

And that's what I have done.

Pete: Doing all the hard work to save literally... some... people all the hassle.


Executive summary

Now, you can do it too.

Just run the script you'll find in Gitorious here: http://gitorious.org/boostoniphone/boostoniphone

Download yourself boost_1_44_0.tbz into the same directory, run the script. Make a cuppa. Make another cuppa. And then admire your new shiney Boost framework.

Use it like any other framework. Draggy droppy. Happy happy.


What changed?

For the hardcore faithful who care about htese things, here's what's changed since my last script version:

  • Boost now builds for iOS far more easily (I think this changed for the better in 1.43.0). Now, you just need to write some gibberish in a user-config.jam and run a boostrap script. That is a darned site easier than it used to be.
  • To make it build for the simulator, you still need to invent some missing header files.
  • But the biggest hassle in this version was creating the final universal library file. Since the ARM builds themselves are now fat archives (including an armv6 and armv7 version of each .o file) I needed to work out how to make a functional uber-lib file. Because Apple's binutils are not useful GNU ones, their ar is braindead. The only way to make a correctly functioning library (that I could find) was to un-lipo the fat ARM binaries, un-ar each archive, link all the original .os into an uber library, than lipo up each of those. Does that sound painful? Yes. It hurt.

73 comments:

  1. Thanks Pete. It's good to know someone is out there blazing the, ever changing, trail.

    I've been using boost in my iPhone code since the start - but I'm only using the header-only libs so far, so this has not been an issue.

    If I ever need any of the lib-based code I'll be sure to come back to this.

    ReplyDelete
  2. Thank you! I think you really are doing work that could potentially help a LOT of developers :)

    ReplyDelete
  3. Thank you so much for posting this. I've been trying to compile boost for the iphone all afternoon, and I had just about given up on it when I found your post. It's more than I could have hoped for. Not only did you make a script for compiling boost, you also built a boost framework!

    ReplyDelete
  4. Wow. I can't believe this worked so easily. Thanks!!!

    ReplyDelete
  5. Hi Pete, that's great but for some reason the Gitorious links are broken for me (DNS expiry apparently) is there any other service you could share the script on?

    ReplyDelete
  6. Oh, nasty. I'm sure it'll be back up shortly, but in the mean time I'll happily send you a tarball directly if you tell me where to send it.

    ReplyDelete
  7. Great, this worked so easily. Thank u for the effort. This will boost my iphone app ;)

    ReplyDelete
  8. Thanks Peter for your work. I do have some problems with it though. I am building the framework for ios 4.2 using you script.

    However, it is not building some libraries, e.g., the math library. How can I fix this?


    Thanks.
    Peter

    ReplyDelete
  9. To be a bit more specific :)

    I do see some libs of math are generated for the simulator (e.g. libboost_math_C99a) but there is no src etc in the darwin-4.2.1~iphone directory.

    At the end of the script the error message is:

    lipo: can't open input file: /xcode/boost/src/boost_1_44_0/bin.v2/libs/math/build/darwin-4.2.1~iphone/release/architecture-arm/link-static/macosx-version-iphone-4.2/target-os-iphone/threading-multi/libboost_math.a (No such file or directory)

    it is the same for the simulator: the libboost_math.a is not found

    any suggestions Pete?

    ReplyDelete
  10. The script currently doesn't have "math" in the list of Boost libraries to build. Just add it to the list and rebuild Boost. Not too hard!

    Look for the "BOOST_LIBS:=" at around line 23.

    Hope that helps.

    ReplyDelete
  11. Thanks Pete!
    A small question: does it build both the debug and the release versions?

    ReplyDelete
  12. The script creates a framework from the release versions. It wouldn't be hard to create a debug version by replacing "release" in the source paths with "debug".

    ReplyDelete
  13. Excellent little script, getting the "system" and "thread" libs built into a framework was a breeze. Much less hassle than the old manual way of including the .a files. Thanks a lot!

    ReplyDelete
  14. Hello Pete,

    It seems the gitorious link is now broken.

    Could you repost it?

    Cristhopper

    ReplyDelete
  15. Sorry about that, it seems that gitorious have changed their link format. I've updated it in the post.

    ReplyDelete
  16. Hello Pete,

    Thank you so much for reposting it.

    It built perfectly. However, I'm having problems including the framework in a different project. I can include it as my project frameworks, however, I get many "No such file or directory" for headers like Cstddef or utility.hpp and also get many "Expected = , ; asm or __attribute__ " messages for the namespace keyword.

    I suspected this had to do with the c++ mixed with objc so I changed the extension of my viewcontroller to .mm, but that didn't change anything.

    Would you have any hint?

    I appreciate your help

    Cristhopper

    ReplyDelete
  17. Hi Pete!

    First of all, thank you for your work. However, I cannot build the framework with the regex lib supporting ICU. I've tried adding --with-icu=/usr/local option to the bootstrap.sh and -sICU_PATH=/usr/local option to the bjam (separately and together), but nothing worked for me.
    The error meassage I get is:

    darwin.compile.c++ bin.v2/libs/regex/build/darwin-4.2.1~iphone/debug/has_icu_test.o
    /bin/sh: line 1: -ftemplate-depth-128: command not found

    -ftemplate-depth-128 -O0 -fno-inline -Wall -g -dynamic -no-cpp-precomp -gdwarf-2 -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_HAS_ICU=1 -D_LITTLE_ENDIAN -I"." -I"/usr/local/include" -c -o "bin.v2/libs/regex/build/darwin-4.2.1~iphone/debug/has_icu_test.o" "libs/regex/build/has_icu_test.cpp"

    ...failed darwin.compile.c++ bin.v2/libs/regex/build/darwin-4.2.1~iphone/debug/has_icu_test.o...
    ...skipped has_icu for lack of has_icu_test.o...

    Any idea how could I fix this?
    Thanks, Peter.

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. I've made a few updates to the script, but Gitorious is not feeling well at the moment. I cloned it into boostoniphone-clith. My main improvements:

    * support for Xcode installed elsewhere using "xcode-select -print-path" instead of assuming /Developer (I have /xcode3 and /xcode4 directories).
    * support for making a DEBUG build
    * building with all cores using "bjam -j `hwprefs thread_count`

    I'll do a merge request once I get it all working nicely (and Gitorious is feeling better)..

    ReplyDelete
  20. Ok, I've committed my changes to my git clone. But it's not quite clean enough yet -- I think libtool can be used to replace all the ripping apart of .a files that's being done.

    ReplyDelete
  21. That's incredibly helpful, and so smooth in deployment! you're a saint :)

    ReplyDelete
  22. Hi, thanks very much for boostoniphone. :)

    ReplyDelete
  23. Thanks for the great script!

    Can you be more specific about what has to be done to get it working with the simulator?

    ReplyDelete
  24. thank you so much !, but i just spent one hour creating ssh keys, creating accounts here and there etc, what's wrong with a simple .zip file ?


    why on earth do i need to upload MY ssh key to download some files, that is ridiculous !

    don't try to explain, i'm not interested in the answer.

    ReplyDelete
  25. ok i give up, WHERE IS THE DOWNLOAD BUTTON ??

    ReplyDelete
  26. I suspect you're doing something far too complex! You should be able to pull the code anonymously without fiddling with any SSH keys!

    ReplyDelete
  27. Gitorious gives you links to download as a .tar.gz - for the main code:
    https://gitorious.org/boostoniphone/boostoniphone/archive-tarball/master

    If you want a copy of my changed version:
    https://gitorious.org/boostoniphone/boostoniphone-clith/archive-tarball/master

    Reid

    ReplyDelete
  28. thanks guys, and sorry for my attitude, trying to quit smoking :D

    ReplyDelete
  29. I'm failing to build.

    I'm getting:

    Failed to build Boost.Jam
    Consult 'bootstrap.log' for more details

    and when I look in bootstrap.log I see this:

    rm -rf bootstrap
    mkdir bootstrap
    cc -o bootstrap/jam0 command.c compile.c debug.c expand.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c newstr.c option.c output.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c
    In file included from command.c:17:
    jam.h:400:23: error: sys/types.h: No such file or directory
    jam.h:401:22: error: sys/stat.h: No such file or directory
    jam.h:404:26: error: sys/file.h: No such file or directory
    ... etc...

    yowza, I can build other iOS apps on my machine so this is pretty weird. I'm only running xCode 3.2.6. I don't mind upgrading but don't feel like just trying that. Any advice would be appreciated.

    ReplyDelete
  30. Awesome, build 1.47 with it as well. Thanks heaps.

    ReplyDelete
  31. I don't think I posted the URL for my gitorious fork, so here it is:

    https://gitorious.org/~clith/boostoniphone/boostoniphone-clith

    ReplyDelete
  32. I've had no luck getting this to work for versions of Boost other than the one you include here. It jumps promptly to "complete" after listing some data. I'll poke around in the script, though...

    (The reason 1_44 is unsatisfactory is a little link error that's apparently exclusive to that version; has to do with transcoding UTF-8 strings.)

    That said, this is a glorious script. Thanks for writing it!

    ReplyDelete
  33. Kaboshed the "case" statement at the bottom of the script (seems to enforce use of 1_44) which made things work. boost::regex breaks, but I didn't need it, so huzzah!

    ReplyDelete
  34. And how about iOS5.0?
    Would I need to change gcc-4.2 to llvm-gcc-4.2?

    ReplyDelete
  35. Thanks for the great script!
    All done fine for iOS 5.0, boost 1_47_0 with minimal changes on scrript config. And I changed gcc-4.2 to llvm-gcc-4.2.

    ReplyDelete
  36. Thanks Pete and Reid for all of this!

    works like a charm*

    ReplyDelete
  37. I have tried to execute boost.sh(use sh boost.sh) for boost 1_44_0 under terminal using root, but I have got a error "boost.sh: line 157: ./bjam: No such file or directory", it seems the bjam has not been created or something. Can u help me with this please. BTW I am using lion + iOS5.

    ReplyDelete
  38. My boost build issue has been solved by installing gcc separately(not sure why gcc not installed when I installed xcode 4.2). And I have tested that with a simply example of boost thread and it worked fine ! Pete, thanks for the great script!

    Pete, I have one more question - I have got loads of Warning(68 for a few line of boost::thread test) "Apple Mach-O Linker (Id) Warning" ? Despite all those warning , it runs fine.
    But I am wondering have I been using your boost framework the wrong way ? I simply drag the boost.frame folder to my xcode Frameworks folder. Is this the right way of using it ??

    ReplyDelete
  39. The linker errors are probably due to the library and your application being built with different default symbol visibility settings.

    Generally, it's a benign warning. To remove it, change the visibility settings of your application code.

    ReplyDelete
  40. Hi Pete,

    Thanks for your amazing work!

    However, I have fixed your script a bit so that it actually builds frameworks like boost::test (where you don't get one libboost_test.a but get 3 different libboost_*.a) and also so that it works with current Xcode and SDK (5.0).

    You can find the updated script along with an article in my blog: http://alex.tapmania.org/2011/11/boost-as-framework-on-ios.html

    Cheers,
    Alex

    ReplyDelete
  41. Hi Pete.

    Thank you for this script, it helped a lot!

    Also, I have made few changes adding function to edit darwin.jam so script can target iphone and iphone-simulator while building libs. Not sure why it wasn't working as is. Hope it will save some time to anyone who will have similar problems.

    boost.sh

    ReplyDelete
  42. thanks for your work, Pete!

    one thing that snagged me at first, when i put into directories that had a space like "/home/IOS Dev"... well you can imagine ... no quoted paths in your scripts.

    patient says: doctor it hurts when i put spaces in directory names

    doctor replies: well, do put spaces in directory names.

    also ".../gcc-4.2" is hardcoded in. this should be made a config var at top of script. building for SDK5.0, i changed to ".../gcc".

    again, many thanks for your efforts, Pete!

    ReplyDelete
  43. Thanks for posting an excellent script. However, I can seem to get the resulting framework to bind. I get the following link error using boost::filesystem::path. I've compiled 1_44_0 and 1_48_0 with the same results using llvm-gcc-4.2. Any help would be appreciated.

    Undefined symbols for architecture armv7:
    "__ZTVN5boost10filesystem6detail18utf8_codecvt_facetE", referenced from:
    __ZN12_GLOBAL__N_111path_localeEv in boost(path.o)
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)


    Ld /Users/TBurnett/Library/Developer/Xcode/DerivedData/HPT-fsajfvpmuqybtfhasmxbnazilapu/Build/Products/Debug-iphoneos/HPT.app/HPT normal armv7
    cd /Volumes/DEV/Development/HPT/iOS
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
    setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang++ -arch armv7 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Users/TBurnett/Library/Developer/Xcode/DerivedData/HPT-fsajfvpmuqybtfhasmxbnazilapu/Build/Products/Debug-iphoneos -L/Volumes/DEV/Development/HPT/iOS/../Depend/iOS/lib -L/Volumes/DEV/Development/HPT/iOS/../../../DevKits/boost_1_48_0_iOS/build/armv7 -F/Users/TBurnett/Library/Developer/Xcode/DerivedData/HPT-fsajfvpmuqybtfhasmxbnazilapu/Build/Products/Debug-iphoneos -F/Volumes/DEV/Development/HPT/iOS/../../../DevKits/boost_1_44_0/framework -F/Volumes/DEV/Development/HPT/iOS/../../../DevKits/boost_1_48_0_iOS/framework -filelist /Users/TBurnett/Library/Developer/Xcode/DerivedData/HPT-fsajfvpmuqybtfhasmxbnazilapu/Build/Intermediates/HPT.build/Debug-iphoneos/HPT.build/Objects-normal/armv7/HPT.LinkFileList -dead_strip -fobjc-arc -miphoneos-version-min=5.0 -framework MobileCoreServices -framework UIKit -framework Foundation -framework CoreGraphics -framework GLKit -framework OpenGLES -lFreetype2 -lFTGLES -ltinyxml -lassimp -lfreeimage -framework boost -o /Users/TBurnett/Library/Developer/Xcode/DerivedData/HPT-fsajfvpmuqybtfhasmxbnazilapu/Build/Products/Debug-iphoneos/HPT.app/HPT

    Undefined symbols for architecture armv7:
    "__ZTVN5boost10filesystem6detail18utf8_codecvt_facetE", referenced from:
    __ZN12_GLOBAL__N_111path_localeEv in boost(path.o)
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    ReplyDelete
  44. Pete, your boost framework works great thanks again for the effort.
    But it's like 95M in my Resource folder.

    Do you think this would be a problem if anyone using this framework trying to release a app to apple store ?

    Is there a way to use specific lib instead of the whole boost framework for releasing so the app size can be reduced a lot?

    Please correct me if I am wrong as I am relative new to ios development and haven't released app yet.

    Best Regards,
    Peter

    ReplyDelete
  45. I've been using a framework built from this script for quite some time. Works great. Recently I have hit a problem that can be reproduced by dropping the following code into the viewDidLoad of a view controller in a new XCode project:


    #include "boost/filesystem/path.hpp"
    #include "boost/filesystem/operations.hpp"


    - (void)viewDidLoad
    {
    [super viewDidLoad];
    boost::filesystem::path path("/var/mobile/Applications/.../Documents/somefile.txt");
    bool b = boost::filesystem::exists(path);
    }

    This results in EXC_BAD_ACCESS when the path object is destroyed (the problem occurs in the destructor of the basic_string member of path). Has anyone else run into this problem? Everything is built with the same SDK and visibility settings are the same on test project and framework. Inside ::exists, the only function called on path is .c_str(), which I can call in my code with no problem. It passes the result of .c_str() to ::stat, which I can also call successfully. It seems like a runtime mismatch of some sort. Any ideas?

    ReplyDelete
  46. Hi All
    Thanks for the script. I have succesfully downloaded and run the boost.sh script from nz2-boostoniphone. I am specifically interested in the math/specific_functions and math/distributions library, but are having a hard time to understand how to use the boost.framework after I have loaded it into my Xcode project using the "Linked frameworks and libraries". Thus it would be highly appreciated if someone could post a small sample project in which for example the story board has a button and a label, and when the user presses the button the label shows the pdf value for a student t distribution with a given number of DF, e.g. 4.

    I anticipate that this will involve:

    //construction of a student t distribution using maybe the code line;
    students_t d1(4);

    //evaluation of the pdf using maybe a code line like this;
    double yValue = pdf(d1,2.0);

    And when ofcourse also the inclusion of the necessary header file(s): boost/math/distributions/students_t.hpp

    Thanks
    Lars

    ReplyDelete
  47. I'm running into the same linker issues with boost::filesystem::detail::utf8_codecvt_facet while using Boost 1.48. Curious if anyone has made headway on that.

    ReplyDelete
  48. FWIW, http://stackoverflow.com/questions/9100723/using-boostfilesysystem-path-from-framework-on-ios answers the filesystem::path issue above

    ReplyDelete
  49. If you're getting errors like this when running the script, it could be that you don't have the Xcode "Command Line Tools" installed :

    jam.h:400:23: error: sys/types.h: No such file or directory

    ReplyDelete
  50. lipo: can't open input file: /Users/deepak/Downloads/davidandreoletti-boostoniphone-ab8ca1c/src/boost_1_44_0/bin.v2/libs/date_time/build/darwin-4.2.1~iphone/release/architecture-arm/link-static/macosx-version-iphone-4.3/target-os-iphone/threading-multi/libboost_date_time.a (No such file or directory)

    I got this issue.Some pls help. This would be a life saver

    ReplyDelete
  51. People having trouble with

    Undefined symbols for architecture i386:
    "vtable for boost::filesystem::detail::utf8_codecvt_facet", referenced from:

    I believe this problem occurs because there are two utf8_codecvt_facet.o object modules: one in program_options and one in filesystem. When the libraries are merged to form the framework, the .o file can only occur once per platform, and the program_options one is winning.

    I'm not sure what the solution is...

    ReplyDelete
  52. Have you looked into building this for armv7s?

    ReplyDelete
  53. Have you looked into building this for armv7s?

    ReplyDelete
  54. Thank you!

    After fiddling with the script a bit to remove the version check and update the Xcode paths, it successfully built 1.51.0 with every library except context, graph_parallel, locale, math, mpi and test.

    I tried to get locale to work with iconv but I'm not sure where it went wrong. Is the iOS iconv one of the unusable ones?

    ReplyDelete
  55. Update: I changed the script some more, adding an armv7s pass to everything lipo (for which I now specify that I want the version from the Xcode tree, not /usr/bin/lipo because the latter doesn't understand the name "arvm7s") and overwriting darwin.jam on the fly. I added all the ARM flavours directly to darwin.jam but if my understanding of the process is correct one can just add "-arch armv7s" right next to where it says "-arch armv7" in writeBjamUserConfig, though it'll try to build armv6 as well (which works somehow but doesn't have much practical use as the 6.0 SDK no longer supports armv6). To suppress armv6 one should probably overwrite darwin.jam.

    Build is successful, linker no longer complains about the lack of armv7s in boost.

    ReplyDelete
  56. The issue:

    Undefined symbols for architecture i386:
    "vtable for boost::filesystem::detail::utf8_codecvt_facet", referenced from:

    Is indeed due to having multiple object (.o) files with the same name in the individual boost libraries. To fix it, I modified my copy of the script to rename the .o files prefixing them with the boost library name before aggregating them into a single library. This seems to have worked for me.

    ReplyDelete
  57. First of all thanks so much for your boost.sh script which lives on ...

    We are experiencing a bug that seems directly connected to your comment at the beginning of the script:

    : ${EXTRA_CPPFLAGS:="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS"}

    # The EXTRA_CPPFLAGS definition works around a thread race issue in
    # shared_ptr. I encountered this historically and have not verified that
    # the fix is no longer required. Without using the posix thread primitives
    # an invalid compare-and-swap ARM instruction (non-thread-safe) was used for the
    # shared_ptr use count causing nasty and subtle bugs.
    #
    # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS

    We are compiling Boost 1.48 using Xcode 4.5.2 using the Clang compiler.

    What we see is that in thread.cpp, the thread_info object defined on the stack in thread_proxy is being destructed sometimes before the thread is finished running.
    It happens less than 1% of the time, but that can happen pretty quickly in our app.

    We are able to trap this by writing a destructor for thread_data_base as follows:

    thread_data_base::~thread_data_base()
    {
    boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data();
    //debug printf
    //printf("~thread_data_base this=0x%08X, thread_info=0x%08X, self.get=0x%08X\n", (void*)this, (void *)thread_info, (void*)self.get());
    void *void_thread_info = (void *) thread_info;
    void *void_this = (void *) this;
    // is somebody destructing the thread_data other than it's own thread which no longer points to it?
    // we used to compare using if (void_thread_info == void_this), but seemingly it's a bug as long as void_thread_info was not zeroed by the thread_proxy code. There should be no thread_info associated with this thread when the thread_info destructs.
    if (void_thread_info) {
    __builtin_trap();
    }
    }

    We see on the stack that the shared_count goes down to zero and precipitates the release.

    It seems to us that your comment is perhaps very close to this subject.

    Do you have any smart pointers that you can share with us :-) ???

    Thanks!

    ReplyDelete
  58. https://github.com/paleozogt/boostoniphone-generic

    Finally auto detects iPhone SDK version and auto downloads correct tar ball

    ReplyDelete
  59. I solved the problem with shared_ptr.
    The script should be modified to use BOOST_SP_USE_SPINLOCK instead of
    BOOST_SP_USE_PTHREADS and
    BOOST_AC_USE_PTHREADS.
    But there many details beyond that - see here:
    http://stackoverflow.com/questions/14692802/boost-threads-in-ios-thread-info-object-is-being-destructed-before-the-thread.

    ReplyDelete
  60. So helpful. I have bookmarked you and will try this later. Thanks for sharing. en ucuz iphone

    ReplyDelete
  61. Hi all,
    after adding the compilation of the filesystem library, I've the same problem of Rick Boykin

    The issue:

    Undefined symbols for architecture i386:
    "vtable for boost::filesystem::detail::utf8_codecvt_facet", referenced from:

    Is indeed due to having multiple object (.o) files with the same name in the individual boost libraries. To fix it, I modified my copy of the script to rename the .o files prefixing them with the boost library name before aggregating them into a single library. This seems to have worked for me.


    What are the changes to the script to solve the problem?

    Many thanks in advance :-P

    ReplyDelete
  62. Ops... I found this repository of Rick: https://github.com/ptoinson/Boost-Framework-For-iOS

    Seems to be the solution...

    ReplyDelete
  63. This is great. This is working for me. Thanks for sharing your idea. I appreciate your work. telekupon

    ReplyDelete
  64. Hey, Pete, great work and a fun read! I was so entertained, I ordered your book. :-) Got a question for you though. I'm trying to get boost working for a C++ command-line project but my IDE is Xcode. I used MacPorts to install boost and all is well as long as I don't try to build my project. That's when I receive the dreaded Undefined symbols for architecture x86_64 error. I am betwixt and between about which way to go. Should I use your framework or can I build a project for strait up C++ in Xcode?

    ReplyDelete
  65. OK. So, I'm a newbie with boost and I've read enough to be seriously confused. It looks like it's not enough to just install boost with MacPorts but it's also necessary to install boost-jam and build boost using bjam toolset=clang. So, maybe I do need your framework even though my application is not for any mobile device. Thank you in advance for unconfusing me.

    ReplyDelete
  66. If you only ever want to build locally, MacPorts is fine.

    ReplyDelete
  67. If you only ever want to build locally, MacPorts is fine.

    ReplyDelete
  68. Pete, thanks for your excellent work in creating this script and maintaining it to work with the most recent versions of iOS. In my attempt to use it with Boost 1.55.0 for iOS 7.1, I ran into the same filename clashing problem that several other users reported; this error manifests typically with a link error like:

    Undefined symbols for architecture armv7:
    "__ZTVN5boost10filesystem6detail18utf8_codecvt_facetE", referenced from:
    __ZN12_GLOBAL__N_111path_localeEv in boost(path.o)

    An earlier poster, Rick Boykin, fixed this in an earlier version of your script. I made a similar fix to the current version (well, as of 2014-08-07); you can find that version here:

    http://pastebin.com/4KVE48Ci

    ReplyDelete
  69. Scotty, I was working on the same issue for 1.55 - but you provided me with the shortcut. THANKS!!! :)

    ReplyDelete
  70. Precompiled boost libraries for iOS can also be found here https://github.com/danoli3/ofxiOSBoost

    ReplyDelete