Compile on CentOS 6

542 views
Skip to first unread message

Matt U

unread,
Aug 14, 2017, 9:27:07 AM8/14/17
to COLMAP
Has anyone tried to install COLMAP on CentOS 6? I have to install it on this OS because we need to run COLMAP side-by-side with another piece of software that only really runs on CentOS 6. 

Any hints, tips, suggestions much appreciated. The challenge is getting all of the dependencies installed because CentOS uses older libraries. 

~Matt

Johannes Schönberger

unread,
Aug 14, 2017, 9:44:54 AM8/14/17
to col...@googlegroups.com
I have it installed on CentOS, but you are right. You must compile some of the libraries manually. What are the problems?
> --
> You received this message because you are subscribed to the Google Groups "COLMAP" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to colmap+un...@googlegroups.com.
> To post to this group, send email to col...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/colmap/cd99f5fb-fd45-499f-9521-c57529f05e08%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

militarys...@gmail.com

unread,
Aug 14, 2017, 9:51:21 AM8/14/17
to COLMAP
Wow, you are quick on the response -- thanks a lot!

I will detail the installation as well as the problems as I encounter them... I'll work on it over the next few weeks. I'm just glad to know it's possible. Do you happen to have a bash history or steps you can share? 

On my first (quick) attempt I got stuck trying to install ceres-solver -- ran into problems compiling glog. When I have time, I'll re-engage. 

Thanks,
Matt

Matt U

unread,
Aug 31, 2017, 2:37:07 PM8/31/17
to COLMAP, militarys...@gmail.com
Ok, finally got to working on this, and I've finally hit a problem while compiling colmap on Centos 6, and I can use a hint. 

Output from cmake is as follows:
-- Performing Test HAS_SSE_EXTENSION
-- Performing Test HAS_SSE_EXTENSION - Success
-- Performing Test HAS_SSE2_EXTENSION
-- Performing Test HAS_SSE2_EXTENSION - Success
-- Performing Test HAS_SSE3_EXTENSION
-- Performing Test HAS_SSE3_EXTENSION - Success
-- Performing Test HAS_SSE41_EXTENSION
-- Performing Test HAS_SSE41_EXTENSION - Success
-- Performing Test HAS_SSE42_EXTENSION
-- Performing Test HAS_SSE42_EXTENSION - Success
-- Performing Test HAS_AVX_EXTENSION
-- Performing Test HAS_AVX_EXTENSION - Success
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Boost version: 1.41.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   regex
--   system
--   unit_test_framework
-- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0") 
-- Found Eigen3
--   Includes : /usr/include/eigen3
-- Found FreeImage
--   Includes : /usr/include
--   Libraries : /usr/lib64/libfreeimage.so
-- Found Glog
--   Includes : /usr/include
--   Libraries : /usr/lib64/libglog.so
-- Found required Ceres dependency: Eigen version 3.2.5 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Success
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.13.0 installed in: /usr/local with components: [CXSparse, SparseLinearAlgebraLibrary, SchurSpecializations, OpenMP]
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib64/libX11.so
-- Found OpenGL: /usr/lib64/libGL.so  
-- Found Glew
--   Includes : /usr/include
--   Libraries : /usr/lib64/libGLEW.so
-- Found Git: /usr/bin/git (found version "1.7.1") 
-- Found Qt 5.6.1
-- Build type not specified, using RelWithDebInfo
-- Enabling OpenMP support
-- Disabling link-time optimization (-flto)
-- Enabling CUDA support (version: 8.0, archs: sm_61 sm_21)
-- Disabling profiling support
-- Configuring done
-- Generating done
-- Build files have been written to: /home/creare/CREARE/sfm/colmap/build


And make fails with the following:
[  3%] Building CXX object src/base/CMakeFiles/base.dir/graph_cut.cc.o
In file included from /home/creare/gcc-5.4.0/include/c++/5.4.0/backward/hash_set:60:0,
                 from /usr/include/boost/graph/adjacency_list.hpp:25,
                 from /home/creare/CREARE/sfm/colmap/src/base/graph_cut.cc:21:
/home/creare/gcc-5.4.0/include/c++/5.4.0/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^
/home/creare/CREARE/sfm/colmap/src/base/graph_cut.cc:23:45: fatal error: boost/graph/one_bit_color_map.hpp: No such file or directory
compilation terminated.
make[2]: *** [src/base/CMakeFiles/base.dir/graph_cut.cc.o] Error 1
make[1]: *** [src/base/CMakeFiles/base.dir/all] Error 2
make: *** [all] Error 2


I'm guessing boost is too old, but I'm not sure?

Thanks,
Matt

Incidentally, this is my installation script: 
This is what I have so far, my install script:
# Start by installing CUDA (Not included here, already installed)

#####################################
#   Next install yum dependencies   #
#####################################

# enable the fedora EPEL
sudo rpm -ivh epel-release-6-8.noarch.rpm

sudo yum install \
    boost-devel \
    boost-static \
    eigen3-devel \
    suitesparse-devel \
    freeimage-devel\
    gflags-devel \
    glew-devel \
    qt5*

