ubuntu 16.04 + cuda9.0 + gcc6源码编译colmap3.6

colmap安装网址:colmap

因为想要用cuda,所以需要源码编译

git clone https://github.com/colmap/colmap
#Dependencies from the default Ubuntu repositories:
sudo apt-get install \
    git \
    cmake \
    build-essential \
    libboost-program-options-dev \
    libboost-filesystem-dev \
    libboost-graph-dev \
    libboost-regex-dev \
    libboost-system-dev \
    libboost-test-dev \
    libeigen3-dev \
    libsuitesparse-dev \
    libfreeimage-dev \
    libgoogle-glog-dev \
    libgflags-dev \
    libglew-dev \
    qtbase5-dev \
    libqt5opengl5-dev \
    libcgal-dev
sudo apt-get install libcgal-qt5-dev

Install Ceres Solver:

sudo apt-get install libatlas-base-dev libsuitesparse-dev
git clone https://ceres-solver.googlesource.com/ceres-solver
cd ceres-solver
git checkout $(git describe --tags) # Checkout the latest release
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make
sudo make install

Configure and compile COLMAP:

git clone https://github.com/colmap/colmap.git
cd colmap
git checkout dev
mkdir build
cd build
cmake ..
make
sudo make install

遇到的问题:build过程中遇到多次关于boost regex的问题,先按照github方法尝试修改CMakeLists.txt以及src/util/bitmap.cc,之后重新编译,出现包含:undefined reference to `colmap::Bitmap::operator=(colmap::Bitmap const&)'以及和boost::filesystem相关的错误,按照错误提示,定位到misc.cc文件,发现一句话:// A native implementation in boost::filesystem is only available starting
// from boost version 1.60.,猛然惊醒,因为自己用的boost是1.58的。

ubuntu查看boost版本:
cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION")

于是卸载现有的boost安装版本大于1.6的boost,卸载boost及安装新版本

之后重新编译colmap,取得成功。
在这里插入图片描述还需要指出的是编译过程中要保持gcc版本的一致,不要中间更换gcc版本之后再安装其它软件,我一开始是gcc4.9,中途换了gcc-6,所以有些遇到的问题是因为使用不同版本gcc安装了依赖软件,建议一直使用gcc-6。

其实编译过程中遇到过很多其他的问题,但大都可以在网上找到解决方法,唯独boost的问题迟迟不能得到解决,还好最后终于找到了问题所在!

可以开始后续工作了!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章