Compile on Mac OS X


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

You will need to have C++ compiler installed on your computer. GCC 6 (or higher) and Apple Clang from XCode 11 (or higher) should work. If you don’t have a C++ compiler, you should install Xcode.

You will also need to have CMake (3.5.1 or higher) and Boost (1.74 or higher) installed

Installing pre-requisites with root/administrator priveleges (the usual case)

The typical way to install boost and cmake is to use the homebrew package manager. If homebrew is not already installed, you can install it with:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

You can then use homebrew to install cmake and boost:

brew install cmake boost

Installing pre-requisites without root/administrator priveleges

First you will need to install cmake

Then you can compile boost:

curl -O -L https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz
tar -xzvf boost_1_74_0.tar.gz
cd boost_1_74_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_74_0

The following directory should be added to linker library paths:

/root/boost_1_74_0/stage/lib

Compile

Download RevBayes from our github repository. Clone the repository using git by running the following command in the terminal

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

To compile with the system Boost library:

cd revbayes/projects/cmake
./build.sh

You will likely see some compiler warnings (e.g. clang: warning: optimization flag '-finline-functions' is not supported). This is normal.

To compile revbayes using 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.

./build.sh -boost_root /root/boost_1_74_0 -boost_lib /root/boost_1_74_0/stage/lib

For the MPI version:

./build.sh -mpi true

This produces an executable called rb-mpi.

Note that compiling the MPI version requires that an MPI library is installed.

Troubleshooting

General

Boost