MacOS编译安装colmap

最近项目需要进行点云地图的相关处理,因此在测试机上安装了colmap。记录一下安装过程和其中的一些坑如何解决。

机型:2020 MacBookPro (M1)
系统:macOS 12.6.3

colmap官网安装手册
https://colmap.github.io/install.html#id2

  1. 安装homebrew
    过程略
  2. 安装依赖
brew install \
   git \
   cmake \
   boost \
   eigen \
   freeimage \
   flann \
   glog \
   gflags \
   metis \
   suite-sparse \
   ceres-solver \
   qt5 \
   glew \
   cgal \
   sqlite3

外网下载时间较长,请耐心等待。

  1. 源码编译安装colmap
git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake .. -DQt5_DIR=/opt/homebrew/opt/qt@5/lib/cmake/Qt5
make
sudo make install

可能遇到的问题:

  1. 其中cmake后跟的DQt5_DIR,需要根据实际安装路径指定。本地安装时我修改为了:
cmake .. -DQt5_DIR=/usr/local/Cellar/qt@5/5.15.8_1/lib/cmake/Qt5
  1. 编译时可能会报错:
CMake Error at /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
The imported target "Qt5::Core" references the file
"/usr/local/.//mkspecs/macx-clang"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/local/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake"
but not all the files it references.

查阅了github的Qt5项目,发现一个issue:
https://github.com/Homebrew/homebrew/issues/29938

vi /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
找到此处:
get_filename_component(_qt5Core_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
修改为:
get_filename_component(_qt5Core_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../Cellar/qt@5/5.15.8_1/" ABSOLUTE)

再次执行cmake后报错消失。

全部安装完毕后,执行colmap gui即可图形化运行colmap。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值