http://www.mamicode.com/info-detail-1773781.html

安装依赖

安装OpenGL

1. 安装opengl Library
$sudo apt-get install libgl1-mesa-dev
2. 安装opengl utility
$sudo apt-get install libglu1-mesa-dev
3. 安装opengl utility toolkit
$sudo apt-get install freeglut3-dev

安装GLEW

$sudo apt-get install libglew-dev

安装boost

$sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev

安装编译基础库

$sudo apt-get install build-essential

安装Pangolin

1. 下载链接:https://github.com/stevenlovegrove/Pangolin
注:可以使用git进行clone,也可以直接download zip

2. 编译安装步骤
$cd Pangolin
$mkdir build
$cd build
$cmake ..
$make
$sudo make install
$make doc (生成文档)

安装OpenCV

必选依赖:sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
可选依赖:sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
源码下载链接:http://opencv.org/downloads.html (选择2.4.xx,3.x.xx版本都可以,新版本的ORBSLAM2已经支持OpenCV3.xx.xx)
编译安装步骤(以OpenCV2.4.xx为例):
$cd opencv-2.4.xx
$mkdir build
$cd build
$cmake ..
$make
$sudo make install

安装Eigen3

源码下载地址:http://eigen.tuxfamily.org/index.php?title=Main_Page
安装依赖:sudo apt-get install libxmu-dev libxi-dev
编译安装步骤:
$cd eigen
$mkdir build
$cd build
$cmake ..
$make
$sudo make install

安装BLAS and LAPACK库

sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev

编译ORB SLAM2

1. 下载源码

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2

2. 编译

$cd ORB_SLAM2
$chmod +x build.sh
$./build.sh

3. 16.04上编译错误解决

1) OpenCV找不到

错误信息:

Configuring and building Thirdparty/DBoW2 ...
mkdir: cannot create directory ‘build’: File exists
-- OpenCV ARCH: 
-- OpenCV RUNTIME: 
-- OpenCV STATIC: OFF
CMake Warning at /home/melanie/tools/opencv-2.4.13/cmake/OpenCVConfig.cmake:163 (message):
Found OpenCV Windows Pack but it has not binaries compatible with your
configuration.

You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:27 (find_package)

CMake Error at CMakeLists.txt:27 (find_package):
Found package configuration file:

/home/melanie/tools/opencv-2.4.13/cmake/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.

-- Configuring incomplete, errors occurred!
See also "/home/melanie/source/SmartCar/ORM_SLAM2/ORB_SLAM2/Thirdparty/DBoW2/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.

解决方案:
因为我的OpenCV用源码编译安装的路径默认是/usr/local/share/OpenCV/,所以在这里手动给cmake指定OpenCV的路径
修改build.sh如下:
cd Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=/usr/local/share/OpenCV/
make

2)强制类型转换问题

错误信息:

/home/melanie/tools/eigen/Eigen/src/Core/AssignEvaluator.h:817:3: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);
^
CMakeFiles/ORB_SLAM2.dir/build.make:350: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o‘ failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o] Error 1
CMakeFiles/Makefile2:178: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/all‘ failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target ‘all‘ failed
make: *** [all] Error 2

解决方案:

打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,将以下代码
template <typename MatrixType>
class LinearSolverEigen: public LinearSolver<MatrixType>
{
public:
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
typedef Eigen::Triplet<double> Triplet;
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;

修改为:

template <typename MatrixType>
class LinearSolverEigen: public LinearSolver<MatrixType>
{
public:
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
typedef Eigen::Triplet<double> Triplet;
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;

3)usleep未定义:

错误信息:

/home/melanie/source/SmartCar/ORM_SLAM2/ORB_SLAM2/src/Viewer.cc:159:28: error: ‘usleep’ was not declared in this scope
usleep(3000);
^
CMakeFiles/ORB_SLAM2.dir/build.make:494: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o‘ failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o] Error 1
CMakeFiles/Makefile2:178: recipe for target ‘CMakeFiles/ORB_SLAM2.dir/all‘ failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target ‘all‘ failed
make: *** [all] Error 2

解决方案:

在source文件的开头增加include
#include <unistd.h>

需要增加unistd.h的文件有:
Examples/Monocular/mono_euroc.cc
Examples/Monocular/mono_kitti.cc
Examples/Monocular/mono_tum.cc
Examples/RGB-D/rgbd_tum.cc
Examples/Stereo/stereo_euroc.cc
Examples/Stereo/stereo_kitti.cc
src/LocalMapping.cc
src/LoopClosing.cc
src/System.cc
src/Tracking.cc
src/Viewer.cc

4) CUDA错误

安装了CUDA的机器编译的时候会出现CUDA相关错误,修改build.sh如下:
cd Thirdparty/DBoW2
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=/usr/local/share/OpenCV/ -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
make -j
......
echo "Configuring and building ORB_SLAM2 ..."

mkdir build
cd build
-cmake .. -DCMAKE_BUILD_TYPE=Release
+cmake .. -DCMAKE_BUILD_TYPE=Release -DCUDA_USE_STATIC_CUDA_RUNTIME=OFF
make -j

