Installing Python and Boost from source to work with ESyS-Particle

Created by Vince Boros on on 2010-08-04
Python Boost ESyS-Particle
Last updated by:
Vince Boros on on 2013-02-05

These notes are for installing Boost 1.45.0 and Python 2.7.1 under $HOME, for which you need the $HOME/bin/, $HOME/lib/ and $HOME/include/ folders. They assume that the Boost and Python builds are under $HOME/boost_1_45_0/ and $HOME/Python-2.7.1/, and that ESyS-Particle source files are under $HOME/esys-particle/source/. Commands that need to be entered follow the ">" symbol which represents the command prompt.

1/ Remove the existing ESyS-Particle installation and build files:
> cd $HOME/esys-particle/source/
> make uninstall
> make distclean

2/ Remove the existing installed Boost include and library files:
> rm -rf $HOME/include/boost/ $HOME/lib/libboost_*

3/ Remove the existing Boost build:
> cd $HOME/boost_1_45_0/
> ./bjam --clean
> rm -rf bin.v2/

4/ Remove the existing Python build:
> cd $HOME/Python-2.7.1/
> make distclean

5/ Add the binary and library paths to PATH, LD_LIBRARY_PATH and LIBRARY_PATH for detecting the Python binary and library and the Boost libraries (if not already added):
> export PATH=$HOME/bin:$PATH
Add these also to the end of $HOME/.bashrc.

6/ Build and install Python:
> cd $HOME/Python-2.7.1/
> ./configure --prefix=$HOME --enable-shared
> make
> make altinstall
The "--enable-shared" option allows installation of the Python library as a shared object. "make altinstall" allows multiple versions of Python to coexist.

7/ Link to Python 2.7, and check the link:
> ln -sf $HOME/bin/python2.7 $HOME/bin/python
> ln -sf $HOME/bin/python2.7-config $HOME/bin/python-config
> ls -l `which python`

8/ Build and install Boost:
> cd $HOME/boost_1_45_0/
> ./ --prefix=$HOME --with-libraries=filesystem,python,regex,system
> ./bjam link=shared install
In the ./ output, check that the correct Python version (2.7) and the correct Python path ($HOME) were detected.

9/ When configuring ESyS-Particle, add the "--with-boost=$HOME" option. If your Boost installation results in nonstandard library names (such as the version of the C++ compiler included as part of the Boost library name), the "--with-boost-filesystem=" and "--with-boost-python=" options will also be needed to configure ESyS-Particle. The string following the "=" symbol needs to be the Boost library name without the initial "lib" string and without the final ".so" extension (for example, --with-boost-python=boost_python-gcc_4_3_3 if the Boost::Python library is called If the configure script cannot find the correct Python library, rerun the script with this additional option (including the quotation marks): LDFLAGS="-L$HOME/lib".