操作系统:ubuntu 12.04(gcc 版本:gcc version 4.8.1 )(安装失败,安装Pangolin时提示未识别指令gnu++ 1y,可能与编译器版本有关系)
(使用gcc version 5.4.1 20160904安装成功)
ubuntu 16.04 x64(gcc 版本:5.4.0)
1)安装cmake
a)下载源码
b) ./bootstrap
c) make
d)sudo make install
备注:
ubuntu 16.04问题:
a)cmake编译opencv提示: No package 'libgphoto2' found
sudo apt-get install libgphoto2-dev
b)cmake编译opencv时提示ippicv_linux_20151201 file DOWNLOAD HASH mismatch
手动下载ippicv_linux_20151201.tgz文件,然后替换linux-目录下的同名文件,继续cmake
c)编译ORB-Slam2时提示特殊字符串错误
由于文件是从windows拷贝至linux的,所以产生了特殊字符。应该直接在linux下载ORB-slam2源码,并编译(编译前将build.sh中的make -j 修改为make -j4,其中4表示cpu的核数)
ubuntu 12.04问题:
a)ubuntu 12.04安装gcc-4.8
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo apt-get install g++-4.8
sudo ln -s /usr/bin/g++-4.8 /usr/bin/g++
sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc
b)提示Error when bootstrapping CMake Cannot find appropriate C++ compiler on this system Please specify one using environment variable CXX…
安装支持C++11的gcc/g++编译器(gcc-4.8/g++-4.8以上)
c)安装gcc-5
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
2)安装Pangolin(在ubuntu12.04系统中在安装了ffmpeg库后出现了很多问题,反而在卸载了ffmpeg后,编译Pangolin还成功了)
a)下载:git clone https://github.com/stevenlovegrove/Pangolin.git
sudo apt-get install libglew-dev
sudo apt-get install libpython2.7-dev
sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
b)mkdir build
c)cd build
d)cmake ..
e) make
3)安装OpenCV
a)下载源码
b)mkdir build && cd build && cmake ..
c)make
d)sudo make install
问题:启动Orb-slam2单目Example时提示
Framebuffer with requested attributes not available. Using available framebuffer. You may see visual artifacts.
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows,
GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake
or configure script) in cvNamedWindow, file /home/ubuntu/orb-slam2/opencv/sources/modules/highgui/src/window.cpp, line 527
解决方式:apt-get install libgtk2.0-dev pkg-config,然后重新cmake opencv
编译ORB-SLAM2时提示:error: ‘GL_SHADER_STORAGE_BUFFER’
根据提示是因为/usr/include/GL/glew.h 中没有‘GL_SHADER_STORAGE_BUFFER’ 的定义,
在ubuntu12.04安装libglew-dev时使用的是libglew1.5-dev, 以及libglew1.6-dev,这2种方式都没有
有‘GL_SHADER_STORAGE_BUFFER’ 的定义,所以就直接在官网下载glew-2.1.0 进行编译安装
安装opengl:
sudo apt-get install build-essential
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev
sudo apt-get install libglut-dev(失败时 sudo apt-get install libglut-dev命令改成$ sudo apt-get install freeglut3-dev即可。)
4)安装Eigen3
a)下载源码
b)mkdir build && cd build
c)cmake .. -DCMAKE_INSTALL_PREFIX=/usr
d)make
e)sudo make install
5)下载TUM Dataset
6) error: could not convert ‘PIX_FMT_GRAY8’ from ‘PixelFormat’ to ‘pangolin::PixelFormat’
解决方式:在cmake时提示了HAVE_FFMPEG_MAX_ANALYZE_DURATION - Failed 以及
HAVE_FFMPEG_AVPIXELFORMAT - Failed,尝试重新下载最新版ffmpeg-4.1.3.tar.bz2进行编译,安装
在安装成功后发现-- Performing Test HAVE_FFMPEG_AVPIXELFORMAT - Success
7)安装ffmpeg时执行./configure时,报yasm/nasm not found or too old. Use --disable-yasm for a crippledbuild
解决方式:安装yasm
a)在http://www.tortall.net/projects/yasm/releases中下载yasm-1.3.0.tar.gz
b)./configure
c)make
d)make install
8)在最新版ffmpeg后,编译Pangolin提示:
[ 72%] Linking CXX executable VideoViewer
../../src/libpangolin.so: undefined reference to `av_buffersink_get_sample_aspect_ratio'
../../src/libpangolin.so: undefined reference to `avfilter_graph_dump'
../../src/libpangolin.so: undefined reference to `avfilter_graph_free'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_channels'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_h'
../../src/libpangolin.so: undefined reference to `avfilter_link'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_time_base'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_type'
../../src/libpangolin.so: undefined reference to `swr_convert'
../../src/libpangolin.so: undefined reference to `swr_free'
../../src/libpangolin.so: undefined reference to `swr_close'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_w'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_frame_flags'
../../src/libpangolin.so: undefined reference to `avfilter_graph_config'
../../src/libpangolin.so: undefined reference to `avfilter_graph_alloc'
../../src/libpangolin.so: undefined reference to `swr_alloc'
../../src/libpangolin.so: undefined reference to `swr_is_initialized'
../../src/libpangolin.so: undefined reference to `avfilter_get_by_name'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_sample_rate'
../../src/libpangolin.so: undefined reference to `avfilter_graph_create_filter'
../../src/libpangolin.so: undefined reference to `swr_init'
../../src/libpangolin.so: undefined reference to `avfilter_inout_free'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_format'
../../src/libpangolin.so: undefined reference to `avfilter_graph_parse_ptr'
../../src/libpangolin.so: undefined reference to `av_buffersink_get_channel_layout'
../../src/libpangolin.so: undefined reference to `avfilter_pad_get_type'
collect2: error: ld returned 1 exit status
make[2]: *** [tools/VideoViewer/VideoViewer] 错误 1
make[1]: *** [tools/VideoViewer/CMakeFiles/VideoViewer.dir/all] 错误 2
make: *** [all] 错误 2
解决方式:卸载ffmpeg库