ORB-slam3 编译出现 Could not find a package configuration file provided by “Pangolin“ with any of the fo

大体报错如下:

-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- 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
Build type: Release
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Using flag -std=c++11.
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "3.1.0")
CMake Error at CMakeLists.txt:35 (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!

解决方案

原始回答

I was trying to build ORB_SLAM2, and was running into the exact same error code as everyone here, but none of the issues listed seemed to be a good fit for me. I realized that I never built Pangolin in the first place, I only partially completed the instructions for the install.

I ran these commands:

git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake …
cmake --build .

Then when I tried to build ORB_SLAM2 once more with:

cd ORB_SLAM2
chmod +x build.sh
./build.sh

There was no error message. Definitely a stupid mistake, but I aint the first, hope this helps!

git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake ..
cmake --build .

Then when I tried to build ORB_SLAM2 once more with:

cd ORB_SLAM2
chmod +x build.sh
./build.sh


### 解决OrbSLAM中缺少PangolinConfig.cmake或pangolin-config.cmake的问题 在使用OrbSLAM时,如果遇到`missing PangolinConfig.cmake`或`pangolin-config.cmake`错误,通常是因为CMake无法找到Pangolin库的相关配置文件。以下是可能的原因以及解决方案: #### 原因分析 1. **未安装Pangolin** 如果系统上尚未安装Pangolin,则不会存在任何与其相关的配置文件[^1]。 2. **Pangolin安装路径不正确** 即使已安装Pangolin,但如果其安装目录不在CMake的标准搜索路径范围内,可能会导致CMake无法定位到所需的`.cmake`文件[^2]。 3. **环境变量缺失** CMake依赖于某些环境变量来查找第三方库的位置。如果没有设置这些变量或者它们指向了错误的路径,也可能引发此问题[^3]。 4. **版本兼容性问题** 不同版本的Pangolin生成的配置文件名称可能存在差异(例如`PangolinConfig.cmake` vs `pangolin-config.cmake`),这可能导致特定项目无法识别正确的文件名模式[^4]。 --- #### 解决方案 ##### 方法一:重新编译并安装Pangolin 确保按照官方文档正确构建和安装Pangolin。执行以下命令可以完成这一过程: ```bash git clone https://github.com/stevenlovegrove/Pangolin.git cd Pangolin mkdir build && cd build cmake .. make -j$(nproc) sudo make install ``` 上述操作会将Pangolin及其关联的`.cmake`文件复制到系统的默认位置(通常是`/usr/local/lib/cmake/pangolin/`)。这样能够帮助CMake自动检测到必要的配置文件[^5]。 ##### 方法二:手动指定Pangolin路径 当Pangolin被安装到了非标准目录时,可以通过修改OrbSLAM项目的CMakeLists.txt文件,在其中显式定义Pangolin根目录的位置。例如: ```cmake set(PANGOLIN_ROOT "/path/to/custom/installation/folder") find_package(Pangolin REQUIRED PATHS ${PANGOLIN_ROOT} NO_DEFAULT_PATH) ``` 另外还可以通过运行CMake时传递参数的方式实现相同效果: ```bash cmake .. -DPangolin_DIR=/path/to/pangolin/config/ ``` 这里需要注意替换掉`/path/to/pangolin/config/`为你实际存放有`PangolinConfig.cmake`的那个具体子目录地址[^6]。 ##### 方法三:检查环境变量 确认是否存在名为`CMAKE_PREFIX_PATH`或其他类似的环境变量,并将其值扩展至包含所有自定义软件包所在的基础路径。比如对于Linux平台来说,可编辑用户的shell profile脚本添加如下行: ```bash export CMAKE_PREFIX_PATH=$HOME/software:$CMAKE_PREFIX_PATH ``` 之后记得刷新当前终端session以便更改生效[^7]。 ##### 方法四:调整大小写敏感度 部分情况下由于操作系统区分大小写字母的缘故造成匹配失败现象发生。尝试同时寻找两种形式的名字——即既考虑大写的"PangolinConfig.cmake"也顾及小写的"pangolin-config.cmake"—从而提高命中率[^8]。 --- ### 总结 以上介绍了四种针对OrbSLAM项目里丢失Pangolin配置文件情况下的处理办法。优先推荐先验证是否已经成功部署好最新版别的Pangolin;其次再依据实际情况采取其他补救措施直至彻底解决问题为止。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值