在尝试执行项目https://github.com/ahojnnes/local-feature-evaluation/ 时,安装colmap的过程遇到的问题简要记录一下。主要是由于自己不熟悉linux和非root用户下配置和安装。
-
解压Eigen3后,在 ceres-solver-1.14.0 的 FindEigen.cmake中添加Eigen3 的路径,否则会找不到Eigen3.
-
在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”)这么做应该也可以。
-
在colmap的 FindEigen.cmake中添加了 Eigen3 的路径
-
安装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安装。不知为什么。
-
安装 ceres-solver 的时候,即使设置了安装目录ceres-solver,也只是把include和lib放在了ceres-solver中,二进制文件和一些.a文件仍然是在ceres-bin的bin目录和lib目录下。可见ceres-solver-1.14.0的Cmakelists.txt的79-81行。
-
用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都试试) - assigning value to it in
-
以上问题都注意到,即可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
-
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