报错解决:Could not find a package configuration file provided by "Pangolin"
博主在使用cmake
编译自己的工程时,遇到了如下报错:
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "FindPangolin.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Pangolin",
but CMake did not find one.
Could not find a package configuration file provided by "Pangolin" with any
of the following names:
PangolinConfig.cmake
pangolin-config.cmake
Add the installation prefix of "Pangolin" to CMAKE_PREFIX_PATH or set
"Pangolin_DIR" to a directory containing one of the above files. If
"Pangolin" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
解决方法是安装Pangolin软件包:
# 下载Pangolin
git https://github.com/stevenlovegrove/Pangolin.git
# 编译
cd Pangolin
mkdir build
cd build
cmake .. && make
sudo make install
# 注意sudo make install一定要执行,否则编译自己的工程会报错fatal error: pangolin/pangolin.h: 没有那个文件或目录
在编译Pangolin时发现GLEW软件包未安装:
CMake Error at cmake/FindGLEW.cmake:51 (MESSAGE):
Could not find GLEW
使用如下命令进行安装:
sudo apt install libglew-dev
安装完后,重新对Pangolin进行编译,成功编译与安装。
但编译自己的工程又遇到了如下的报错(报错只截取了一部分):
In file included from /usr/local/include/pangolin/utils/signal_slot.h:3,
from /usr/local/include/pangolin/windowing/window.h:35,
from /usr/local/include/pangolin/display/display.h:34,
from /usr/local/include/pangolin/pangolin.h:38,
from /home/a616708946/slambook/ch5/code/disparity.cpp:8:
/usr/local/include/sigslot/signal.hpp:109:79: error: ‘decay_t’ is not a member of ‘std’; did you mean ‘decay’?
109 | constexpr bool is_weak_ptr_compatible_v = detail::is_weak_ptr_compatible<std::decay_t<P>>::value;
| ^~~~~~~
| decay
解决方法是把CMakeLists.txt中的这一部分进行修改,修改完如下:
set( CMAKE_CXX_FLAGS "-std=c++14")
# set(CMAKE_CXX_FLAGS "-std=c++11 -g -Wall")
接着,编译自己的工程又遇到了如下的报错(报错只截取了一部分):
In file included from /usr/local/include/pangolin/gl/gl.h:324:0,
from /usr/local/include/pangolin/handler/handler.h:31,
from /usr/local/include/pangolin/display/widgets.h:32,
from /usr/local/include/pangolin/pangolin.h:40,
from /home/marcos/code/SensorsCalibration/lidar2camera/manual_calib/src/run_lidar2camera.cpp:9:
/usr/local/include/pangolin/gl/gl.hpp: In member function ‘void pangolin::GlTexture::CopyFrom(const pangolin::GlTexture&)’:
/usr/local/include/pangolin/gl/gl.hpp:348:5: error: ‘glCopyImageSubDataNV’ was not declared in this scope
glCopyImageSubDataNV(tex.tid, GL_TEXTURE_2D, 0, 0, 0, 0,
^~~~~~~~~~~~~~~~~~~~
/usr/local/include/pangolin/gl/gl.hpp:348:5: note: suggested alternative: ‘glCopyColorSubTable’
glCopyImageSubDataNV(tex.tid, GL_TEXTURE_2D, 0, 0, 0, 0,
^~~~~~~~~~~~~~~~~~~~
glCopyColorSubTable
Pangolin安装的版本有误,解决方法如下:
cd Pangolin
cd build
sudo make uninstall
cd .. && rm -rf build
git checkout v0.6
mkdir build && cd build
cmake ..
cmake --build .
sudo make install
最后编译自己的工程成功,问题成功解决。