Oh Boost is Boost and Xcode is Xcode and never the twain shall meet

I love the Boost library.  It is without a doubt one of the most important libraries for C++ development.  I use it in practically every program I write.

Right now, I’m working on a Mac, and I wanted to use Xcode for my programming.  Sounds reasonable, really.  It is the Apple tool for it, and since it uses the GCC tools under the hood, I am familiar with error messages and such, so it should be straightforward to use.

It isn’t!

I find it practically impossible to link with Boost.

I’ve installed Boost using the “port” tool, so it is installed the way it would be on e.g. a Linux machine.  That means that the header files are found in /usr/local/include and the libraries in /usr/local/lib.

Setting the path to the header files in Xcode isn’t so much of a problem, but getting it to link with the right library is beyond me.

As far as I’ve figured out, you need to add the right .a file.  Doing this is not so easy, ’cause the GUI won’t let you find /usr/ unless you do a bit of magic to unhide that directory.  If you manage to add the library, at least this is how it works for me, you can build the Release but not the Debug target, and even though you added a .a file, it will link with the corresponding .dynlib file, so you cannot distribute the compiled file without requireing people to have Boost installed.

How does it suck? Let me count the ways…

Tags: , ,

4 Responses to “Oh Boost is Boost and Xcode is Xcode and never the twain shall meet”

  1. Thomas Mailund Says:

    Ahh, this page: http://developer.apple.com/qa/qa2006/qa1393.html explains why it links with the .dynlib file rather than the .a file. Apparently it is a feature. Grrr.

    I still haven’t figured out why I cannot compile to the Debug target…

  2. Reed A. Cartwright Says:

    Wanna do something really cool with Boost?

    Mix it with X-Macros: http://dererumnatura.us/archives/2008/03/leverging-xmacr.html

  3. Thomas Mailund Says:

    Thanks for the link, Reed.

    Incidentally, it was command line option parsing I needed in the program I was working on this time. I use a lot of the libraries in Boost, but this time I was just adding command line options to RapidNJ, a program written by one of our students here at BiRC.

  4. kinary Says:

    thanks for sharing
    i aslo use dsl speed which is an online tool which helps to optimize ur pc performance

Leave a Reply