安装ceres库的避坑指南(附官方文档)

目录

写在前面

1. Failed to connect to ceres-solver.google.com port 443

解决办法:更换源

2. OpenSSL SSL_read: Connection was reset, errno 10054

解决办法:解除SSL认证

3. Maybe need administrative privileges

解决办法:使用root权限make install

4.  'LocalParameterization’ in namespace ‘ceres’ does not name a type

解决方法:更换ceres的源码版本。

5. 卸载已安装的ceres

解决办法:删除ceres安装到系统里的文件

6. 使用ceres的配置

7. 官方文档及精简版参考

8. ceres入门


写在前面

众所周知,ceres是SLAM工具链里很重要的一个库,每次安装都不顺利。

为方便工作,这里总结了高频问题,避免重复掉坑。

1. Failed to connect to ceres-solver.google.com port 443

直接使用官方提供的连接进行git clone

git clone https://ceres-solver.googlesource.com/ceres-solver

你大概率会得到如下结果。

解决办法:更换源

git clone  https://github.com/ceres-solver/ceres-solver.git

2. OpenSSL SSL_read: Connection was reset, errno 10054

git 报错信息:OpenSSL SSL_read: Connection was reset, errno 10054

一般在ubuntu下不会出现这个问题。在Windows下,有可能。

这是服务器的SSL证书没有经过第三方机构的签署,所以报错。错误原因可能是网络不稳定,连接超时造成的,如果你试了多次还是报这个错误,建议你执行下面的命令。

解决办法:解除SSL认证

git config --global http.sslVerify "false"
git config --global https.sslVerify "false"

3. Maybe need administrative privileges

可能当你执行make install时遇到这个问题:

 根据提示:Maybe need administrative privileges。

分析原因,可能是因为需要在root权限下执行命令。

解决办法:使用root权限make install

sudo make install

4.  'LocalParameterization’ in namespace ‘ceres’ does not name a type

当你编译某个使用ceres库的源文件,出现类似上述‘xxx’ in namespace ‘ceres’ does not name a type的错误提示时,考虑再确认一下源文件测试时ceres的版本。

一般在源码的package.xml里有version号。

比如:旧版里1.4.0用的较多,最新版已更新到2.1.0(见上图)。

解决方法:更换ceres的源码版本。

5. 卸载已安装的ceres

接上一条,有了新需求,卸载已安装的ceres。

Ceres只有一个库文件在"/usr/local/lib/“中,并且所有的头文件都在”/usr/local/include/ceres/"中,卸载就是很简单的两步。

解决办法:删除ceres安装到系统里的文件

sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a

6. 使用ceres的配置

在使用Ceres的工程里,CMakeLists.txt中应该有

find_package(Ceres REQUIRED)
include_directories(${Ceres_INCLUDE_DIRS})
target_link_libraries(可执行文件名 ${CERES_LIBRARIES})

注意:最新的Ceres需要使用C++14标准,在CmakeLists.txt中修改。

set( CMAKE_CXX_FLAGS "-std=c++14 -O3" )

7. 官方文档及精简版参考

Installation — Ceres Solver (ceres-solver.org)http://ceres-solver.org/installation.html通俗的精简版可参考以下链接。

Ceres solver安装与使用https://blog.csdn.net/qq_40270833/article/details/123264980

8. ceres入门

从0开始学习Ceres NO.1icon-default.png?t=M85Bhttps://blog.csdn.net/qq_41265365/article/details/123782248

猜你喜欢

转载自blog.csdn.net/slampai/article/details/127960537