The following instructions have been taken from the wiki page of the original implementation of RGBDSLAM_v2
1. If not using a fresh Ubuntu install, check to make sure you don't already have conflicting version of g2o installed
dpkg -l | grep [Gg]2[Oo]
ls /usr/local/lib
ls /usr/lib | grep [Gg]2[Oo]
Also check /opt/ros/kinetic/lib.
sudo apt-get install libsuitesparse-dev
This will prevent errors mentioning "cholmod" or variations thereof.
Note: g2o will compile without doing this, but you'll have the above error later.
3. Download and extract eigen 3.2.10 header files -- eigen consists only of header files, no binary libs to compile or link against
mkdir ~/rgbdslam_deps
cd ~/rgbdslam_deps
wget http://bitbucket.org/eigen/eigen/get/3.2.10.tar.bz2
mkdir eigen
tar -xvjf 3.2.10.tar.bz2 -C eigen --strip-components 1
Note: No need to make or make install. The header files will be used in place.
cd ~/rgbdslam_deps
git clone https://github.com/felixendres/g2o.git
cd ~/rgbdslam_deps/g2o
mkdir ~/rgbdslam_deps/g2o/build
cd ~/rgbdslam_deps/g2o/build
vi ~/rgbdslam_deps/g2o/CMakeLists.txt
change line 251 from:
SET(G2O_EIGEN3_INCLUDE ${EIGEN3_INCLUDE_DIR} CACHE PATH "Directory of Eigen3")
to:
SET(G2O_EIGEN3_INCLUDE "$ENV{HOME}/rgbdslam_deps/eigen" CACHE PATH "Directory of Eigen3")
Note: Check to make sure the system eigen3 headers are in /usr/include/eigen3.
cd ~/rgbdslam_deps/g2o/build
cmake ../
make
sudo make install
This installs to /usr/local/lib
cd ~/rgbdslam_deps
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz
tar -xvzf pcl-1.8.0.tar.gz
We need to compile pcl with C++ 2011 support because we're going to be compiling rdbgslam with C++ 2011 support and if we don't, rgbdslam will segfault on startup. The PCL 1.7 library that comes installed with Ubuntu 16.04 is not compiled with C++ 2011 support.
cd ~/rgbdslam_deps/pcl-pcl-1.8.0
vi CMakeLists.txt
Add the following to line #146 of CMakeLists.txt (right after endif()):
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
Save the file and exit (:wq).
mkdir build
cd build
cmake ../
To ensure that C++ 2011 support is being compiled into PCL, run:
make VERBOSE=1
Copy some compiler output to a text file and search it to see if it contains "-stdc++11".
If you can't find -stdc++11 in the output, then you probably inserted it into the wrong place in the CMakeLists.txt.
If this happens, press ctrl-c and restart the build with just 'make' to clean up the output.
sudo make install