####################################
#   install glog from binary rpm   #
####################################

sudo rpm -ivh glog-0.3.3-8.sdl6.x86_64.rpm
sudo rpm -ivh glog-devel-0.3.3-8.sdl6.x86_64.rpm

###############################################
##      Install ceres solver from source     ##
###############################################

cd ~/sfm
cd ceres-solver
mkdir build
cd build
cmake .. -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF
make -j
sudo make install


########################################
##    Install gcc 5.4.0 from source   ##
########################################
sudo yum groupinstall "Development Tools"
sudo yum install glibc-devel.i686

# NOTE: These instructions worked with gcc 4.8.1 as the compiler
#       I had previously compiled 4.8.1 to install QT5, but that
#       eventually was not needed, though I still had the compiler
#       I forgot to reset my path before compiling the below...


cd ~/sfm
## Need to install gcc 5.4.0 for qt5
# Next line should produce output
md5sum gcc-5.4.0.tar.bz2 | grep 4c626ac2a83ef30dfb9260e6f59c2b30
tar xvjf gcc-5.4.0.tar.bz2
cd gcc-5.4.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-5.4.0/configure -prefix=$HOME/gcc-5.4.0
make
make install
# Installed to ~/gcc-5.4.0
# Add the following alias to .bashrc
echo "alias gogcc540=\"export PATH=\$HOME/gcc-5.4.0/bin:\$PATH && export LD_LIBRARY_PATH=\$HOME/gcc-5.4.0/lib:$HOME/gcc-5.4.0/lib64:\$LD_LIBRARY_PATH && export CC=$HOME/gcc-5.4.0/bin/gcc && export CXX=$HOME/gcc-5.4.0/bin/g++\"" >> ~/.bashrc
source ~/.bashrc
which gcc
gogcc540
which gcc


#########################################
##    Installing colmap from source    ##
#########################################
cd /home/CREARE/sfm/colmap
mkdir build
cd build
cmake .. -DBOOST_STATIC=OFF
make

militarys...@gmail.com

unread,
Aug 31, 2017, 2:55:36 PM8/31/17
to COLMAP, militarys...@gmail.com
Hold the presses... I got a little bit further... apparently there's boost148 package:

sudo yum remove boost-devel
sudo yum remove boost-static
sudo yum install boost148
-devel

sudo ln -s /usr/lib64/libboost_program_options.so.1.48.0 /usr/lib64/libboost_program_options.so
sudo ln -s /usr/lib64/libboost_regex.so.1.48.0 /usr/lib64/libboost_regex.so
sudo ln -s /usr/lib64/libboost_system.so.1.48.0 /usr/lib64/libboost_system.so
sudo ln -s /usr/lib64/libboost_unit_test_framework.so.1.48.0 /usr/lib64/libboost_unit_test_framework.so
sudo ln -s /usr/lib64/libboost_filesystem.so.1.48.0 /usr/lib64/libboost_filesystem.so

mkdir build
cd build
cmake .. -DBOOST_STATIC=OFF -DBOOST_ROOT=/usr/include/boost148/ -DBOOST_LIBRARYDIR=/usr/lib64/
make

This now fails with the following: 
/usr/include/boost148/boost/graph/detail/adjacency_list.hpp:1584:5: note:   template argument deduction/substitution failed:
In file included from /usr/include/boost148/boost/graph/detail/adjacency_list.hpp:31:0,
                 from /usr/include/boost148/boost/graph/adjacency_list.hpp:337,
                 from /home/creare/CREARE/sfm/colmap/src/base/graph_cut.cc:21:
/usr/include/boost148/boost/graph/graph_concepts.hpp:93:17: error: using invalid field ‘boost::concepts::IncidenceGraph<G>::p’
             e = *p.first;
                 ^
make[2]: *** [src/base/CMakeFiles/base.dir/graph_cut.cc.o] Error 1
make[1]: *** [src/base/CMakeFiles/base.dir/all] Error 2
make: *** [all] Error 2


Boost still too old? 

militarys...@gmail.com

unread,
Aug 31, 2017, 3:31:11 PM8/31/17
to COLMAP, militarys...@gmail.com
Sorry for the rapid updates. each time I give up I get another idea, but I think now I'm stuck. 

I got past the boost problem -- installed boost 1.59 
sudo wget http://repo.enetres.net/enetres.repo -O /etc/yum.repos.d/enetres.repo
sudo yum install boost-devel

Now I'm stuck with this one. Probably freeimage is too old, but I'm not having any luck updating it, and it seems like this error is actually thrown in the colmap code: 

~/sfm/colmap/src/util/bitmap.cc: In member function ‘void colmap::Bitmap::CloneMetadata(colmap::Bitmap*) const’:
~/sfm/colmap/src/util/bitmap.cc:507:54: error: ‘FreeImage_CloneMetadata’ was not declared in this scope
   FreeImage_CloneMetadata(data_.get(), target->Data());
                                                      ^
make[2]: *** [src/util/CMakeFiles/util.dir/bitmap.cc.o] Error 1
make[1]: *** [src/util/CMakeFiles/util.dir/all] Error 2
make: *** [all] Error 2

