服务器安装colmap简要记录

在尝试执行项目https://github.com/ahojnnes/local-feature-evaluation/ 时,安装colmap的过程遇到的问题简要记录一下。主要是由于自己不熟悉linux和非root用户下配置和安装。

  1. 解压Eigen3后,在 ceres-solver-1.14.0 的 FindEigen.cmake中添加Eigen3 的路径,否则会找不到Eigen3.

  2. 在colmap/build中执行 cmake … -DTESTS_ENABLED=OFF 时,添加上ceres-solver 的路径,-DCMAKE_PREFIX_PATH=/home/fanbin/ceres-solver;否则会报错:

    CMake Error at CMakeLists.txt:87 (find_package):
    By not providing "FindCeres.cmake" in CMAKE_MODULE_PATH this project has
    asked CMake to find a package configuration file provided by "Ceres", but
    CMake did not find one.
    
    Could not find a package configuration file provided by "Ceres" with any of the following names:
    
    CeresConfig.cmake
    ceres-config.cmake
    
    Add the installation prefix of "Ceres" to CMAKE_PREFIX_PATH or set
    "Ceres_DIR" to a directory containing one of the above files.  If "Ceres"
    provides a separate development package or SDK, be sure it has been
    installed.
    
    
    

    在CMakeLists.txt 中第一行添加set (CMAKE_PREFIX_PATH “/home/fanbin/ceres-solver”)这么做应该也可以。

  3. 在colmap的 FindEigen.cmake中添加了 Eigen3 的路径

  4. 安装freeimage,make编译完成后.h和.a文件都在freeimage/dist文件夹下。在colmap/cmake中的findfreeimage.cmake中添加freeimage的路径;否则报错如下:

    CMake Error at cmake/FindFreeImage.cmake:91 (message):
      Could not find FreeImage
    Call Stack (most recent call first):
      CMakeLists.txt:99 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/fanbin/colmap/build/CMakeFiles/CMakeOutput.log".
    See also "/home/fanbin/colmap/build/CMakeFiles/CMakeError.log".
    
    

    没有sudo权限的话无法用make DESTDIR= install安装。不知为什么。

  5. 安装 ceres-solver 的时候,即使设置了安装目录ceres-solver,也只是把include和lib放在了ceres-solver中,二进制文件和一些.a文件仍然是在ceres-bin的bin目录和lib目录下。可见ceres-solver-1.14.0的Cmakelists.txt的79-81行。

  6. 用cmake指定安装路径:

  • passing it as a command line argument just like Job mentioned:

    cmake -DCMAKE_INSTALL_PREFIX=< install_path > ..
    
    • assigning value to it in CMakeLists.txt:
    SET(CMAKE_INSTALL_PREFIX < install_path >)
    

    But do remember to place it BEFORE PROJECT(< project_name>) command, otherwise it will not work!(before和after都试试)

  1. 以上问题都注意到,即可cmake成功

     Found required Ceres dependency: Eigen version 3.3.5 in /home/fanbin/libs/eigen
    -- Found required Ceres dependency: glog
    -- Found required Ceres dependency: gflags
    -- Found Ceres version: 1.14.0 installed in: /home/fanbin/ceres-solver with components: [EigenSparse, SparseLinearAlgebraLibrary, LAPACK, SchurSpecializations, OpenMP, Multithreading]
    -- Boost version: 1.54.0
    -- Found the following Boost libraries:
    --   program_options
    --   filesystem
    --   graph
    --   regex
    --   system
    --   unit_test_framework
    -- Found Eigen
    --   Includes : /home/fanbin/libs/eigen
    -- Found FreeImage
    --   Includes : /home/fanbin/FreeImage-3.18.0/Dist
    --   Libraries : /home/fanbin/FreeImage-3.18.0/Dist/libfreeimage.a
    -- Found Glog
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libglog.so
    -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
    -- Found Glew
    --   Includes : /usr/include
    --   Libraries : /usr/lib/x86_64-linux-gnu/libGLEW.so
    -- Found Git: /usr/bin/git (found version "1.9.1")
    -- Found Threads: TRUE
    -- Found Qt
    --   Module : /home/fanbin/anaconda2/lib/cmake/Qt5Core
    --   Module : /home/fanbin/anaconda2/lib/cmake/Qt5OpenGL
    --   Module : /home/fanbin/anaconda2/lib/cmake/Qt5Widgets
    -- Build type not specified, using Release
    -- Enabling SIMD support
    -- Enabling OpenMP support
    -- Disabling interprocedural optimization
    -- Autodetected CUDA architecture(s):  6.1 6.1 6.1 6.1 6.1 6.1 6.1 6.1
    -- Enabling CUDA support (version: 8.0, archs: sm_61)
    -- Enabling OpenGL support
    -- Disabling profiling support
    -- Disabling CGAL support
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/fanbin/colmap/build
    
  2. make后报错:

    /home/fanbin/anaconda2/lib/libQt5Widgets.so.5.6.2: undefined reference to `operator delete[](void*, unsigned long)@CXXABI_1.3.9'
    /home/fanbin/anaconda2/lib/libQt5Core.so.5.6.2: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8'
    /home/fanbin/anaconda2/lib/libQt5Widgets.so.5.6.2: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'
    collect2: error: ld returned 1 exit status
    make[2]: *** [src/exe/colmap] Error 1
    make[1]: *** [src/exe/CMakeFiles/colmap_exe.dir/all] Error 2
    make: *** [all] Error 2
    fanbin@GPU:~/colmap/build$
    

    解决方案:
    据说是c++11和依赖libstdc++库的原因。也有人说把g++升级到5.3以上就可以,因为Qt的库是较高版本的g++编译的。
    在此,未升级gcc,用这条命令cmake,然后就可make成功。gcc4.8用c++11需要指定出来。

    cmake .. -DTESTS_ENABLED=OFF -DCMAKE_EXE_LINKER_FLAGS='-static-libstdc++ -std=c++11'
    
    

9.附上一些教程:
非root安装软件:https://www.tlanyan.me/work-with-linux-without-root-permission/
cmake教程:https://www.cnblogs.com/52php/p/5681751.html
screen使用:https://www.cnblogs.com/ywl925/p/3604530.html

### Colmap服务器安装与配置 为了在服务器环境中成功安装和配置 COLMAP,需遵循一系列特定的操作流程。COLMAP 是一款专为3D重建设计的强大工具[^1]。 #### 准备工作环境 确保服务器操作系统支持必要的依赖项,并更新现有包管理器至最新版本。对于基于 Debian 或 Ubuntu 的系统而言,可以通过以下命令来准备: ```bash sudo apt-y ``` #### 安装依赖库 安装编译 COLMAP 所必需的基础开发库和其他组件。这通常涉及图形库、线性代数库以及其他科学计算所需的资源。执行如下指令完成这些依赖关系的设置: ```bash sudo apt-get install build-essential cmake git libboost-all-dev \ libsuitesparse-dev libeigen3-dev qtbase5-dev \ libqt5opengl5-dev libcgal-dev libjpeg-turbo8-dev \ libpng-dev libtiff5-dev zlib1g-dev ``` #### 下载并编译 COLMAP 源码 获取官方 GitHub 仓库中的 COLMAP 源代码文件,切换到期望发布的分支或标签页之后再进行本地克隆操作。接着按照给定路径进入项目目录开始构建过程: ```bash git clone https://github.com/colmap/colmap.git ~/colmap cd ~/colmap mkdir build cd build cmake .. make -j$(nproc) ``` #### 设置运行环境变量 为了让系统能够识别新安装的应用程序,在 `.bashrc` 文件中添加相应的路径声明语句以便于后续调用该应用程序时无需每次都指定完整路径名: ```bash echo 'export PATH=~/colmap/build:$PATH' >> ~/.bashrc source ~/.bashrc ``` #### 测试安装成果 最后一步是验证整个安装是否顺利完成。可以尝试启动 GUI 版本或者通过命令行参数测试基本功能是否正常运作: ```bash colmap gui_main # or for command line usage test colmap feature_extractor --ImageReader.camera_model PINHOLE ... ``` 以上步骤涵盖了从准备工作直至最终确认阶段所需采取的主要措施。值得注意的是,具体细节可能会因不同发行版之间的差异而有所变化;因此建议查阅最新的官方文档以获得更详尽指导[^2]。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值