pleas install ceres firs. You can follow this website http://www.ceres-solver.org/
sudo apt-get install libboost-all-dev
sudo apt-get install libqglviewer-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libglew-dev
please install g2o. You can follow this one https://github.com/RainerKuemmerle/g2o