centos下Pangolin 安裝與使用

Pangolin是對OpenGL進行封裝的輕量級的OpenGL輸入/輸出和視頻顯示的庫。可以用於3D視覺和3D導航的視覺圖,可以輸入各種類型的視頻、並且可以保留視頻和輸入數據用於debug.

可以在https://github.com/stevenlovegrove/Pangolin上下載Pangolin,終端使用如下的指令也OK:

git clone https://github.com/stevenlovegrove/Pangolin.git

在安裝編譯Pangolin之前還需要安裝相關的依賴庫文件;

ubuntu環境下主要是OpenGL,ubuntu系統可以使用如下方式安裝Pangolin:

* install dependency for pangolin (mainly the OpenGL): 
sudo apt-get install libglew-dev

* compile and install pangolin
cd [path-to-pangolin]
mkdir build
cd build
cmake ..
make 
sudo make install 

然而對於centos系統,相應的庫文件是什麼呢??

搜尋網上很多教程,centos下對應的依賴分別是:

freeglut (相應官網 )

選擇對應系統版本的安裝文件,例如我的是centos7,選擇如下:

 最快的終端指令安裝方式爲:

yum install freeglut

或者,將安裝包下載下來安裝,

到下載的目錄下運行指令安裝:

sudo rpm -ih freeglut-3.0.0-8.el7.x86_64.rpm 

 

libGLEW (相應 官網

選擇對應系統版本的安裝文件,例如我的是cetos7,選擇如下:

 可以在終端用指令下載與安裝:

yum install libGLEW

或者到下載的目錄下運行指令安裝:

sudo rpm -ih libGLEW-1.10.0-5.el7.x86_64.rpm

 

libglew-dev (相應官網

這個庫目前我只看到有centos6的,沒有高版本的,不知道是否對centos7支持,先下載下來試試(以下證明果然行不通!!!);

可以直接用指令下載安裝,不過官網指出需要先創建個文件/etc/yum.repos.d/linuxtech.repo;其內容如下:

[linuxtech]
name=LinuxTECH
baseurl=http://pkgrepo.linuxtech.net/el6/release/
enabled=1
gpgcheck=1
gpgkey=http://pkgrepo.linuxtech.net/el6/release/RPM-GPG-KEY-LinuxTECH.NET

然後運行指令:

yum install libglew-devel

或者將安裝文件下載下來,我下的是libglew-devel-1.7.0-1.el6.x86_64.rpm

然後用如下指令安裝:

sudo rpm -ih libglew-devel-1.7.0-1.el6.x86_64.rpm

提示缺少依賴庫文件,如下:

 然後我Google了下,發現這個其實有centos7版本的,地址https://pkges.org/download/glew-devel

地址應該爲:https://pkgs.org/download/glew-devel  多謝讀者糾正!

選擇centos7的下載,文件名爲:glew-devel-1.10.0-5.el7.x86_64.rpm

然後用如下指令安裝:

sudo rpm -ih glew-devel-1.10.0-5.el7.x86_64.rpm

安裝成功(萬惡的資源受限,只能FQ)

 


現在cd 到Pangolin下載的解壓目錄下,

創建個build, cd到這個build中,然後cmake ..下

[chensq@localhost build]$ cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Build type not set (defaults to release)
-DCMAKE_BUILD_TYPE=Debug for debug
-- Found OpenGL: /usr/lib64/libGL.so   
-- Found GLEW: /usr/lib64/libGLEW.so
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29") 
-- Could NOT find WAYLAND_CLIENT (missing: WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR) 
-- Could NOT find WAYLAND_SERVER (missing: WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR) 
-- Could NOT find WAYLAND_EGL (missing: WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR) 
-- Could NOT find WAYLAND_CURSOR (missing: WAYLAND_CURSOR_LIBRARIES WAYLAND_CURSOR_INCLUDE_DIR) 
-- Could NOT find WAYLAND (missing: WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR) 
-- Eigen Found and Enabled
-- libdc1394 Found and Enabled
-- V4L Found and Enabled
-- Performing Test HAVE_FFMPEG_MAX_ANALYZE_DURATION
-- Performing Test HAVE_FFMPEG_MAX_ANALYZE_DURATION - Failed
-- Performing Test HAVE_FFMPEG_AVFORMAT_ALLOC_OUTPUT_CONTEXT2
-- Performing Test HAVE_FFMPEG_AVFORMAT_ALLOC_OUTPUT_CONTEXT2 - Failed
-- Performing Test HAVE_FFMPEG_AVPIXELFORMAT
-- Performing Test HAVE_FFMPEG_AVPIXELFORMAT - Success
-- ffmpeg Found and Enabled
-- libpng Found and Enabled
-- libjpeg Found and Enabled
-- libtiff Found and Enabled

然後 make 

如果make時到了23% 就報了一大堆錯誤的話,建議換個Pangolin的源進行安裝,有博主反應最新的源有些問題,如果你make沒有成功,目前換源有兩個解決方法:

其中一個源還是stevenlovegrove的,不過下載個老版本的,選擇0.5,如下圖:

 還有一個源是,git clone https://github.com/zzx2GH/Pangolin.git  (參考博客https://blog.csdn.net/zzu_seu/article/details/84866858 )

 

基於換源後,

如果make中出現如下錯誤:

 /bin/ld: /usr/local/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC

錯誤信息非常明白,就是無法生成動態庫,需要使用 -fPIC 參數來重新編譯 Python。有博主就重新編譯安裝了下(參考);

 

其實我用的python默認是從anaconda3/bin下的python進去的,而linux系統自帶的2.7版本的python在usr/bin/python下

就是說在make過程中沒有找到libpython3.6m.a,有博客說直接找到這個文件,然後拷貝到/usr/lib/,/usr/lib64/, /usr/local/lib64/,(參考:未加載到libpython3.5m.so.1.0的解決辦法未加載libpython3.6m.so.1.0的辦法)這個方法我還沒嘗試,應該可行~

我的方法是以下載個python3.6.5的安裝源文件,然後,解壓,進入解壓文件,按照以下指令安裝了下:

./configure --prefix=/usr/local/python3  --enable-shared CFLAGS=-fPIC

make && sudo make install

源文件在/home/chensq/Downloads/Python-3.6.5 這個目錄下,這個目錄下有相應的動態庫和python執行文件;

那麼索性在cmake Pangolin的時候,將python強行指定到這個路徑就行~

 

##切到Pangolin目錄下
cd /home/chensq/Downloads/slambook2-master/3rdparty/Pangolin-0.5   

##將原來的build文件夾刪除,重新cmake
rm -rf build
mkdir build
cd build

##強行指定python的路徑
cmake -D PYTHON_EXECUTABLE=/home/chensq/Downloads/Python-3.6.5/ ..

##然後make 就成功了~
make
sudo make install

 


 

 

參考:

https://blog.csdn.net/qq_32627687/article/details/81105706

https://www.cnblogs.com/laodageblog/p/5993742.html

https://blog.csdn.net/qq_29230261/article/details/87875630

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章