Compile on Linux


NOTE: These instructions are for compiling the development branch.

The standard way to build revbayes is to use cmake. If you want to compile using meson, see revbayes/projects/meson/README.md.

Pre-requisites

First you will need to install gcc, cmake and boost

If you have root

Install these using your distribution’s package manager

Ubuntu

sudo apt install build-essential cmake libboost-all-dev

CentOS 8

sudo yum group install "Development Tools"
sudo yum install cmake boost-devel

If you do not have root

You will need your administrator to install build-essential (or equivalent package containing gcc) for you. If possible, ask them to install cmake as well.

If you need to compile CMake yourself:

curl -O -L https://github.com/Kitware/CMake/releases/download/v3.17.0-rc3/cmake-3.17.0-rc3.tar.gz
tar -xzvf cmake-3.17.0-rc3.tar.gz
cd cmake-3.17.0-rc3/
./configure
make

When this is completed, you will notice that there is now a /bin directory in the cmake directory. This contains the cmake executable. You may replace the call to cmake on line 45 of build.sh with this path to use your custom cmake installation.

Then you can compile boost:

curl -O -L https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.gz
tar -xzvf boost_1_71_0.tar.gz
cd boost_1_71_0
./bootstrap.sh --with-libraries=atomic,chrono,filesystem,system,regex,thread,date_time,program_options,math,serialization
./b2 link=static

When it is done, something like the following will be printed. You will need these paths for the next step.

The following directory should be added to compiler include paths:

/root/boost_1_71_0

The following directory should be added to linker library paths:

/root/boost_1_71_0/stage/lib

Compile

Then obtain the source:

git clone --branch development https://github.com/revbayes/revbayes.git revbayes

To compile with system boost:

cd revbayes/projects/cmake
./build.sh

To compile with a locally compiled boost, do the following. Be sure to replace the paths in the build command with those you got from boost in the previous step.

cd revbayes/projects/cmake
./build.sh -boost_root /root/boost_1_71_0 -boost_lib /root/boost_1_71_0/stage/lib

For the MPI version:

./build.sh -mpi true

Note that to compile the MPI version requires that an MPI library is installed. If you have root, openmpi can be install with apt or yum. If not, if can be downloaded and compiled.

A note on compiling RevBayes on high-performance compute clusters

Most high-performance compute clusters have software available as “modules”. Cmake, GCC and boost are all commonly used in computational research. Using the module avail command followed by the name of the library will tell you if there is already a version installed, thus saving you the effort of performing these steps yourself.

Troubleshooting

General

Boost

MPI