ORB SLAM2在Ubuntu 16.04上的运行配置的更多相关文章

  1. Ubuntu 16.04上安装并配置Postfix作为只发送SMTP服务器

    如果大家已经在使用第三方邮件服务方案发送并收取邮件,则无需运行自己的邮件服务器.然而,如果大家管理一套云服务器,且其中安装的应用需要发送邮件通知,那么运行一套本地只发送SMTP服务器则更为理想. 如何 ...

  2. Ubuntu 16.04上thunderbird配置163邮箱出现“配置无法被验证-请查看用户名或密码是否正确?”

    在Ubuntu 16.04 上用thunderbird配置163免费邮箱时出现的提示信息如图1: 图1 提示信息 网上有不少方法都说是将接收和发出的主机名分别改为 imap.ym.163.com 和 ...

  3. 如何在Ubuntu 16.04上安装配置Redis

    如何在Ubuntu 16.04上安装配置Redis Redis是一个内存中的键值存储,以其灵活性,性能和广泛的语言支持而闻名.在本指南中,我们将演示如何在Ubuntu 16.04服务器上安装和配置Re ...

  4. 在 Ubuntu 16.04上安装 vsFTPd

    在 Ubuntu 16.04上安装 vsFTPd Ubuntu vsFTPd 关于 vsFTPd vsFTPd 代表 Very Secure File Transfer Protocol Daemon ...

  5. (译)综合指南:通过Ubuntu 16.04上从Source构建来安装支持GPU的Caffe2

    (译)综合指南:通过Ubuntu 16.04上从Source构建来安装支持GPU的Caffe2 译者注: 原文来自:https://tech.amikelive.com/node-706/compre ...

  6. [eShopOnContainers 学习系列] - 03 - 在远程 Ubuntu 16.04 上配置开发环境

    直接把 md 粘出来了,博客园的富文本编辑器换成 markdown,没啥效果呀 ,先凑合吧.实在不行换地方   # 在远程 Ubuntu 16.04 上配置开发环境 ## 零.因 为什么要用这么麻烦的 ...

  7. 在 Ubuntu 16.04 上安装 Eclipse Oxygen

    2017 年 6 月 28 日,Eclipse 社区(the Eclipse Community)发布了 Eclipse Oxygen.本文记录了我在 Ubuntu 16.04 上安装 Eclipse ...

  8. Ubuntu 16.04上安装SkyEye及测试

    说明一下,在Ubuntu 16.04上安装SkyEye方法不是原创,是来自互联网,仅供学习参考. 一.检查支持软件包 gcc,make,vim(optional),ssh,subversionbinu ...

  9. 如何在Ubuntu 16.04上安装Apache Web服务器

    转载自:https://www.howtoing.com/how-to-install-the-apache-web-server-on-ubuntu-16-04 介绍 Apache HTTP服务器是 ...

随机推荐

  1. 【ibatis】IBatis的SQL批量操作

    1.Ibatis批量添加(传入class的list即可) <insert id="Add" resultMap="Select" parameterCla ...

  2. ifream框架角色切换

    js受制于单个页面,用ifream框架做web系统,会遇到角色切换菜单刷新的问题,我就来讲一下我的思路: 用户登录时将用户角色放入session中,以角色id为key,权限为值,角色切换时将相应角色i ...

  3. Spring boot 入门五:springboot 开启声明式事务

    springboot开启事务很简单,只需要一个注解@Transactional 就可以了.因为在springboot中已经默认对jpa.jdbc.mybatis开启了事务.这里以spring整合myb ...

  4. H5 页面下拉加载更多

    1.html页面: <body onload="index_roll()"> ... </body> 2.js <script type=" ...

  5. 第三十三天- 线程创建、join、守护线程、死锁

    1.线程,线程创建 概念:在传统操作系统中,每个进程有一个地址空间,而且默认就有一个控制线程,线程顾名思义,就是一条流水线工作的过程,一条流水线必须属于一个车间,一个车间的工作过程是一个进程,车间负责 ...

  6. 2016计蒜之道复赛 百度地图的实时路况(Floyd 分治)

    题意 题目链接 Sol 首先一个结论:floyd算法的正确性与最外层\(k\)的顺序无关(只要保证是排列即可) 我大概想到一种证明方式就是把最短路树上的链拿出来,不论怎样枚举都会合并其中的两段,所以正 ...

  7. R中的空间数据分析

    > library(sp) > library(maptools) > library(raster) > library(rgeos) > maxd3 = readAs ...

  8. python 日志打印之logging使用介绍

    python 日志打印之logging使用介绍 by:授客QQ:1033553122 测试环境: Python版本:Python 2.7   简单的将日志打印到屏幕 import logging lo ...

  9. Adapter中用不了getWindowManager()

    在写popupwindow的时候一般会获取屏幕的宽高来设置popupwindow的宽高,但是在adapter中用不了getWindowManager(), 但是为什么Activity中就可以用getW ...

  10. Android网络编程系列之HTTP协议原理总结

    前言 作为搞移动开发的我们,免不了与网络交互打交道.虽然市面上很多开源库都封装的比较到位,我们实现网络访问也轻车熟路.但还是十分有必要简要了解一下其中的原理,以便做到得心应手,也是通往高级开发工程师甚 ...