ubuntu安装ceres、pyceres及对应报错解决
目录
- 一、安装流程
- 二、报错解决
- 1、std报错
- 2、报错eigen问题
- 3、未定义的引用,发现libm和libc版本不同
- 4、c++: fatal error: 已杀死 signal terminated program cc1plus
- 5、使用ceres_python_bindings报错1--- ‘ceres::Problem::Problem(const ceres::Problem&)’ is private,该程序用于ceres python编译
- 6、使用ceres_python_bindings报错2---LocalParameterization' is not a member of 'ceres',该程序用于ceres python编译
一、安装流程
ceres安装官方教程
ceres_python_bindings/pyceres是使用pybind11将ceres转化为Python形式
ceres_python_bindings
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver#如果需要安装pyceres,则需要加以下步骤
git clone https://github.com/Edwinem/ceres_python_bindings
cp ../custom_cpp_cost_functions.cpp ceres_python_bindings/python_bindings/custom_cpp_cost_functions.cpp
cd ceres_python_bindings
git submodule init
git submodule update
cd ..
echo "include(ceres_python_bindings/AddToCeres.cmake)" >> CMakeLists.txtmkdir ceres-bin
cd ceres-bin
cmake ..
make -j8
make test
二、报错解决
安装ceres时会出现很多问题,在这里做一下简略的记录
首先一定要确认安装的gcc、cmake、eigen是否满足ceres要求,否则会花费很多精力修改对应版本!
Ceres Solver 2.2 requires a fully C++17-compliant compiler.
CMake 3.10 or later required.
Eigen 3.3 or later required.
glog 0.3.5 or later. Recommended
SuiteSparse 4.5.6 or later.
1、std报错
/ceres-solver/include/ceres/internal/integer_sequence_algorithm.h:75:31: error: 'integer_sequence' is not a member of 'std'75 | std::integer_sequence<T, N, Ns...>,
std应该是c++版本的问题,查issue发现有一条对应的:
You are not compiling your application with a C++ standard >= 14 which is what the master branch of Ceres requires. I assume you are not using CMake to build your application either, as if you were the Ceres target would capture this dependency.
使用man gcc指令查看,发现其中支持c++14,查看cmake版本也满足要求。证明本机配置条件已经满足,修改cmakelists,指定C++版本
set(CMAKE_CXX_STANDARD 14)
# set(CMAKE_CXX_FLAGS "-std=c++14")
2、报错eigen问题
In file included from /usr/local/include/Eigen/Core:164,
from /home/zhouxin/DYT/code/Equivariant-SFM/bundle_adjustment/ceres-solver/include/ceres/internal/eigen.h:34,
from /home/zhouxin/DYT/code/Equivariant-SFM/bundle_adjustment/ceres-solver/internal/ceres/block_random_access_dense_matrix.cc:34:
/usr/local/include/Eigen/src/Core/util/Memory.h: In function 'void* Eigen::internal::handmade_aligned_malloc(std::size_t, std::size_t)':
/usr/local/include/Eigen/src/Core/util/Memory.h:107:30: error: suggest parentheses around '-' in operand of '&' [-Werror=parentheses]
切换gcc版本 gcc多版本切换
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 35
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 35
更换eigen版本,首先删除本地eigen,然后从官网找到对应想要的版本并安装
locate eigen3
rm -rf /usr/local/share/pkgconfig/eigen3.pc /usr/local/share/eigen3 /usr/local/include/eigen3
git clone https://gitlab.com/libeigen/eigen.git
cd eigen
mkbir build
cd build
cmake ..
make
sudo make install
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
cat /usr/local/include/eigen3/Eigen/src/Core/util/Macros.h
3、未定义的引用,发现libm和libc版本不同
/lib/x86_64-linux-gnu/libm.so.6:对‘__strtof128_nan@GLIBC_PRIVATE’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/helloworld_analytic_diff.dir/build.make:113: recipe for target 'bin/helloworld_analytic_diff' failed
make[2]: *** [bin/helloworld_analytic_diff] Error 1
CMakeFiles/Makefile2:340: recipe for target 'examples/CMakeFiles/helloworld_analytic_diff.dir/all' failed
make[1]: *** [examples/CMakeFiles/helloworld_analytic_diff.dir/all] Error 2
make[1]: *** 正在等待未完成的任务....
[ 87%] Linking CXX executable ../bin/helloworld_numeric_diff
/lib/x86_64-linux-gnu/libm.so.6:对‘__strtof128_nan@GLIBC_PRIVATE’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/helloworld.dir/build.make:113: recipe for target 'bin/helloworld' failed
make[2]: *** [bin/helloworld] Error 1
CMakeFiles/Makefile2:288: recipe for target 'examples/CMakeFiles/helloworld.dir/all' failed
make[1]: *** [examples/CMakeFiles/helloworld.dir/all] Error 2
/lib/x86_64-linux-gnu/libm.so.6:对‘__strtof128_nan@GLIBC_PRIVATE’未定义的引用
collect2: error: ld returned 1 exit status
examples/CMakeFiles/helloworld_numeric_diff.dir/build.make:113: recipe for target 'bin/helloworld_numeric_diff' failed
make[2]: *** [bin/helloworld_numeric_diff] Error 1
CMakeFiles/Makefile2:314: recipe for target 'examples/CMakeFiles/helloworld_numeric_diff.dir/all' failed
make[1]: *** [examples/CMakeFiles/helloworld_numeric_diff.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
首先查看对应版本,发现版本不对应,备份后修改
ll /lib/x86_64-linux-gnu
man ln
sudo cp libm.so.6 libm.so.61
sudo rm libm.so.6
ln -s libm-2.23.so libm.so.6
[注意]:此处必须先行查看自己所配备的版本,因为我的系统里之前安装的就是libm.so.6和libc.so.6,只是后续由于误操作又安装并指配了libm-2.23.so,所以需要重新指定。如果自己是其他版本的,只需要根据自己电脑版本进行设置即可。
参考1
参考2
4、c++: fatal error: 已杀死 signal terminated program cc1plus
compilation terminated.
internal/ceres/CMakeFiles/ceres_internal.dir/build.make:579: recipe for target 'internal/ceres/CMakeFiles/ceres_internal.dir/generated/schur_eliminator_2_4_d.cc.o' failed
make[2]: *** [internal/ceres/CMakeFiles/ceres_internal.dir/generated/schur_eliminator_2_4_d.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
c++: fatal error: 已杀死 signal terminated program cc1plus
设置swap
swap设置方法
5、使用ceres_python_bindings报错1— ‘ceres::Problem::Problem(const ceres::Problem&)’ is private,该程序用于ceres python编译
python_module.cpp:63:26: error: ‘ceres::Problem::Problem(const ceres::Problem&)’ is private within this context
return ceres::Problem(o);
查issue发现有一条对应的,作者回复
It was developed with the latest version of Ceres on github.
I also tried with 1.14 and got the same errors. So that version is just too old.
所以升级对应版本
6、使用ceres_python_bindings报错2—LocalParameterization’ is not a member of ‘ceres’,该程序用于ceres python编译
error: 'LocalParameterization' is not a member of 'ceres'199 | ceres::LocalParameterization, /* Parent class */
看到issue上有人提问相同问题作者没有回复,怀疑可能是ceres 2.1.0版本太新ceres_python_bindings无法适配(由发布日期看出,ceres 2.1.0新版本推出pyceres也没有做出相应版本更新),改成ceres2.0.0,发现顺利编译。
**[注意]**重新安装ceres2.0.0即先卸载之前版本,之后再按照官方教程依次下载安装ceres2.0.0,不需要再重新安装cmake等工具。
卸载ceres需要删除"/usr/local/lib/“中的库文件以及”/usr/local/include/ceres/"中的头文件:
sudo rm -r /usr/local/lib/cmake/Ceres
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
ubuntu安装ceres、pyceres及对应报错解决相关推荐
- 【ROS】虚拟机VMware 安装ROS 一条龙教程+部分报错解决
前言 Linux下安装ROS真是太多坑了,如何在Linux下安装ROS呢?博主带你少走弯路! 目录 前言 第一步:配置软件源 1.打开设置 2.打开软件与更新 3.选源 第二步:设置sources.l ...
- 【Linux学习】虚拟机VMware 安装ROS 一条龙教程+部分报错解决
前言 Linux下安装ROS真是太多坑了,如何在Linux下安装ROS呢?博主带你少走弯路! 目录 前言 第一步:配置软件源 1.打开设置 2.打开软件与更新 3.选源 第二步:设置sources.l ...
- 安装Cadence16.6遇到的报错解决
安装Cadence16.6遇到的报错解决 1.运行电脑服务器与客服端破解过程中出现问题:Unable to restart Cadence License Server with the new li ...
- ubuntu安装xrdp(远程桌面协议)报错:无法获得锁
报错如下: E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用) E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock ...
- python安装pip之后 pip命令报错解决方法
使用源码包安装python2.7之后. 安装pip工具,下载地址: https://pypi.python.org/packages/41/27/9a8d24e1b55bd8c85e4d022da29 ...
- Centos 7.5编译、安装和构建LNMP环境-报错解决
步骤参考: Centos 7.5 Compile, Install and Build LNMP Environment 报错内容 3.2. PCRE installation 报错下载不了,这个是应 ...
- Ubuntu安装Python模块时的报错
在安装Python的psutil模块时,报"error: command 'x86_64-linux-gnu-gcc' failed with exit status 1"的错误, ...
- ubuntu 安装完成后重启电脑报错: BUG soft lockup 的解决办法
安装 Ubuntu 出现 BUG soft lockup 的解决办法(18.04): 具体的错误内容: kernel:NMI watchdog: BUG: soft lockup - CPU#0 st ...
- ubuntu安装飞秋流程和报错处理libiptux-core.so.0: cannot open shared object file
iptux: error while loading shared libraries: libiptux-core.so.0: cannot open shared object file: No ...
最新文章
- [转] 程序员写简历的注意事项
- 利用TLD2131组成LED矩阵显示实验电路板
- Spring Boot 配置中的敏感信息如何保护?
- 安卓socks5代理客户端_内网Mysql代理浅析
- XAPIAN简单介绍(三)
- 双机通信c语言程序,双机通信(C语言、主机和从机共用程序)
- 强化学习《基于价值 - DQN其他细节算法》
- 深度学习之卷积神经网络CNN
- Codeforces Gym 100286I iSharp 模拟
- AndroidStudio_开发工具的设置_界面设置_字体设置_使用习惯设置_按钮设置等一些设置的介绍---Android原生开发工作笔记71
- python如何爬取网站所有目录_用python爬虫爬取网站的章节目录及其网址
- python3第三方模块安装路径_查看python及其第三方库的版本和安装位置
- C语言指针及C++引用
- Qt实现音视频播放器
- 【学习】从零开始的Android音视频开发(6)——MediaPlayerService中BinderDriver、创建播放器过程、建立StageFright层交互
- 产品经理的进阶——需求的成长史
- 撰写MLA格式的毕业论文,需留意下边几个文件格式标准
- 3DMAX - 使用编辑多边形的小技巧
- Win10电脑用360杀毒一全盘杀毒就蓝屏
- logsource and ALO