ubuntu18.04安装ceres报错1618: recipe for target ‘internal/ceres/CMakeFiles/ceres.dir/all‘ failed解决方案

  在ubuntu18.04上安装ceres,在make的时候出错了,报错信息如下:

error: ‘<anonymous>.ceres::internal::SchurEliminator<2, 2, 2>::Chunk::start’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   struct Chunk {
          ^~~~~
cc1plus: some warnings being treated as errors
internal/ceres/CMakeFiles/ceres.dir/build.make:2558: recipe for target 'internal/ceres/CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_2.cc.o' failed
make[2]: *** [internal/ceres/CMakeFiles/ceres.dir/generated/schur_eliminator_2_2_2.cc.o] Error 1
CMakeFiles/Makefile2:1618: recipe for target 'internal/ceres/CMakeFiles/ceres.dir/all' failed
make[1]: *** [internal/ceres/CMakeFiles/ceres.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

  于是我百度搜了一下这个错误,没找到解决方案,倒是有一篇博客贴了这个错误然后底下直接一句 I can't solve it.哈哈哈。那个博主在底下评论区说他是通过换成16.04版本的ubuntu解决的这个问题(有点暴力)。后来我想起来,在ceres的官方安装教程上,用的是压缩包里的源码:
ubuntu18.04安装ceres报错1618: recipe for target ‘internal/ceres/CMakeFiles/ceres.dir/all‘ failed解决方案_第1张图片  
  而我一开始是直接使用git clone下的源码:
ubuntu18.04安装ceres报错1618: recipe for target ‘internal/ceres/CMakeFiles/ceres.dir/all‘ failed解决方案_第2张图片  
  看了一下,直接运行上图的这个命令下载的源码可能和压缩包下载的不一样,所以编译时候出错了。于是我也去下载了压缩包,戳安装教程开始处的latest stable release链接,会自动下载最新稳定版本的压缩包。
ubuntu18.04安装ceres报错1618: recipe for target ‘internal/ceres/CMakeFiles/ceres.dir/all‘ failed解决方案_第3张图片  
  接下来再根据教程里的cmake步骤一步步执行就可以安装成功了。
ubuntu18.04安装ceres报错1618: recipe for target ‘internal/ceres/CMakeFiles/ceres.dir/all‘ failed解决方案_第4张图片

你可能感兴趣的:(Ubuntu,ceres,ubuntu,ceres,cmake,安装)