Skip to content

Compiling in Scientific Linux 6.5

Andrew Champion edited this page May 12, 2015 · 5 revisions

When compiling python-sopnet on Scientific Linux (or CentOS) 6.x, some dependencies cause problems because the versions available via yum are not new enough:

  • gcc >= 4.8.x
  • python >= 2.7
  • boost >= 1.49
  • HDF5

This page gives options for satisfying each of these dependencies, then a list of additional dependencies available through yum at the end. Note that these instructions are for a minimal build and do not include several dependencies necessary for a fully functional CATSOP:

  • PostgreSQL >= 9.3
  • Gurobi >= 5

gcc

Python-sopnet will not compile with gcc 4.4.7 provided by the repositories. The easiest way to obtain a recent version of gcc is through the CERN's Developer Toolset repositories. While Developer Toolset 2.1 provides a sufficiently new gcc and git version, Developer Toolset 3.0 also provides python 2.7, saving the work of compiling it oneself.

To install Developer Toolset 3.0:

wget http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo -O /etc/yum.repos.d/slc6-scl.repo
yum install devtoolset-3
scl enable devtoolset-3 bash

gcc -v should now show version 4.9.1.

python

If you chose to install Developer Toolset 3.0, simply run:

yum install python27
scl enable python27 bash

If you chose to install Developer Toolset 2.1 instead of 3.0 or installed gcc through another means, you must compile python 2.7 yourself. Following this guide:

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

boost

Both yum and the Developer Toolsets provide an outdated version of boost, 1.41. Python-sopnet requires at least 1.49. Travis-CI runs 1.48, and most of the active developers use 1.55 (the default in Ubuntu 14.04). You can compile whatever recent version you prefer, but the example below uses 1.55 for consistency:

wget http://sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz
tar -xzvf boost_1_55_0.tar.gz
cd boost_1_55_0
./bootstrap.sh --prefix=/usr/local
./b2 install --with=all

Note that python must be installed (and enabled through scl, if applicable) before compiling boost in order for boost-python to be built and installed.

HDF5

You can either use a prebuilt binary RPM (recommended) or compile from source:

wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.14.tar.gz
tar -xzvf hdf5-1.8.14.tar.gz
cd hdf5-1.8.14
./configure ----prefix=/usr/local/hdf5 --enable-cxx --enable-hl
make
make check
make install
make check-install

Additional Dependencies

Once you have installed gcc, python and boost, the rest of the dependencies are available through yum:

yum install git cmake ImageMagick-c++-devel libcurl-devel libpng-devel

Compiling python-sopnet

To compile and test python-sopnet, first you need to tell CMake where to find some of the libraries you just installed. From the instructions above with Developer Toolset 3, this would be something like:

export CMAKE_PREFIX_PATH=/usr/local:/usr/local/hdf5:/opt/rh/python27/$USER/usr/

But these paths can vary. Then run from the root of your python-sopnet git repository:

mkdir -p build
cd build
cmake ..
make

You can run a simple test binary on the compiled python-sopnet:

cd ../test/slices
./coresolvertest --disableSegment --disableSolution
Clone this wiki locally