errors when building on CentOS 7

915 views
Skip to first unread message

spe...@cs.washington.edu

unread,
Feb 3, 2016, 2:04:08 PM2/3/16
to Ceres Solver
I'm having trouble building on a freshly-built CentOS 7 box.

I installed "eigen3-devel" and "glog" and "gflags" and "suitesparse-devel" and "atlas-devel" from RPMs.

Sadly, even if I try to tell it where the GFlags installation is located, I get errors:

[root@brew build]# /usr/local/cmake3/bin/cmake -DCXSPARSE=OFF -DGFLAGS_LIBRARY=/usr/lib64/libgflags.so -DGFLAGS_INCLUDE_DIR=/usr/include/ ../ceres-solver/
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detected Ceres version: 1.12.0 from /tmp/ceres-solver/include/ceres/version.h
-- Found Eigen: /usr/include/eigen3 (found version "3.2.5") 
-- Found Eigen version 3.2.5: /usr/include/eigen3

   ===============================================================
   Disabling the use of Eigen as a sparse linear algebra library.
   This does not affect the covariance estimation algorithm 
   which can still use the EIGEN_SPARSE_QR algorithm.
   ===============================================================

-- Looking for sgemm_
-- Looking for sgemm_ - found
-- Looking for pthread.h
-- Looking for 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
-- Found Threads: TRUE  
-- A library with BLAS API found.
-- Found LAPACK library: /lib64/liblapack.so;/lib64/libblas.so
-- Found BLAS library: /lib64/libblas.so
-- A library with BLAS API found.
-- Found AMD library: /lib64/libamd.so
-- Found AMD header in: /usr/include/suitesparse
-- Found CAMD library: /lib64/libcamd.so
-- Found CAMD header in: /usr/include/suitesparse
-- Found COLAMD library: /lib64/libcolamd.so
-- Found COLAMD header in: /usr/include/suitesparse
-- Found CCOLAMD library: /lib64/libccolamd.so
-- Found CCOLAMD header in: /usr/include/suitesparse
-- Found CHOLMOD library: /lib64/libcholmod.so
-- Found CHOLMOD header in: /usr/include/suitesparse
-- Found SuiteSparseQR library: /lib64/libspqr.so
-- Found SuiteSparseQR header in: /usr/include/suitesparse
-- Found Intel Thread Building Blocks (TBB) library: /lib64/libtbb.so, assuming SuiteSparseQR was compiled with TBB.
-- Found Intel Thread Building Blocks (TBB) Malloc library: /lib64/libtbbmalloc.so
-- Found SuiteSparse_config library: /lib64/libsuitesparseconfig.so
-- Found SuiteSparse_config header in: /usr/include/suitesparse
-- Adding librt: /lib64/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing).
-- Did not find METIS library (optional SuiteSparse dependency)
-- Found SuiteSparse: TRUE (found version "4.0.2") 
-- Found SuiteSparse 4.0.2, building with SuiteSparse.
-- Building without CXSparse.
-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /lib64/cmake/gflags
-- Detected broken gflags install in: /lib64/cmake/gflags, version: 2.1.1 <= 2.1.2 which defines gflags_LIBRARIES = gflags which is not an imported CMake target, see: https://github.com/gflags/gflags/issues/110.  Attempting to fix by detecting correct gflags target.
-- Found valid gflags target: gflags-shared, updating gflags_LIBRARIES.
-- Detected gflags version: 2.1.1
-- Failed to find gflags - Could not find file: //include/gflags/gflags.h containing namespace information in gflags install located at: //include.
CMake Error at cmake/FindGflags.cmake:219 (file):
  file failed to open for reading (No such file or directory):

    //include/gflags/gflags.h
Call Stack (most recent call first):
  cmake/FindGflags.cmake:397 (gflags_check_gflags_namespace_using_regex)
  CMakeLists.txt:321 (find_package)


-- Failed to find gflags - Failed to determine gflags namespace using regex for gflags version: 2.1.1 exported here: /lib64/cmake/gflags using CMake.
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Failed
-- Performing Test GFLAGS_IN_GFLAGS_NAMESPACE
-- Performing Test GFLAGS_IN_GFLAGS_NAMESPACE - Success
-- Found Gflags: /usr/include  
-- Found Google Flags header in: /usr/include, in namespace: gflags
-- Found Glog: /usr/include  
-- Found Google Log header in: /usr/include
-- Building with OpenMP.
-- Performing Test COMPILER_HAS_CXX11_FLAG
-- Performing Test COMPILER_HAS_CXX11_FLAG - Success
-- Looking for C++ include unordered_map
-- Looking for C++ include unordered_map - not found
-- Looking for C++ include tr1/unordered_map
-- Looking for C++ include tr1/unordered_map - found
-- Found tr1/unordered_map/set in std::tr1 namespace.
-- Looking for C++ include memory
-- Looking for C++ include memory - found
-- Performing Test HAVE_SHARED_PTR_IN_STD_NAMESPACE
-- Performing Test HAVE_SHARED_PTR_IN_STD_NAMESPACE - Failed
-- Performing Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE
-- Performing Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE - Failed
-- Looking for C++ include tr1/memory
-- Looking for C++ include tr1/memory - found
-- Performing Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER
-- Performing Test HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER - Success
-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.
-- Building Ceres as a static library.
-- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release.
-- Creating configured Ceres config.h output directory: /tmp/build/config/ceres/internal
-- Enabling CERES_NO_CXSPARSE in Ceres config.h
-- Enabling CERES_USE_OPENMP in Ceres config.h
-- Enabling CERES_HAVE_PTHREAD in Ceres config.h
-- Enabling CERES_HAVE_RWLOCK in Ceres config.h
-- Enabling CERES_TR1_UNORDERED_MAP in Ceres config.h
-- Enabling CERES_TR1_MEMORY_HEADER in Ceres config.h
-- Enabling CERES_TR1_SHARED_PTR in Ceres config.h
-- Build the examples.
-- Configuring incomplete, errors occurred!
See also "/tmp/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/build/CMakeFiles/CMakeError.log".
[root@brew build]# 

