Slam学习--Ubuntu 20.04 gtsam编译与安装

目录

What is GTSAM?

快速开始

MKL安装

下载gtsam源码并编译


What is GTSAM?

GTSAM is a library of C++ classes that implement smoothing and mapping (SAM) in robotics and vision, using factor graphs and Bayes networks as the underlying computing paradigm rather than sparse matrices.

On top of the C++ library, GTSAM includes a MATLAB interface (enable GTSAM_INSTALL_MATLAB_TOOLBOX in CMake to build it). A Python interface is under development.

快速开始

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.
  • Intel Threaded Building Blocks (TBB) 安装
  • sudo apt-get install libtbb-dev)
  • Intel Math Kernel Library (MKL)
    • 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.

MKL安装

 安装特定版本 模板:

sudo apt-get install -.-

 <>中对应的参数在指导网页中寻找对应版本

 安装指导网页:

https://software.intel.com/content/www/us/en/develop/articles/installing-intel-free-libs-and-python-apt-repo.html

一键安装指令 示例:

sudo apt-get install intel-mkl-2018.2-046

下载gtsam源码并编译

git clone https://bitbucket.org/gtborg/gtsam.git

编译

In the root library folder execute:

#!bash
$ mkdir build
$ cd build
$ cmake ..
$ make check (optional, runs unit tests)
$ sudo make install  (增加sudo 避免安装过程中出现权限不足问题)

编译中出现的错误

CMake Error at wrap/CMakeLists.txt:29 (target_link_libraries):
  The "debug" argument must be followed by a library.

在相应的cmakelist文件中将

set(WRAP_BOOST_LIBRARIES
  optimized
    ${Boost_FILESYSTEM_LIBRARY_RELEASE}
    ${Boost_SYSTEM_LIBRARY_RELEASE}
    ${Boost_THREAD_LIBRARY_RELEASE}
  debug
    ${Boost_FILESYSTEM_LIBRARY_DEBUG}
    ${Boost_SYSTEM_LIBRARY_DEBUG}
    ${Boost_THREAD_LIBRARY_DEBUG}
)

中的

  debug
    ${Boost_FILESYSTEM_LIBRARY_DEBUG}
    ${Boost_SYSTEM_LIBRARY_DEBUG}
    ${Boost_THREAD_LIBRARY_DEBUG}

删除或者注释即可


再次编译其他CMakeList文件仍然出现同样的错误

CMake Error at gtsam/CMakeLists.txt:105 (target_link_libraries):
  The "debug" argument must be followed by a library.

注释或删掉CMakeList文件中的174-180行代码 :
  debug
    ${Boost_SERIALIZATION_LIBRARY_DEBUG}
    ${Boost_SYSTEM_LIBRARY_DEBUG}
    ${Boost_FILESYSTEM_LIBRARY_DEBUG}
    ${Boost_THREAD_LIBRARY_DEBUG}
    ${Boost_DATE_TIME_LIBRARY_DEBUG}
    ${Boost_REGEX_LIBRARY_DEBUG}
以及186-188行

        debug
          ${Boost_TIMER_LIBRARY_DEBUG}
          ${Boost_CHRONO_LIBRARY_DEBUG}

修改以上两个文件后,编译即可通过

编译完后

用make install安装可能出现权限问题:

Install the project...

-- Install configuration: ""

CMake Error at cmake_install.cmake:41 (file):

file cannot create directory: /usr/local/doc/cmake-3.14.  Maybe need  administrative privileges.
将make install 改为 sudo make install 即可

参考博客

gtsam安装:https://www.cnblogs.com/long5683/p/13930079.html

编译错误解决:https://blog.csdn.net/weixin_47451478/article/details/116780428

你可能感兴趣的:(Slam,linux,c++,ubuntu)