1、首先在github上下载g2o图优化库
git clone https://github.com/RainerKuemmerle/g2o.git
2、运行安装以下依赖库
sudo apt-get install libcholmod3.0.6 sudo apt-get install libsuitesparse-dev sudo apt-get install freeglut3 freeglut3-dev freeglut3-dbg sudo apt-get install libqglviewer2 libqglviewer-dev libqglviewer-doc sudo apt-get install libeigen3-dev libeigen3-doc
3、开始安装g2o,先进入g2o的目录内,然后开启终端,依次运行下列命令:
mkdir build cd build/ cmake .. make sudo make install
至此,g2o图优化库安装完毕!