Johannes Schönberger

unread,
Sep 1, 2017, 9:11:38 AM9/1/17
to COLMAP, militarys...@gmail.com
The latest "dev" commits contain an automatic build script: https://github.com/colmap/colmap/blob/dev/scripts/python/build.py

It assumes that Qt, Boost, CUDA are installed on the system. The rest is compiled by the script locally.

Matt U

unread,
Sep 1, 2017, 1:07:48 PM9/1/17
to COLMAP
Thanks Johannes, it seems like this got me further. Now it looks like a linking error... any guesses?  

$ python build.py --path ~/sfm/colmap/build > stdout.txt 2> stderr.txt

$ cat stderr.txt
CMakeFiles/camera_database_test.dir/camera_database_test.cc.o: In function `boost::unit_test::make_test_case(boost::function<void ()()> const&, boost::unit_test::basic_cstring<char const>, boost::unit_test::basic_cstring<char const>, unsigned long)':
camera_database_test.cc:(.text._ZN5boost9unit_test14make_test_caseERKNS_8functionIFvvEEENS0_13basic_cstringIKcEES8_m[_ZN5boost9unit_test14make_test_caseERKNS_8functionIFvvEEENS0_13basic_cstringIKcEES8_m]+0x26): undefined reference to `_ZN5boost9unit_test9ut_detail24normalize_test_case_nameB5cxx11ENS0_13basic_cstringIKcEE'
collect2: error: ld returned 1 exit status
gmake[2]: *** [src/base/camera_database_test] Error 1
gmake[1]: *** [src/base/CMakeFiles/camera_database_test.dir/all] Error 2
gmake: *** [all] Error 2

$ cat stdout.txt
-- Boost version: 1.59.0
-- Found the following Boost libraries:
--   program_options
--   filesystem
--   regex
--   system
--   unit_test_framework
-- Found Eigen3
--   Includes : ~/sfm/colmap/build/__install__/include/eigen3
-- Found FreeImage
--   Includes : ~/sfm/colmap/build/__install__/include
--   Libraries : ~/sfm/colmap/build/__install__/lib/libfreeimage.a
-- Found Glog
--   Includes : ~/sfm/colmap/build/__install__/include
--   Libraries : ~/sfm/colmap/build/__install__/lib/libglog.a
-- Found installed version of Eigen: ~/sfm/colmap/build/__install__/share/eigen3/cmake
-- Found required Ceres dependency: Eigen version 3.3.4 in ~/sfm/colmap/build/__install__/include/eigen3
-- Found installed version of glog: ~/sfm/colmap/build/__install__/lib/cmake/glog
-- Detected glog version: 0.3.5
-- Found required Ceres dependency: glog
-- Found installed version of gflags: ~/sfm/colmap/build/__install__/lib/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.13.0 installed in: ~/sfm/colmap/build/__install__ with components: [CXSparse, SparseLinearAlgebraLibrary, SchurSpecializations, OpenMP]
-- Found Glew
--   Includes : ~/sfm/colmap/build/__install__/include
--   Libraries : ~/sfm/colmap/build/__install__/lib64/libGLEW.so
-- Found Qt 5.6.1
-- Build type specified as Release
-- Enabling OpenMP support
-- Disabling link-time optimization (-flto)
-- Enabling CUDA support (version: 8.0, archs: sm_61 sm_21)
-- Enabling OpenGL support
-- Disabling profiling support
-- Configuring done
-- Generating done
-- Build files have been written to: ~/sfm/colmap/build/colmap-dev/build
[  1%] Built target util_cuda
[  9%] Built target base
[ 11%] Built target controllers
[ 14%] Built target estimators
[ 14%] Built target flann
[ 27%] Built target graclus
[ 27%] Built target lsd
[ 29%] Built target pba
[ 30%] Built target poisson_recon
[ 33%] Built target sift_gpu
[ 35%] Built target sqlite3
[ 41%] Built target vlfeat
[ 43%] Built target mvs_cuda
[ 45%] Built target mvs
[ 46%] Built target optim
[ 46%] Built target retrieval
[ 48%] Built target sfm
[ 54%] Built target ui
[ 58%] Built target util
[ 58%] Linking CXX executable camera_database_test


Successfully installed COLMAP in: ~/sfm/colmap/build/__install__
  To run COLMAP, execute LD_LIBRARY_PATH=~/sfm/colmap/build/__install__/lib ~/sfm/colmap/build/__install__/bin/colmap


 Incidentally, I also had to do the following: 

sudo yum install cmake3
cd /usr/lib64/cmake3
sudo mkdir bin
cd bin
sudo ln -s /usr/bin/ccmake3 ccmake
sudo ln -s /usr/bin/cmake3 cmake
echo "alias gocmake3='export PATH=/usr/lib64/cmake3/bin:\$PATH'" >> ~/.bashrc
source ~/.bashrc
cd colmap/scripts/python
conda create --name py3 python=3
source activate py3
gocmake3
python build.py --path ~/sfm/colmap/build3



Reply all
Reply to author
Forward
0 new messages