General concepts » Installation and Setup

How to install and configure Rodin on your system.

This guide will walk you through installing Rodin and setting up your development environment.

System Requirements

Required Dependencies

Rodin requires the following dependencies to be installed on your system:

  • CMake 3.16.0+ - Build system generator
  • C++20 compatible compiler - GCC 12+, Clang 14+, or AppleClang
  • Boost 1.74+ - C++ libraries collection
  • Eigen3 - Linear algebra library

Optional Dependencies

For additional functionality, you may want to install:

  • OpenMP (libomp) - For parallel execution
  • SuiteSparse (libsuitesparse) - For additional linear solvers
  • METIS (libmetis) - For graph partitioning
  • MPI - For distributed computing
  • MMG - For mesh optimization (included as submodule)

Installing Dependencies

Ubuntu/Debian

On Ubuntu or Debian-based systems, install the required dependencies with:

sudo apt-get update
sudo apt-get install cmake libboost-all-dev libeigen3-dev libomp-dev

For optional dependencies:

sudo apt-get install libsuitesparse-dev libmetis-dev libopenmpi-dev

macOS

On macOS, use Homebrew to install dependencies:

brew install cmake boost eigen libomp

For optional dependencies:

brew install suite-sparse metis open-mpi

Installing Rodin

Clone the Repository

First, clone the Rodin repository with all submodules:

git clone --recursive https://github.com/cbritopacheco/rodin.git
cd rodin

Build and Install

Rodin uses CMake as its build system. There are two common installation methods:

User-Local Installation (Recommended)

Install Rodin to your home directory without requiring sudo:

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release
make -j4
make install

Then add to your shell profile (~/.bashrc or ~/.zshrc):

export CMAKE_PREFIX_PATH=$HOME/.local:$CMAKE_PREFIX_PATH

System-Wide Installation

Install Rodin system-wide (requires sudo):

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release
make -j4
sudo make install

Verifying the Installation

After installation, verify that Rodin is working correctly by creating a simple test project.

Create a directory for your test project:

mkdir ~/rodin-test && cd ~/rodin-test

Create a CMakeLists.txt file:

cmake_minimum_required(VERSION 3.16)
project(RodinTest CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Rodin REQUIRED)

add_executable(test_app main.cpp)
target_link_libraries(test_app PRIVATE Rodin::Geometry Rodin::Variational)

Create a main.cpp file:

#include <Rodin/Geometry.h>
#include <Rodin/Variational.h>
#include <iostream>

using namespace Rodin;
using namespace Rodin::Geometry;
using namespace Rodin::Variational;

int main() {
  Mesh mesh;
  mesh = mesh.UniformGrid(Polytope::Type::Triangle, {8, 8});
  mesh.getConnectivity().compute(1, 2);
  P1 Vh(mesh);
  std::cout << "Rodin installation verified!" << std::endl;
  std::cout << "Mesh has " << mesh.getCellCount() << " cells." << std::endl;
  std::cout << "FE space has " << Vh.getSize() << " DOFs." << std::endl;
  return 0;
}

Build and run:

cmake .
make
./test_app

If you see output like:

Rodin installation verified!
Mesh has 128 cells.
FE space has 81 DOFs.

Then your installation is successful!

Troubleshooting

CMake can't find Rodin

If CMake reports that it cannot find the Rodin package, ensure that CMAKE_PREFIX_PATH includes your installation directory:

cmake . -DCMAKE_PREFIX_PATH=/path/to/rodin/installation

Linker Errors

If you encounter linker errors, make sure all required dependencies (Boost, Eigen) are properly installed and visible to CMake.

Compiler Errors

Verify that you're using a C++20 compatible compiler:

g++ --version  # Should be 12.0 or higher
clang++ --version  # Should be 14.0 or higher

What's Next?

Now that you have Rodin installed, proceed to First Steps with Rodin to learn the basic concepts and write your first Rodin program.