Build

Why?

Do you really need to build cath-tools, or can you just use the 64-bit Linux executables from DOWNLOADS? Remember to chmod them to be executable (eg chmod +x cath-ssap). If you need cath-tools on a different platform (Windows? Mac?), please consider creating a new GitHub issue; maybe we can work together to set up an automated build.

Requirements

You'll need a fairly good (ie recent) C++ compiler (eg on Ubuntu: sudo apt-get install g++). The code is currently being developed against GCC v4.9.2 and Clang v3.6.0.

To get the source code, you can clone from GitHub (making sure you use the --recursive option so you include bioplib, which we include as a Git submodule to use its superposition routine).

git clone --recursive https://github.com/UCLOrengoGroup/cath-tools.git

If you've already cloned cath-tools without including bioplib, then use:

git submodule update --init --recursive

There are three further dependencies/prerequisites...

Boost ( v1.57.0 / v1.58.0 )

This is used heavily throughout the code. Both headers and compiled library files are needed.

[Ubuntu]
$ sudo apt-get install libboost-all-dev

CMake ( ≥ v2.8.8 )

This is used to build the software.

[Ubuntu]
$ sudo apt-get install cmake

NOTE for UCL SMB users: If running cmake gives you errors like:

cmake: error while loading shared libraries: libssl.so.6: cannot open shared object file: No such file or directory

You probably mixing local/network binaries and libraries so try explicitly running /usr/bin/cmake.

GSL

The GNU Scientific Library is used for its Singular Value Decomposition function (gsl_linalg_SV_decomp()).

apt-get install gsl-bin libgsl2:amd64 libgsl-dbg:amd64 libgsl-dev

Building the Code

Once the dependencies are in place, the code can be built with:

$ cmake -DCMAKE_BUILD_TYPE=RELEASE .
$ make

NOTE: If you have multiple cores, you can make compiling faster by specifying that it may compile up to N sources simultaneously by appending -j [N] to the end of the make command.

With default Ubuntu config, this will build with GCC against GCC's standard library (libstdc++). If you instead want to build with Clang against Clang's standard C++ library (libc++), you'll need a version of Boost built with Clang and libc++. If you have one, then you can build with Clang by adding -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ to the CMake command and build against libc++ by adding -DBOOST_ROOT=ROOT_DIR_OF_YOUR_CLANG_BUILD_OF_BOOST and -DCMAKE_CXX_FLAGS="-stdlib=libc++".

To build against Clang's C++ library (libc++) rather than GCC's (libstdc++), you'll need a version of Boost built with Clang and libc++. If you have one, you can use a cmake command like:

$ cmake -DCMAKE_BUILD_TYPE=RELEASE -DBOOST_ROOT=/opt/boost_1_58_0_clang_build -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_CXX_FLAGS="-stdlib=libc++" ..

Running the Build Tests

Once you've built the binaries, run the build tests to sanity check the build. From the root directory of the project, run build-test and confirm that all tests pass.

(if you mistakenly run build-test from elsewhere, you'll get lots of check_required_files_exist errors).

If your machine has Perl, you can also try running the Perl tests (which includes a run of build-test as one of the tests):

  • Set the environment variable CATH_TOOLS_BIN_DIR to the location of the built binaries
  • From the root directory of the project, run prove -l -v t

Building on CentOS 7 Machines

Install these packages as root:

yum install bzip2-devel cmake git
yum install centos-release-scl-rh
yum install devtoolset-3-gcc devtoolset-3-gcc-c++

Then ssh to the build machine as yourself, find some working directory with at least a few Gb of free space, and then substitute it in for WHATEVER_YOU_HAVE_CHOSEN_AS_YOUR_BUILD_ROOT_DIRECTORY in these commands:

Setup:

scl enable devtoolset-3 bash
export BUILD_ROOT_DIR=WHATEVER_YOU_HAVE_CHOSEN_AS_YOUR_BUILD_ROOT_DIRECTORY

Build Boost:

mkdir -p ${BUILD_ROOT_DIR}/boost_1_58_0_build/{include,lib}
cd ${BUILD_ROOT_DIR}/
wget "http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz"
tar -zxvf boost_1_58_0.tar.gz
cd ${BUILD_ROOT_DIR}/boost_1_58_0/
./bootstrap.sh --prefix=${BUILD_ROOT_DIR}/boost_1_58_0_build
./b2 -j2         --layout=tagged variant=release
./b2 -j2 install --layout=tagged variant=release

Build cath-tools:

cd ${BUILD_ROOT_DIR}/
git clone --recursive https://github.com/UCLOrengoGroup/cath-tools.git

mkdir -p ${BUILD_ROOT_DIR}/cath-tools/gcc_relwithdebinfo/
cd       ${BUILD_ROOT_DIR}/cath-tools/gcc_relwithdebinfo/
/usr/bin/cmake -DCMAKE_BUILD_TYPE=RELEASE -DBOOST_ROOT=${BUILD_ROOT_DIR}/boost_1_58_0_build ..
cd       ${BUILD_ROOT_DIR}/cath-tools/
make -C gcc_relwithdebinfo -k -j2
ls -l ${BUILD_ROOT_DIR}/cath-tools/gcc_relwithdebinfo/

Other Bioplib versions

At present, cath-tools uses bioplib v2.1.2. If you want to try using ≥v3.0, be sure to comment out the line in the Makefile that switches on the use of libxml2:

# Include libxml2
# Note: xml2-config is installed with libxml2
#       Link to libxml2 with -lxml2
COPT := $(COPT) -D XML_SUPPORT $(shell xml2-config --cflags)

(otherwise the build against the bioplib libraries will be broken by unresolved dependencies to libxml2)

For advance building options, see Developers.