Skip to content

4. Prerequisite: configuring and installing G2O

Bruno Silva edited this page Dec 9, 2021 · 3 revisions

Configuring and Installing G2O for RGB-D RTK

Follow this tutorial to install G2O as a prerequisite for RGB-D RTK. The library should be compiled with C++17 and linked against Eigen 3.4.0. The steps below were tested on an Ubuntu 20.04 system.

1. Install all G2O dependencies

sudo apt-get install libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5

2. Download G2O source code

Download the G2O source code. Extract the file to a known directory (e.g. /home/your_user/Lib/g2o/)

3. Install G2O

In a text editor, open the file /home/your_user/Lib/g2o/CMakeLists.txt. Search for the line

set(CMAKE_CXX_STANDARD 11)

and change it to

set(CMAKE_CXX_STANDARD 17)

In the Linux terminal, enter the G2O source code directory (step 2 above). Create the directory in which the binary files will be compiled:

mkdir Release

Enter this directory and run CMake-GUI:

cd Release
cmake-gui ..

Click Configure, select Unix Makefiles, Use default native compilers and click Finish. Wait until the initial CMake configuration for the project finishes. Then, follow these instructions

  • Check the Advanced option and search for EIGEN_INCLUDE_DIR. Change this variable to /usr/local/include/eigen3

Click Configure and wait. Then, click Generate. Close the CMake-GUI window and back in the terminal, compile the G2O source code:

make -j2

This process might take some time to finish. When it does, install the generated libraries into the system directory:

sudo make install