环境配置: ubuntu20.04+CUDA10.2+eigen3.3.7+cmake3.16.3+ceres1.14
(亲测eiegn3.2不行)
先安装Ceres-Solver:Ceres-Solver 安装ubuntu20.04_weixin_54470372的博客-优快云博客
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake ..
make -j12
sudo make install
1、git checkout dev
日志如下
$ git checkout dev
Already on 'dev'
Your branch is up to date with 'origin/dev'.
2、cmake
(1)遇到报错:Could not find FLANN
sudo apt-get install libpcl-dev pcl-tools
(2)报错:You must set CMAKE_CUDA_ARCHITECTURES to e.g. 'native', 'all-major', '70', etc.
在CMakeLists.txt中添加set(CMAKE_CUDA_ARCHITECTURES "native")
2、make
报错:collect2: error: ld returned 1 exit status
发现都是undefined reference to `TIFF这样的问题
参考:编译报错:undefined reference to `TIFFReadDirectory@LIBTIFF_4.0‘解决方法_wongHome的博客-优快云博客
从官网Index of /libtiff/下载tiff4.0.10的压缩包
mkdir cmakeBuild
cd cmakeBuild
cmake ..
make
sudo make intstall
详情:tiff+ubuntu20.04安装_weixin_54470372的博客-优快云博客
而后成功make
~/3dTracking/colmap-3.7/build$ make
[ 2%] Built target flann
[ 22%] Built target graclus
[ 24%] Built target lsd
[ 26%] Built target pba
[ 30%] Built target poisson_recon
[ 34%] Built target sift_gpu
[ 36%] Built target sqlite3
[ 50%] Built target vlfeat
[ 94%] Built target colmap
[ 96%] Built target colmap_cuda
[ 96%] Linking CXX executable colmap
[100%] Built target colmap_exe
3、make install
日志只放最后几行
-- Installing: /usr/local/lib/colmap/libvlfeat.a
-- Installing: /usr/local/lib/colmap/libcolmap.a
-- Installing: /usr/local/lib/colmap/libcolmap_cuda.a
-- Installing: /usr/local/bin/colmap
-- Set runtime path of "/usr/local/bin/colmap" to ""