Wednesday, August 15, 2012

Installing Boost 1.50+ on OSX

There have been many posts about how to install Boost on OSX most of these deal with older versions or recommend using MacPorts. The difference between this posting is that we are not going to be using MacPorts. MacPorts just copies the headers, it doesn't really build the libraries or if it does I don't know where it stores them.

Things to know:
  1. Boost install comes with the headers, no compilation is needed.
  2. The only things you need to compile are boost thread, signals, things like that.
  3. The only Boost libraries that must be built separately are:
    1. Boost.Filesystem
    2. Boost.GraphParallel
    3. Boost.IOStreams
    4. Boost.MPI
    5. Boost.ProgramOptions
    6. Boost.Python (see the Boost.Python build documentation before building and installing it)
    7. Boost.Regex
    8. Boost.Serialization
    9. Boost.Signals
    10. Boost.System
    11. Boost.Thread
    12. Boost.Wave
Building the boost libraries is pretty easy and straight forward.

Preliminary Steps (Things you need)
- XCode 4.4 or Latest
- XCode Command Line Tools Installed
-- To check do a [Command+, ] and go to the downloads tab.


First steps to installing boost.
  1. Download latest version of the boost zip file and extract it
  2. Extract the file 


boost install path = where you extracted the zip file to.

/[boost install Path]/boost Contains all the headers. Use Termianl to copy the header files to
/usr/local/include/boost [XCode header search path] You will later use this path to set up your boost project in XCode.
sudo mv /[boost install path]/boost /usr/local/include/boost
    3.  Compile the Boost Libraries! Most of the boost scripts are set to read+write only so if you try and compile them by running sudo ./bootstrap.sh you'll see the following error messages,
sudo: ./boostrap.sh: command not found
To overcome this you have to do run the command: chmod u+x *.sh do this in the boost folder and also in [boost install path]/tools/build/v2/engine/

Now the you can compile boostrap.sh. This will build b2. Running ./b2 will compile all the libraries such as threading.

    4. After boostrap has been executed you should see b2. Do a sudo ./b2 and this will create the libraries. Boost libraries will be created in the [boost install path]/stage/lib

Now you are ready for the next step! Adding boost to XCode. 

No comments:

Post a Comment