Ubuntu18.04安装gtsam因子图步骤及踩坑忠告
我尝试安装gtsam库一天,最终把坑填了,都是泪啊啊。。。。
一、官网上的安装步骤(失败经验,可跳过)
1、首先安装依赖项:Boost,Cmake,gcc(其中gcc系统一般自带)
Prerequisites:
Boost >= 1.43 (Ubuntu: sudo apt-get install libboost-all-dev)
CMake >= 3.0 (Ubuntu: sudo apt-get install cmake)
A modern compiler, i.e., at least gcc 4.7.3 on Linux.
以下是可选项:(我只选了第一项)
Optional prerequisites - used automatically if findable by CMake:
Intel Threaded Building Blocks (TBB) (Ubuntu: sudo apt-get install libtbb-dev)
Intel Math Kernel Library (MKL) (Ubuntu: installing using APT)
See INSTALL.md for more installation information
Note that MKL may not provide a speedup in all cases. Make sure to benchmark your problem with and without MKL.
也就是输入
sudo apt-get install libboost-all-dev
sudo apt-get install cmake
sudo apt-get install libtbb-dev
2、下载官网上的压缩包,解压
https://research.cc.gatech.edu/borg/download?destination=node%2F299
3、正常的Cmake步骤,在解压后的文件夹右键进入终端,执行
$ mkdir build
$ cd build
$ cmake ..
$ make check (optional, runs unit tests)
$ sudo make install
这里有个巨坑,官网上的代码好像在Ubuntu18.04上有bug,死活编译不通过。。。
提示错误:
error: static assertion failed: binding rvalue references to optional lvalue
我怀疑是对Boost库的调用有点问题,但我不会排查。在这里折腾了一天,重装、重新下载等等都试过,在卸载Boost库的时候还把ROS跟一起卸了,啊啊啊,就是不行。。。(大佬指正)
二、成功安装的步骤
1、正常按官网安装依赖项
sudo apt-get install libboost-all-dev
sudo apt-get install cmake
sudo apt-get install libtbb-dev
MKL我没选,需要的话按官网安装。
2、不从官网下载压缩包,而是从一个网站git下来(视觉SLAM十四讲 高翔)
git clone https://bitbucket.org/gtborg/gtsam.git
cd gtsam/
mkdir build &&cd build
cmake ..
make check
sudo make install
最后终于成功了!!![感动][感动]!!