Differences between revisions 1 and 2
Revision 1 as of 2009-06-13 02:30:54
Size: 3552
Editor: ip68-9-132-118
Comment:
Revision 2 as of 2009-06-13 02:44:44
Size: 3616
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
These instructions will help you install the [Boost C++ libraries](http://www.boost.org) on a Linux system. If you already have them installed, make sure that it's the version required by the software you would like to use. If not, no problem, we'll build it now. Before you start, make sure you have the Python headers (i.e. development information) installed. Your operating system may call this package something like `python-dev` or `python-devel`. Next, [download](http://boost.org/users/download/) the boost release tar.bz2 file. == Step 1: Install Boost ==

These instructions will help you install the [[[http://www.boost.org|Boost C++ libraries]]] on a Linux system. If you already have them installed, make sure that it's the version required by the software you would like to use. If not, no problem, we'll build it now. Before you start, make sure you have the Python headers (i.e. development information) installed. Your operating system may call this package something like `python-dev` or `python-devel`. Next, [[[http://boost.org/users/download/|download]]] the boost release tar.bz2 file.
Line 19: Line 21:
root privileges *if* you are using a Python interpreter that is root privileges ''if'' you are using a Python interpreter that is
Line 26: Line 28:
{{{#!wiki caution
Please make sure that the Boost.Python configuration process finds the version of Python you intend to use. It is output during the configure/make stage.
{{{#!wiki note
Please make sure that the Boost.Python configuration process finds the version
of Python you intend to use. It is output during the configure/make stage.
Line 32: Line 35:
    ...failed updating 30 targets...
    ...skipped 2 targets...
{{{
...failed updating 30 targets...
...skipped 2 targets...
}}}
Line 35: Line 40:
at the end of the build process, please double-check that you have the
Python headers installed. If you failed fewer targets (up to 5),
you're probably ok for most of my packages, but you might still want to install `libz-dev` and `libbz2-dev` for that "perfect score".
at the end of the build process, please double-check that you have the Python
headers installed. If you failed fewer targets (up to 5), you're probably ok
for most of my packages, but you might still want to install `libz-dev` and
`libbz2-dev` for that "perfect score".
Line 39: Line 45:
# Step 2: Tell the Dynamic Linker about Boost == Step 2: Tell the Dynamic Linker about Boost ==
Line 44: Line 50:
    export LD_LIBRARY_PATH=$HOME/pool/lib:${LD_LIBRARY_PATH} {{{
export LD_LIBRARY_PATH=$HOME/pool/lib:${LD_LIBRARY_PATH}
}}}
Line 48: Line 56:
    setenv LD_LIBRARY_PATH $HOME/pool/lib:${LD_LIBRARY_PATH} {{{
setenv LD_LIBRARY_PATH $HOME/pool/lib:${LD_LIBRARY_PATH}
}}}
Line 54: Line 64:
    ...gibberish...
    ImportError: libboost_python-gcc42-mt-1_35.so.1.35.0:
    cannot open shared object file: No such file or directory
    ...gibberish...
{{{
...gibberish...
ImportError: libboost_python-gcc42-mt-1_35.so.1.35.0:
cannot open shared object file: No such file or directory
...gibberish...
}}}
Line 59: Line 71:
# Speeding up the build == Speeding up the build ==
Line 61: Line 73:
Boost is seen by many as a rather heavy-weight dependency. This is view is understandable given the rather voluminous download and long build time. At its core, however, Boost is a very modular library that consists of many components that each perform one job very well. Boost is seen by many as a rather heavy-weight dependency. This is view is
understandable given the rather voluminous download and long build time. At its
core, however, Boost is a very modular library that consists of many components
that each perform one job very well.
Line 63: Line 78:
While there are efforts underway to split up boost into more manageable downloads, here's a trick that can be used to cut down Boost's build time to about a minute on a modern machine: While there are efforts underway to split up boost into more manageable
downloads, here's a trick that can be used to cut down Boost's build time to
about a minute on a modern machine:
Line 65: Line 82:
* Run Boost's `./configure` script as above.  * Run Boost's `./configure` script as above.
Line 67: Line 84:
* Edit the generated `Makefile` and remove the line `BJAM_CONFIG = <empty>`.  * Edit the generated `Makefile` and remove the line `BJAM_CONFIG = <empty>`.
Line 69: Line 86:
* Start the build with  * Start the build with
 {{{
 BJAM_CONFIG="-j4 variant=release link=shared" make install
 }}}
Line 71: Line 91:
        BJAM_CONFIG="-j4 variant=release link=shared" make install
  
 
where you replace the '4' by the number of CPUs you would like to use for the build.
 where you replace the '4' by the number of CPUs you would like to use for the build.
Line 77: Line 95:
* It prevents Boost from building itself four times over. Boost (unwisely) defaults to building itself in every combination of {shared,static} linking and {debug,non-debug} builds. This is usually unnecessary and wastes time and space.
* It makes use of all cores present in a machine.
 * It prevents Boost from building itself four times over. Boost (unwisely) defaults to building itself in every combination of {shared,static} linking and {debug,non-debug} builds. This is usually unnecessary and wastes time and space.
 * It makes use of all cores present in a machine.

Boost Installation Howto

Step 1: Install Boost

These instructions will help you install the Boost C++ libraries] on a Linux system. If you already have them installed, make sure that it's the version required by the software you would like to use. If not, no problem, we'll build it now. Before you start, make sure you have the Python headers (i.e. development information) installed. Your operating system may call this package something like python-dev or python-devel. Next, download] the boost release tar.bz2 file. Then, do this:

$ tar xfj ~/download/boost_1_37_0.tar.bz2
$ cd boost_1_37_0
$ ./configure --prefix=$HOME/pool
$ make
$ make install

(Whenever you see the "$" dollar sign, this means you should enter the subsequent text at your shell prompt. You don't have to be root. A few spots are marked with "sudo" to show that these *do* require root privileges if you are using a Python interpreter that is installed globally.)

You may adapt the file and directory names to suit your liking, however the rest of this tutorial will assume that you use these paths.

Please make sure that the Boost.Python configuration process finds the version of Python you intend to use. It is output during the configure/make stage.

If you see something like:

...failed updating 30 targets...
...skipped 2 targets...

at the end of the build process, please double-check that you have the Python headers installed. If you failed fewer targets (up to 5), you're probably ok for most of my packages, but you might still want to install libz-dev and libbz2-dev for that "perfect score".

Step 2: Tell the Dynamic Linker about Boost

If you use a bash or /bin/sh or another POSIX-compliant shell, use this command:

export LD_LIBRARY_PATH=$HOME/pool/lib:${LD_LIBRARY_PATH}

or, if you are still using a C Shell, use this:

setenv LD_LIBRARY_PATH $HOME/pool/lib:${LD_LIBRARY_PATH}

You might want to put this command in your startup script, so you don't have to type this over and over. If you forget this step, you will see errors like this one later on::

...gibberish...
ImportError: libboost_python-gcc42-mt-1_35.so.1.35.0: 
cannot open shared object file: No such file or directory
...gibberish...

Speeding up the build

Boost is seen by many as a rather heavy-weight dependency. This is view is understandable given the rather voluminous download and long build time. At its core, however, Boost is a very modular library that consists of many components that each perform one job very well.

While there are efforts underway to split up boost into more manageable downloads, here's a trick that can be used to cut down Boost's build time to about a minute on a modern machine:

  • Run Boost's ./configure script as above.

  • Edit the generated Makefile and remove the line BJAM_CONFIG = <empty>.

  • Start the build with
     BJAM_CONFIG="-j4 variant=release link=shared" make install
    where you replace the '4' by the number of CPUs you would like to use for the build.

This trick employs two techniques to speed up the build:

  • It prevents Boost from building itself four times over. Boost (unwisely) defaults to building itself in every combination of {shared,static} linking and {debug,non-debug} builds. This is usually unnecessary and wastes time and space.
  • It makes use of all cores present in a machine.

BoostInstallationHowto/Version1.38AndBelow (last edited 2009-06-14 15:16:45 by AndreasKloeckner)