1. 终端输入命令,安装所需依赖
sudo apt install libglew-dev cmake libboost-dev libboost-thread-dev libboost-filesystem-dev libeigen3-dev -y
2、下载源码压缩包
git clone https://github.com/stevenlovegrove/Pangolin.git
3、解压文件,cd到该目录中
unzip Pangolin && cd Pangolin
4、创建build文件夹,cd到该目录中
mkdir build && cd build
5、cmake分析源代码
cmake ..
可能会遇到下面这样的报错
CMake Error at CMakeLists.txt:109 (add_library):
Target "pango_opengl" links to target "Eigen3::Eigen" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:109 (add_library):
Target "pango_glgeometry" links to target "Eigen3::Eigen" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:109 (add_library):
Target "pango_glgeometry" links to target "Eigen3::Eigen" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:109 (add_library):
Target "pango_plot" links to target "Eigen3::Eigen" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
报错显示找不到eigen库,那我们修改下components/pango_geometry和components/pango_opengl文件夹下的CMakeLists.txt。
添加这一行:include_directories(/usr/include/eigen3)
修改这一行:target_link_libraries(${COMPONENT} PUBLIC pango_core pango_image ${Eigen3_LIBRARIES})
添加的是为了后面make成功,修改的是为了cmake成功,然后保存,再次cmake..
成功。
如果你cmake报错: 缺少xkbcommon库,然后你安装
libxkbcommon-x11-dev
出现以下报错:
libxkbcommon-x11-dev : 依赖: libxkbcommon-x11-0 (= 0.8.0-1ubuntu0.1)
但是 0.8.2-1~ubuntu18.04.1 正要被安装
就说明你下载的pangolin版本不适用于你的ubuntu版本,不要使用网上的方法强制降低版本,那样会导致你很多依赖库opencv、pcl、ros被卸载,正确做法是重新下载个低版本的pangollin。
6、make编译源代码
sudo make -j4
7、make install安装
sudo make install