Any thoughts?

Thank you.

Best,
Stephen

spe...@cs.washington.edu

unread,
Feb 3, 2016, 2:14:31 PM2/3/16
to Ceres Solver
I should add that it's not finding /usr/lib64/libgflags.so or /usr/include/gflags/gflags.h, even though I'm pointing CMake to the right places.


Alex Stewart

unread,
Feb 3, 2016, 6:28:21 PM2/3/16
to ceres-...@googlegroups.com
Stephen,

This:

[root@brew build]# /usr/local/cmake3/bin/cmake -DCXSPARSE=OFF -DGFLAGS_LIBRARY=/usr/lib64/libgflags.so -DGFLAGS_INCLUDE_DIR=/usr/include/

is not doing what you think it’s doing, as per the docs in FindGflags.cmake:

GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION

which is on by default, means that CMake will prefer an exported gflags configuration if one exists (and you don’t pass the expected hint variables: GFLAGS_INCLUDE/LIBRARY_DIR_HINTS) - which it does:

-- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
-- Found installed version of gflags: /lib64/cmake/gflags
-- Detected broken gflags install in: /lib64/cmake/gflags, version: 2.1.1 <= 2.1.2 which defines gflags_LIBRARIES = gflags which is not an imported CMake target, see: https://github.com/gflags/gflags/issues/110.  Attempting to fix by detecting correct gflags target.
-- Found valid gflags target: gflags-shared, updating gflags_LIBRARIES.
-- Detected gflags version: 2.1.1

However - it’s found in /lib64 - i.e. not /usr/lib64.  Unfortunately, the exported gflags configuration is assuming that it will always be found in /usr/lib64/cmake/gflags, and therefore the include directory is, as a relative path: ../../../include (recommended to be relocate-able) which does not exist if it is found via: /lib64/cmake/gflags, hence this error:

-- Failed to find gflags - Could not find file: //include/gflags/gflags.h containing namespace information in gflags install located at: //include.
CMake Error at cmake/FindGflags.cmake:219 (file):
  file failed to open for reading (No such file or directory):

    //include/gflags/gflags.h
Call Stack (most recent call first):
  cmake/FindGflags.cmake:397 (gflags_check_gflags_namespace_using_regex)
  CMakeLists.txt:321 (find_package)

What is going on here:

-- Failed to find gflags - Failed to determine gflags namespace using regex for gflags version: 2.1.1 exported here: /lib64/cmake/gflags using CMake.
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE
-- Performing Test GFLAGS_IN_GOOGLE_NAMESPACE - Failed
-- Performing Test GFLAGS_IN_GFLAGS_NAMESPACE
-- Performing Test GFLAGS_IN_GFLAGS_NAMESPACE - Success
-- Found Gflags: /usr/include  
-- Found Google Flags header in: /usr/include, in namespace: gflags

is actually due to a missing early return() in our gflags_report_not_found() when not finding gflags with REQUIRED - I will add that now.  Although it bailed earlier, it it carrying on and correctly locating (at least) the gflags headers in the standard search path: /usr/include without any reference to the exported gflags configuration.

1) The fastest fix for you is to invoke CMake to build Ceres with:

-DGFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION=OFF

that alone should be enough, as it will tell FindGflags.cmake to ignore exported gflags configurations, and perform a manual search, which should work on your system.

If for some reason the above does *not* work, then you can seed the search by passing:

-DGFLAGS_INCLUDE_DIR_HINTS=/usr/include
-DGFLAGS_LIBRARY_DIR_HINTS=/usr/lib64
-DGFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION=OFF

2) However, it’s worth pointing out that the real issue here is that gflags is accessible via /lib64 - this problem is going to reoccur for any other exported CMake project that’s configured to be relocate-able.  IMO this looks wrong, your /lib64 looks like a symlink to /usr/lib64 - usually these are distinct, and user installed packages would not go into /lib64.

-Alex


Stephen Spencer

unread,
Feb 3, 2016, 6:38:42 PM2/3/16
to ceres-...@googlegroups.com
Thank you, Alex. I tried (1) and the "cmake" step completed successfully.

Best,
Stephen

--
You received this message because you are subscribed to a topic in the Google Groups "Ceres Solver" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ceres-solver/WpCjSj3RiqI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/54F2B3CD-90E6-4DB8-8161-2306F09A8B87%40gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages