参考https://blog.csdn.net/Carry_all/article/details/103224043来进行的安装。途中遇到网络问题和make执行错误的问题。错误如下所示:

In file included from /root/wcf/ceres-solver/internal/ceres/compressed_row_sparse_matrix.h:43:0,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.h:45,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.cc:38:
/usr/include/glog/logging.h: In instantiation of ‘void google::MakeCheckOpValueString(std::ostream*, const T&) [with T = std::nullptr_t; std::ostream = std::basic_ostream<char>]’:
/usr/include/glog/logging.h:694:25:   required from ‘std::__cxx11::string* google::MakeCheckOpString(const T1&, const T2&, const char*) [with T1 = ceres::internal::ContextImpl*; T2 = std::nullptr_t; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/usr/include/glog/logging.h:718:1:   required from ‘std::__cxx11::string* google::Check_NEImpl(const T1&, const T2&, const char*) [with T1 = ceres::internal::ContextImpl*; T2 = std::nullptr_t; std::__cxx11::string = std::__cxx11::basic_string<char>]’
/root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.cc:69:3:   required from here
/usr/include/glog/logging.h:638:9: error: ambiguous overload for ‘operator<<’ (operand types are ‘std::ostream {aka std::basic_ostream<char>}’ and ‘std::nullptr_t’)(*os) << v;~~~~~~^~~~
In file included from /usr/include/c++/7/istream:39:0,from /usr/include/c++/7/sstream:38,from /usr/include/c++/7/complex:45,from /usr/include/eigen3/Eigen/Core:80,from /root/wcf/ceres-solver/include/ceres/internal/eigen.h:34,from /root/wcf/ceres-solver/internal/ceres/sparse_matrix.h:38,from /root/wcf/ceres-solver/internal/ceres/compressed_row_sparse_matrix.h:41,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.h:45,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.cc:38:
/usr/include/c++/7/ostream:108:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]operator<<(__ostream_type& (*__pf)(__ostream_type&))^~~~~~~~
/usr/include/c++/7/ostream:117:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ios_type& (*)(std::basic_ostream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>; std::basic_ostream<_CharT, _Traits>::__ios_type = std::basic_ios<char>]operator<<(__ios_type& (*__pf)(__ios_type&))^~~~~~~~
/usr/include/c++/7/ostream:127:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]operator<<(ios_base& (*__pf) (ios_base&))^~~~~~~~
/usr/include/c++/7/ostream:245:7: note: candidate: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>]operator<<(const void* __p)^~~~~~~~
In file included from /usr/include/c++/7/ostream:693:0,from /usr/include/c++/7/istream:39,from /usr/include/c++/7/sstream:38,from /usr/include/c++/7/complex:45,from /usr/include/eigen3/Eigen/Core:80,from /root/wcf/ceres-solver/include/ceres/internal/eigen.h:34,from /root/wcf/ceres-solver/internal/ceres/sparse_matrix.h:38,from /root/wcf/ceres-solver/internal/ceres/compressed_row_sparse_matrix.h:41,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.h:45,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.cc:38:
/usr/include/c++/7/bits/ostream.tcc:119:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_ostream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]basic_ostream<_CharT, _Traits>::^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/7/istream:39:0,from /usr/include/c++/7/sstream:38,from /usr/include/c++/7/complex:45,from /usr/include/eigen3/Eigen/Core:80,from /root/wcf/ceres-solver/include/ceres/internal/eigen.h:34,from /root/wcf/ceres-solver/internal/ceres/sparse_matrix.h:38,from /root/wcf/ceres-solver/internal/ceres/compressed_row_sparse_matrix.h:41,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.h:45,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.cc:38:
/usr/include/c++/7/ostream:574:5: note: candidate: std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const unsigned char*) [with _Traits = std::char_traits<char>]operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)^~~~~~~~
/usr/include/c++/7/ostream:569:5: note: candidate: std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const signed char*) [with _Traits = std::char_traits<char>]operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)^~~~~~~~
/usr/include/c++/7/ostream:556:5: note: candidate: std::basic_ostream<char, _Traits>& std::operator<<(std::basic_ostream<char, _Traits>&, const char*) [with _Traits = std::char_traits<char>]operator<<(basic_ostream<char, _Traits>& __out, const char* __s)^~~~~~~~
In file included from /usr/include/c++/7/ostream:693:0,from /usr/include/c++/7/istream:39,from /usr/include/c++/7/sstream:38,from /usr/include/c++/7/complex:45,from /usr/include/eigen3/Eigen/Core:80,from /root/wcf/ceres-solver/include/ceres/internal/eigen.h:34,from /root/wcf/ceres-solver/internal/ceres/sparse_matrix.h:38,from /root/wcf/ceres-solver/internal/ceres/compressed_row_sparse_matrix.h:41,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.h:45,from /root/wcf/ceres-solver/internal/ceres/cuda_sparse_matrix.cc:38:
/usr/include/c++/7/bits/ostream.tcc:321:5: note: candidate: std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&, const char*) [with _CharT = char; _Traits = std::char_traits<char>]operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)^~~~~~~~
internal/ceres/CMakeFiles/ceres_internal.dir/build.make:1041: recipe for target 'internal/ceres/CMakeFiles/ceres_internal.dir/cuda_sparse_matrix.cc.o' failed
make[2]: *** [internal/ceres/CMakeFiles/ceres_internal.dir/cuda_sparse_matrix.cc.o] Error 1
CMakeFiles/Makefile2:154: recipe for target 'internal/ceres/CMakeFiles/ceres_internal.dir/all' failed
make[1]: *** [internal/ceres/CMakeFiles/ceres_internal.dir/all] Error 2
Makefile:145: recipe for target 'all' failed

通过搜索相关问题,发现是由于自己版本不对导致的(版本过旧和过新都有问题 我使用的是最新版本)。参照https://blog.csdn.net/weixin_43731435/article/details/117198844的方法,我将ceres-solver的版本库降低到1.14.0版本后,安装成功。使用的commit如下所示:

1.14.0
commit  facb199f3eda902360f9e1d5271372b7e54febe1    [log] [tgz]
author  Sameer Agarwal <sameeragarwal@google.com>    Wed Mar 21 21:00:14 2018 -0700
committer   Sameer Agarwal <sameeragarwal@google.com>    Wed Mar 21 21:00:14 2018 -0700
tree    ff8b99beacbd0ea25211d38f1b499202d68cb2b2
parent  b5d6ee4a88694efb9dadd25c8cf4ae1b14407d7e [diff]

此后在安装colmap的时候也出现了问题,使用cmake编译报错。

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.14.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading]
-- Found Boost: /usr/local/lib/cmake/Boost-1.80.0/BoostConfig.cmake (found version "1.80.0") found components: program_options filesystem graph system unit_test_framework
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0")
-- Found Eigen
--   Includes : /usr/include/eigen3
-- Found FreeImage
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
-- Found FLANN
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libflann.so
-- Found LZ4
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/liblz4.so
-- Found Glog
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
-- Found SQLite3
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Found Git: /usr/bin/git (found version "2.17.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- The CUDA compiler identification is NVIDIA 11.7.64
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found Qt
--   Module : /root/anaconda3/lib/cmake/Qt5Core
--   Module : /root/anaconda3/lib/cmake/Qt5OpenGL
--   Module : /root/anaconda3/lib/cmake/Qt5Widgets
-- Found CGAL
--   Includes : /usr//include
--   Libraries : /usr/lib/x86_64-linux-gnu/libCGAL.so.13.0.1
-- Build type not specified, using Release
-- Enabling SIMD support
-- Enabling OpenMP support
-- Disabling interprocedural optimization
CMake Error at CMakeLists.txt:255 (message):You must set CMAKE_CUDA_ARCHITECTURES to e.g.  'native', 'all-major', '70',etc.  More information athttps://cmake.org/cmake/help/latest/prop_tgt/CUDA_ARCHITECTURES.html

排查问题,大概意思是编译时未指定显卡,在CMakeList中加入如下代码

set(CMAKE_CUDA_ARCHITECTURES "native")

然后继续报错:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
METIS_INCLUDE_DIRSused as include directory in directory /root/wcf/colmapused as include directory in directory /root/wcf/colmap/libused as include directory in directory /root/wcf/colmap/lib/LSDused as include directory in directory /root/wcf/colmap/lib/PBAused as include directory in directory /root/wcf/colmap/lib/PoissonReconused as include directory in directory /root/wcf/colmap/lib/SiftGPUused as include directory in directory /root/wcf/colmap/lib/VLFeatused as include directory in directory /root/wcf/colmap/srcused as include directory in directory /root/wcf/colmap/src/baseused as include directory in directory /root/wcf/colmap/src/controllersused as include directory in directory /root/wcf/colmap/src/estimatorsused as include directory in directory /root/wcf/colmap/src/exe

根据错误,在网上寻找解决方案,得知可以使用Metis库来进行处理。在Ubuntu安装Metis库。

sudo apt-get install libmetis-dev

然后将对应的头文件位置以下述方式写入CMakeList.txt

set(METIS_INCLUDE_DIRS /usr/include/metis.h)

然后再次cmake,出现了一个新的问题。

-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.14.0 installed in: /usr/local with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SuiteSparse, CXSparse, SchurSpecializations, OpenMP, Multithreading]
-- Found Eigen
--   Includes : /usr/include/eigen3
-- Found FreeImage
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libfreeimage.so
-- Found FLANN
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libflann.so
-- Found LZ4
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/liblz4.so
-- Found Glog
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
-- Found SQLite3
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Found Qt
--   Module : /root/anaconda3/lib/cmake/Qt5Core
--   Module : /root/anaconda3/lib/cmake/Qt5OpenGL
--   Module : /root/anaconda3/lib/cmake/Qt5Widgets
-- Found CGAL
--   Includes : /usr//include
--   Libraries : /usr/lib/x86_64-linux-gnu/libCGAL.so.13.0.1
-- Build type not specified, using Release
-- Enabling SIMD support
-- Enabling OpenMP support
-- Disabling interprocedural optimization
-- Enabling CUDA support (version: 11.7.64, archs: native)
-- Enabling GUI support
-- Enabling OpenGL support
-- Disabling ccache support
-- Disabling profiling support
-- Enabling CGAL support
-- Configuring done
CMake Warning at cmake/CMakeHelper.cmake:137 (add_executable):Cannot generate a safe runtime search path for target colmap_exe becausefiles in some directories may conflict with libraries in implicitdirectories:runtime library [liblz4.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:/root/anaconda3/libruntime library [libtbbmalloc.so.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:/root/anaconda3/libruntime library [libtbb.so.2] in /usr/lib/x86_64-linux-gnu may be hidden by files in:/root/anaconda3/libruntime library [libsqlite3.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:/root/anaconda3/libruntime library [libgmp.so.10] in /usr/lib/x86_64-linux-gnu may be hidden by files in:/root/anaconda3/libSome of these libraries may not be found correctly.
Call Stack (most recent call first):src/exe/CMakeLists.txt:38 (COLMAP_ADD_EXECUTABLE)

大概意思是在构建colmap_exe目标时,由于存在潜在的冲突,无法为它生成安全的运行时搜索路径。CMake发现/usr/lib/x86_64-linux-gnu目录中的某些库可能会被/root/anaconda3/lib目录中的库隐藏,这可能会导致colmap_exe找不到正确的库。解决方案很简单,将anaconda3改名,编译后再改回来即可。

此后成功安装。

安装ceres-solver以及colmap遇到的坑相关推荐

  1. 【环境配置】ceres solver安装

    1. 安装 github地址 # CMake sudo apt-get install cmake # google-glog + gflags sudo apt-get install libgoo ...

  2. Ceres Solver安装

    先是ceres solver的依赖安装 # CMake sudo apt-get install cmake # google-glog + gflags sudo apt-get install l ...

  3. Ceres Solver安装及bug解决

    Ceres Solver安装与入门使用 安装教程:http://www.ceres-solver.org/installation.html 点击下载最新的稳定版 解压.编译 .测试.安装 1.Lin ...

  4. 在windows系统中使用Ceres非线性优化库:(一)安装Ceres库

    (一)安装Ceres库                         1.用vcpkg安装Ceres库                 1.1.安装vcpkg 1.2.安装Ceres 1.3.配置C ...

  5. Ceres Solver 非线性优化库

    Ceres Solver 非线性优化库 1. Ceres Solver 2. 下载安装 3. 简易例程 4. 环境运行 5. 非线性拟合 1. Ceres Solver Ceres solver 是谷 ...

  6. Ceres Solver从零开始手把手教学使用

    目录 一 .简介 二.安装 三.介绍 四.Hello Word! 五.导数 1 数值导数 2解析求导 六.实践 Powell函数 一 .简介 笔者已经半年没有更新新的内容了,最近学习视觉SLAM的过程 ...

  7. ubuntu安装ceres、pyceres及对应报错解决

    目录 一.安装流程 二.报错解决 1.std报错 2.报错eigen问题 3.未定义的引用,发现libm和libc版本不同 4.c++: fatal error: 已杀死 signal termina ...

  8. Ubuntu安装Ceres

    文章目录 前言 一.基本概念 二.操作步骤 1.安装依赖 2.下载 3.编译配置 总结 前言 Ceres Solver 是一个开源 C++库,用于建模和解决大型.复杂的优化问题.它可用于解决具有边界约 ...

  9. Ubuntu安装Ceres库-安装依赖时报错:E:无法定位软件包 libcxsparse3.1.2_朱国鑫的博客-CSDN博客

    Ubuntu安装Ceres库-安装依赖时报错:E:无法定位软件包 libcxsparse3.1.2_朱国鑫的博客-CSDN博客

  10. [异常解决] ubuntu上安装虚拟机遇到的问题(vmware坑了,virtual-box简单安装,在virtual-box中安装精简版win7)

    [异常解决] ubuntu上安装虚拟机遇到的问题(vmware坑了,virtual-box简单安装,在virtual-box中安装精简版win7) 参考文章: (1)[异常解决] ubuntu上安装虚 ...

最新文章

  1. JAVscript对象
  2. SRS前需求双向追溯解决方法
  3. 有赞的交易系统架构困局以及破局之道
  4. .NET开发人员犯的6大安全错误
  5. python虚拟人脸生成_GitHub - 597111463/seeprettyface-generator-yellow: 这是一个用StyleGAN训练出的黄种人人脸生成器...
  6. 将常规项目转换为Maven项目
  7. linux系统管理学习笔记之八---linux文件与目录的管理及权限
  8. 【Python实例第29讲】递归的特征排除法
  9. 框架-vue-cli
  10. maven常用命令大全(附详细解释)
  11. debezium报错处理系列七:The database history couldn‘t be recovered. Consider to increase the value for datab
  12. 使用简单的神经网络实现区分鸢尾花类别
  13. C#发送ZPL控制斑马Zebra打印机源码
  14. 使用vfork、exec系列函数、wait/waited实现system函数的功能
  15. JAVA学习笔记JEECG BOOT介绍
  16. Java、JSP基于Web的师生互动系统的设计与实现
  17. 全国2010年10月考试电子商务与电子政务试题
  18. NY8B062E单片机软件IC开发(OTP MCU)
  19. 如何使用电视遥控器在Windows中控制Netflix
  20. 微信平台更改html,微信公众平台.html

热门文章

  1. 基于量桨搭建AI量子通信模拟平台,优化量子通信协议
  2. 计算机win e怎么按,win7电脑中的Win+E组合键无法使用怎么办?
  3. php 判断是否是域名,用PHP判断顶级域名
  4. 请用面向对象的思想,谈一谈这次面试的过程
  5. java中byte(129)= -127?分析
  6. Java: 两个虚数的加减法
  7. Java入门测试-折纸到珠穆朗玛峰高度
  8. Android 生命周期方法
  9. fiery服务器系统安装,fiery服务器打印设置
  10. 前端代码编码和设计规范系列——JavaScript编程规范