slambook2(#%)—— Ubuntu18.04安装(高翔)第二版SLAM十四讲的所有库

slambook2(#%)—— Ubuntu18.04安装(高翔)第二版SLAM十四讲的所有库

  • 1.安装git
  • 2.安装c++编译器
  • 3.cmake源码安装
  • 4.安装Kdevelop
  • 5.安装Eigen库
  • 6.安装Pangolin
  • 7.安装高版本eigen库
  • 8.安装Sophus库(模板类)
  • 9.安装“fmt”库
  • 10.安装openCV3.2.0库
  • 11.安装Ceres库
  • 12.安装g2o
  • 13.安装openCV4.5.2
  • 14.安装MeshLab
  • 15.安装g2o_viewer
  • 16.安装DBoW3
  • 17.安装pcl库
  • 18.安装octomap
  • 19.安装 GFlags
  • 20.安装 GLog
  • 21.安装gtest

本文只是一些简单的安装命令,不同的运行环境可能导致不同的安装结果,安装的过程中可能会出现些许错误,更完整的安装过程请看我其他博客, 第二版的SLAM十四讲完整的例程我都有复现,其中有好多都是我踩的坑,希望对你有帮助!!!!
安装环境: Ubuntu 18.04

1.安装git

sudo apt install git

2.安装c++编译器

sudo apt install g++

3.cmake源码安装

sudo apt install build-essential libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4.tar.gz
tar -zxvf cmake-3.18.4.tar.gz
cd cmake-3.18.4
./bootstrap
make
sudo make install
# 查看版本
cmake -version

4.安装Kdevelop

sudo apt-get install kdevelop

5.安装Eigen库

# 版本不是很高,后续有高版本的方法
sudo apt-get install libeigen3-dev
sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen

6.安装Pangolin

安装Pangolin所需依赖
sudo apt install libgl1-mesa-dev
sudo apt install libglew-dev
sudo apt install cmake //注意以前装了就不需要安装了
sudo apt install libpython2.7-dev
sudo apt install python-pip
sudo python -mpip install numpy pyopengl Pillow pybind11
sudo apt install pkg-config
sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols
sudo apt install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
sudo apt install libdc1394-22-dev libraw1394-dev
sudo apt install libjpeg-dev libpng-dev libtiff5-dev libopenexr-dev
# 默认git版本为0.6
git clone https://github.com/stevenlovegrove/Pangolin.git      
cd Pangolin
mkdir build && cd build
cmake ..
make -j
sudo make install

7.安装高版本eigen库

# 安装eigen3.3以上版本
# 去官网下载安装,具体步骤如下:http://eigen.tuxfamily.org/index.php?title=Main_Page
# 1.下载安装包:eigen-版本号.tar.bz2 ,然后提取到此处
# 2.进入文件夹eigen-版本号,右键在终端打开。
# 3.进行安装
mkdir build
cd build
cmake ..
sudo make install

8.安装Sophus库(模板类)

git clone https://github.com/strasdat/Sophus.git
cd Sophus/

mkdir build
cd build
cmake ..
make
sudo make install

9.安装“fmt”库

git clone  https://github.com/fmtlib/fmt.git
cd fmt

mkdir build
cd build
cmake ..
make
sudo make install

10.安装openCV3.2.0库

sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt upgrade
sudo apt install libjasper1 libjasper-dev

# 依赖项
sudo apt-get install build-essential libgtk2.0-dev libvtk6-dev libjpeg-dev libtiff5-dev libopenexr-dev libtbb-dev
# 下载opecv包,并提取到某位置,进行安装
# https://codeload.github.com/opencv/opencv/zip/3.2.0
# 安装
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/opencv3 ..
make -j4
sudo make install

具体安装过程看我的另外一篇博客

11.安装Ceres库

sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev

git clone https://github.com/ceres-solver/ceres-solver.git

cd ceres-solver
mkdir build
cd build
cmake ..
make -j4
sudo make install

12.安装g2o

sudo apt-get install qt5-qmake qt5-default libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3

git clone https://github.com/RainerKuemmerle/g2o   # 克隆最新版本g2o
cd g2o
mkdir build
cd build
cmake ..
make -j6      # 注意,这里尽量使用更多的j,否则g2o安装很慢(-j4  -j6等等)
sudo make install

13.安装openCV4.5.2

# 安装opencv4(与opencv3共存的情况下)
sudo apt-get install build-essential libgtk2.0-dev libgtk-3-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt install python3-dev python3-numpy
sudo apt install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
sudo apt install libpng-dev libopenexr-dev libtiff-dev libwebp-dev

#下载安装包:https://opencv.org/releases/

# 提取,然后进入解压后的文件夹,在终端打开
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_GENERATE_PKGCONFIG=ON -D CMAKE_INSTALL_PREFIX=/usr/local/opencv4 ..
make -j4
sudo make install

14.安装MeshLab

sudo add-apt-repository ppa:zarquon42/meshlab
#####   然后按Enter键,继续
sudo apt-get install meshlab

15.安装g2o_viewer

sudo apt-get install libeigen3-dev libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev

进入到g2o/build下面,打开终端:
cmake ..
make -j4
sudo make install

16.安装DBoW3

git clone https://github.com/rmsalinas/DBow3
mkdir build
cd build
cmake ..
make -j4
sudo make install

17.安装pcl库

sudo apt-get install libpcl-dev pcl-tools

18.安装octomap

sudo apt-get install liboctomap-dev octovis

19.安装 GFlags

运行如下指令:

git clone https://github.com/gflags/gflags.git
cd gflags
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON -DGFLAGS_NAMESPACE=gflags ../ 
make -j4
sudo make install

20.安装 GLog

git clone https://ghproxy.com/https://github.com/google/glog
sudo apt-get install autoconf automake libtool
cd glog
mkdir build
cd build
cmake ..
make
sudo make install

初次编译glog时如果出错,如下图所示,网上搜索解决方案,需要把glfag编译成动态库或者使用apt-get方法进行安装。

重新执行gflags的安装过程,将gflag编译成动态链接库

cmake -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DINSTALL_HEADERS=ON -DINSTALL_SHARED_LIBS=ON -DINSTALL_STATIC_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/ ..

21.安装gtest

方法一:
查找是否存在gtest文件

cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp *.a /usr/lib

方法二:

git clone https://ghproxy.com/https://github.com/google/googletest.git
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install

你可能感兴趣的:(slambook2,实践复现,自动驾驶,c++,slam,ubuntu)