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的問題遲遲不能得到解決,還好最後終於找到了問題所在!

可以開始後續工作了!

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