在Ubuntu KyLin 16.04上安装g2o

原创 2016年10月22日 20:25:28

1.首先确保你已经安装了最新版本的cmake。

验证方法:在终端输入:cmake -version即

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~$ cmake -version
cmake version 3.5.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

就可以看到自己的版本了。

2.以源代码安装的形式安装g2o。

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~$ git clone https://github.com/RainerKuemmerle/g2o.git

默认是装在用户主目录下的,其目录名为g2o。

进入g2o:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~$ cd ~/g2o

显示如下:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o$

在g2o目录下创建一个新的名字为build的子目录,并进入build;

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o$  mkdir build

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o$  cd build

显示如下:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o/build$

安装一些依赖项:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o/build$  sudo apt-get install build-essential cmake libcholmod2.1.2 libsuitesparse-metis-3.1.0 libsuitesparse-metis-dbg libsuitesparse-metis-dev freeglut3 freeglut3-dev freeglut3-dbg qt4-qmake libqglviewer2 libqglviewer-dev libqglviewer-doc libeigen3-dev libeigen3-doc

其中libcholmod2.1.2 libsuitesparse-metis-3.1.0 libsuitesparse-metis-dbg libsuitesparse-metis-dev在Ubuntu 16.04中装不了,可用其他相关的package代替。那么怎么找出这些相关的package呢?

可以使用apt-cache search <package_name>寻找。

例如在终端输入

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o/build$ apt-cache search libcholmod,

这时终端显示:
libcholmod3.0.6 - sparse Cholesky factorization library for sparse matrices
这时可以安装libcholmod3.0.6代替libcholmod2.1.2。名字里有libsuitesparse的依赖项也类似操作

依赖项都安装完后,执行:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o/build$ cmake ..

则终端会显示如下类似内容:

--The C compiler identification is GNU 4.8.2

--The CXX compiler identification is GNU 4.8.2

--Check for working C compiler: /usr/bin/cc

--Check for working C compiler: /usr/bin/cc -- works

--Detecting C compiler ABI info

--Detecting C compiler ABI info - done

--Check for working CXX compiler: /usr/bin/c++

--Check for working CXX compiler: /usr/bin/c++ -- works

--Detecting CXX compiler ABI info

--Detecting CXX compiler ABI info - done

--Compiling on Unix

--Found CHOLMOD: /usr/include/suitesparse 

--Looking for sgemm_

--Looking for sgemm_ - found

--A library with BLAS API found.

--Looking for cheev_

--Looking for cheev_ - found

--A library with LAPACK API found.

--Found CHOLMOD and its dependencies

--Found CSPARSE: /usr/include/suitesparse 

--Try OpenMP C flag = [-fopenmp]

--Performing Test OpenMP_FLAG_DETECTED

--Performing Test OpenMP_FLAG_DETECTED - Success

--Try OpenMP CXX flag = [-fopenmp]

--Performing Test OpenMP_FLAG_DETECTED

--Performing Test OpenMP_FLAG_DETECTED - Success

--Found OpenMP: -fopenmp 

--Looking for XOpenDisplay in/usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so

--Looking for XOpenDisplay in/usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so- found

--Looking for gethostbyname

--Looking for gethostbyname - found

--Looking for connect

--Looking for connect - found

--Looking for remove

--Looking for remove - found

--Looking for shmat

--Looking for shmat - found

--Looking for IceConnectionNumber in ICE

--Looking for IceConnectionNumber in ICE - found

--Found X11: /usr/lib/x86_64-linux-gnu/libX11.so

--Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so 

--Compiling with OpenGL support

--Looking for Q_WS_X11

--Looking for Q_WS_X11 - found

--Looking for Q_WS_WIN

--Looking for Q_WS_WIN - not found

--Looking for Q_WS_QWS

--Looking for Q_WS_QWS - not found

--Looking for Q_WS_MAC

--Looking for Q_WS_MAC - not found

--Found Qt4: /usr/bin/qmake (found version "4.8.6")

--Found QGLVIEWER: /usr/include/QGLViewer 

--Compiling g2o apps

--Compiling g2o examples

--Compiling with GCC

--Performing Test COMPILER_SUPPORTS_CXX11

