sudo apt install libsuitesparse-dev
sudo apt install libspdlog-dev

git clone https://github.com/gabime/spdlog.git -b master
mkdir build
cd build
cmake .. -DSPDLOG_BUILD_SHARED=OFF -DSPDLOG_BUILD_STATIC=ON -DCMAKE_CXX_FLAGS=-fPIC
make
sudo rm /usr/local/lib/libspdlog.a
sudo cp /path/to/spdlog/source/build/libspdlog.a /usr/local/lib/

git clone https://github.com/RainerKuemmerle/g2o.git -b master
mkdir build
cd build
cmake ../
make
sudo make install