--Performing Test COMPILER_SUPPORTS_CXX11 - Success

--Performing Test COMPILER_SUPPORTS_CXX0X

--Performing Test COMPILER_SUPPORTS_CXX0X - Success

--Found Eigen3: /usr/include/eigen3 (Required is at least version"2.91.0")

--Configuring done

--Generating done

--Build files have been written to: /home/zhuquan/g2o/build


然后在终端输入make:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o/build$ make


最后,在终端输入sudo make install 安装:

zhuquan@zhuquan-HP-Z230-Tower-Workstation:~/g2o/build$ sudo make install

如果编译没有出错,就会在/usr/local/include看到g2o的包含文件,在usr/local/lib看到g2o的库文件,在usr/local/bin看到g2o的可执行文件。

Finally, 卸载g2o

[plain] view plain copy
  1. sudo rm -r /usr/local/lib/libg2o* /usr/local/include/g2o /usr/local/lib/g2o /usr/local/bin/g2o*  

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhuquan945/article/details/52894528

g2o在ubuntu16.04安装及初步使用

转载自:http://www.linuxdiyf.com/linux/25329.html       http://blog.csdn.net/jasmine_shine/article/detai...
  • zpp13hao1
  • zpp13hao1
  • 2016-12-30 14:24:45
  • 3589

在Ubuntu 16.04下安装g2o

在Ubuntu 16.04下安装g2o
  • jz1570551401
  • jz1570551401
  • 2017-10-11 21:22:49
  • 439

ubuntu 16.04 编译安装g2o出错的解决方案

在学习高博的《一起做RGB-D SLAM》第六讲的时候,按照如下步骤编译安装g2o出现错误。mkdir build cd build cmake .. make sudo make install最...
  • rsvp2012
  • rsvp2012
  • 2016-12-22 17:36:22
  • 1325

ubuntu16.04安装g2o时出现 E: 无法定位软件包 libcholmod-dev

最近在学习slam ,在安装g2o库的时候总是出现E: 无法定位软件包 libcholmod-dev这样的问题。 查资料查了一下午才知道原来输入sudo apt-get install libcho...
  • WUYIDUER
  • WUYIDUER
  • 2018-01-15 12:09:03
  • 1005

g2o的安装及初步使用

声明:本博客仅供个人学习使用。转载自  Jasmine_shine g2o的安装及初步使用  运行环境:ubuntu12.04 + g2o  个人原创,转载请注明...
  • u012700322
  • u012700322
  • 2016-08-04 20:36:12
  • 1551

G2O 与rgbdslam在ubuntu16.04下安装

G2O rgbdslam在ubuntu16.04下的安装
  • Nksjc
  • Nksjc
  • 2017-06-16 16:29:31
  • 1415

ubuntu安装g2o时出现错误及解决方法

安装G2O可以用高翔在git上的包,一可以从这里clone下来git clone https://github.com/RainerKuemmerle/g2o.git 然后进入g2o文件夹,执行cma...
  • e_small
  • e_small
  • 2018-03-17 12:20:53
  • 41

在Ubuntu16.04 中g2o_viewer无法正常运行

问题: Error in `./g2o_viewer': realloc(): invalid pointer 解决方法: (1)修改:在FindQGLViewer cmake module中添加...
  • younger671
  • younger671
  • 2018-01-16 22:31:45
  • 153

g2o安装教程

安装依赖sudo apt-get install libeigen3-dev libsuitesparse-dev libqt4-dev qt4-qmake libqglviewer-dev 使用cm...
  • Iriving_shu
  • Iriving_shu
  • 2016-12-24 15:31:36
  • 651

解析“ubuntu.cn99.com:http”时,出现了某些故障(-5 - 没有与主机名关联的地址)

局域网里的服务器(Ubuntu 10.04)除了装系统时上外网下载软件,一直在内部访问。今天想在服务器上再装个软件,通过SecureCRT登录上去安装,却发现以下问题: 解析“ubuntu.cn99...
  • BoArmy
  • BoArmy
  • 2013-05-31 19:29:48
  • 4061
收藏助手
不良信息举报
您举报文章:在Ubuntu KyLin 16.04上安装g2o
举报原因:
原因补充:

(最多只允许输入30个字)