Installation problems on Ubuntu 16.04

2,230 views
Skip to first unread message

michaels...@gmail.com

unread,
May 31, 2017, 11:14:27 AM5/31/17
to Ceres Solver
I am trying to get Ceres to work on ubuntu 16.04. However, I run into several difficulties

1. Try to use libceres-dev via a simple sudo apt-get install libceres-dev

leads to

/usr/include/ceres/internal/port.h:37:10: fatal error: 'ceres/internal/config.h' file not found

2. Trying to build ceres myself goes fine (using CLANG) until crashes at

Scanning dependencies of target curve_fitting_c
[ 95%] Building C object examples/CMakeFiles/curve_fitting_c.dir/curve_fitting.c.o
[ 95%] Linking C executable ../bin/curve_fitting_c
../lib/libceres.a(gradient_checker.cc.o): In function `.omp_outlined.':
/opt/google/ceres-solver/internal/ceres/gradient_checker.cc:(.text+0x27e8): undefined reference to `omp_get_thread_num'
/opt/google/ceres-solver/internal/ceres/gradient_checker.cc:(.text+0x27ef): undefined reference to `omp_get_num_threads'

Any suggestions?

Cheers, Mike

Alex Stewart

unread,
May 31, 2017, 11:42:38 AM5/31/17
to ceres-...@googlegroups.com
When you were trying this:

> 1. Try to use libceres-dev via a simple sudo apt-get install libceres-dev
>
> leads to
>
> /usr/include/ceres/internal/port.h:37:10: fatal error: 'ceres/internal/config.h' file not found

what were you doing? I can’t see how you could be compiling without /usr/include as an include path, so it looks like the package is broken, as it should have installed:

/usr/include/ceres/internal/config.h

which it does not appear to have done, what is the output of

dpkg -L libceres-dev

? For this:

> 2. Trying to build ceres myself goes fine (using CLANG) until crashes at

What version of Clang is this? What is the output from the CMake configure step for Ceres? Until 3.8 from memory Clang didn’t support OpenMP.

-Alex

michaels...@gmail.com

unread,
Jun 1, 2017, 5:20:28 AM6/1/17
to Ceres Solver
Hi Alex,

I tried to compile a file including ceres.h (compiling on Ubuntu 16.04 with CLANG 4.0)

In file included from /usr/include/ceres/ceres.h:37:
In file included from /usr/include/ceres/autodiff_cost_function.h:132:
In file included from /usr/include/ceres/internal/autodiff.h:148:
In file included from /usr/include/ceres/internal/variadic_evaluate.h:38:
In file included from /usr/include/ceres/types.h:42:
/usr/include/ceres/internal/port.h:37:10: fatal error: 'ceres/internal/config.h' file not found
#include "ceres/internal/config.h"

dpkg -L libceres-dev
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libceres-dev
/usr/share/doc/libceres-dev/copyright
/usr/include
/usr/include/ceres
/usr/include/ceres/sized_cost_function.h
/usr/include/ceres/loss_function.h
/usr/include/ceres/cubic_interpolation.h
/usr/include/ceres/dynamic_autodiff_cost_function.h
/usr/include/ceres/local_parameterization.h
/usr/include/ceres/dynamic_cost_function_to_functor.h
/usr/include/ceres/autodiff_cost_function.h
/usr/include/ceres/c_api.h
/usr/include/ceres/covariance.h
/usr/include/ceres/conditioned_cost_function.h
/usr/include/ceres/gradient_problem_solver.h
/usr/include/ceres/crs_matrix.h
/usr/include/ceres/jet.h
/usr/include/ceres/version.h
/usr/include/ceres/fpclassify.h
/usr/include/ceres/types.h
/usr/include/ceres/numeric_diff_options.h
/usr/include/ceres/autodiff_local_parameterization.h
/usr/include/ceres/gradient_checker.h
/usr/include/ceres/rotation.h
/usr/include/ceres/problem.h
/usr/include/ceres/normal_prior.h
/usr/include/ceres/gradient_problem.h
/usr/include/ceres/iteration_callback.h
/usr/include/ceres/solver.h
/usr/include/ceres/ordered_groups.h
/usr/include/ceres/dynamic_numeric_diff_cost_function.h
/usr/include/ceres/numeric_diff_cost_function.h
/usr/include/ceres/internal
/usr/include/ceres/internal/manual_constructor.h
/usr/include/ceres/internal/autodiff.h
/usr/include/ceres/internal/disable_warnings.h
/usr/include/ceres/internal/numeric_diff.h
/usr/include/ceres/internal/macros.h
/usr/include/ceres/internal/variadic_evaluate.h
/usr/include/ceres/internal/reenable_warnings.h
/usr/include/ceres/internal/scoped_ptr.h
/usr/include/ceres/internal/eigen.h
/usr/include/ceres/internal/port.h
/usr/include/ceres/internal/fixed_array.h
/usr/include/ceres/cost_function.h
/usr/include/ceres/cost_function_to_functor.h
/usr/include/ceres/ceres.h
/usr/lib
/usr/lib/libceres.a
/usr/share/doc/libceres-dev/changelog.Debian.gz
/usr/lib/libceres.so

Regarding the build using CMAKE:

-- Detected Ceres version: 1.13.0 from /opt/google/ceres-solver/include/ceres/version.h
-- No preference for use of exported Eigen CMake configuration set, and no hints for include directory provided. Defaulting to preferring an installed/exported Eigen CMake configuration if available.
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found Eigen version 3.2.92: /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.
   ===============================================================

-- A library with BLAS API found.
-- Found LAPACK library: /usr/lib/liblapack.so;/usr/lib/libf77blas.so;/usr/lib/libatlas.so
-- Found BLAS library: /usr/lib/libf77blas.so;/usr/lib/libatlas.so
-- Building without SuiteSparse.
-- Building without CXSparse.
   ===============================================================
   Compiling without any sparse library: SuiteSparse, CXSparse 
   & Eigen (Sparse) are all disabled or unavailable.  No sparse 
   linear solvers (SPARSE_NORMAL_CHOLESKY & SPARSE_SCHUR)
   will be available when Ceres is used.
   ===============================================================
-- 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.
-- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
-- Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
-- Found Google Flags header in: /usr/include, in namespace: google
-- No preference for use of exported glog CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported glog CMake configuration if available.
-- Failed to find installed glog CMake configuration, searching for glog build directories exported with CMake.
-- Failed to find an installed/exported CMake configuration for glog, will perform search for installed glog components.
-- Found Google Log (glog). Assuming glog was built with gflags support as gflags was found. This will make gflags a public dependency of Ceres.
-- Building with OpenMP.
-- 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.
-- Enabling CERES_NO_SUITESPARSE in Ceres config.h
-- 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 done
-- Generating done
-- Build files have been written to: /opt/google/ceres-bin

I actually did build SuiteSparse as well, so it is also a mystery to me why it is not detected. For some reason it did not go to /usr/local after a make install, but I copied the SuiteSparse libs there manually. The build only fails at curve_fitting_c, it does built the other targets correctly. However, I can't do a make install for after this. [May be there is a way to exclude just curve_fitting_c]

Cheers, Mike 

Alex Stewart

unread,
Jun 1, 2017, 6:00:15 AM6/1/17
to ceres-...@googlegroups.com
So I think the problem with the C example is that we were only adding the OpenMP flags to the CXX flags, not the C flags - please try this CL that should fix this:


The package just looks like it’s missing the auto-generated (at CMake configure time) config.h, which is weird as it is definitely installed via a make install.

-Alex

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/ca57064c-f5b8-473e-8c30-2753720e3d1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philipp Huebner

unread,
Jun 1, 2017, 6:58:08 AM6/1/17
to ceres-...@googlegroups.com
Hi,

Am 31.05.2017 um 17:42 schrieb Alex Stewart:
> I can’t see how you could be compiling without /usr/include as an
> include path, so it looks like the package is broken

it is definitely broken in Ubuntu 16.04, which ships 1.11.0~dfsg0-2.

The changelog of newer versions includes important fixes, like
* libceres-dev: install config.h (Closes: #823623)
* Added patch to allow compiling with GCC 6 (Closes: #811987)
* Install cmake files into libceres-dev

Unfortunately it doesn't seem that anyone from the Ubuntu folks is
interested in fixing the package in 16.04, which is 1.11.0~dfsg0-2.

I can "only" upload to Debian.
Debian Stretch, which should be released on June 17th, ships
1.12.0+dfsg0-1 which AFAICT has been working fine for quite some time
now and is available in Ubuntu 17.04 and newer.

However, on Ubuntu there's still
https://bugs.launchpad.net/ubuntu/+source/ceres-solver/+bug/1678043
and I have no idea what Ubuntu does different from Debian in regards to
cmake to cause this.


Regards,
--
.''`. Philipp Huebner <deba...@debian.org>
: :' : pgp fp: 6719 25C5 B8CD E74A 5225 3DF9 E5CA 8C49 25E4 205F
`. `'`
`-

signature.asc

michaels...@gmail.com

unread,
Jun 1, 2017, 9:22:53 AM6/1/17
to Ceres Solver
Yes, that fixed the make issue! Thanks Alex

I have some other issues as well (SuiteSparse not found and selecting tr1/memory instead of memory), but will open a separate thread for that.

Mike

Alex Stewart

unread,
Jun 1, 2017, 3:15:29 PM6/1/17
to ceres-...@googlegroups.com
Thanks for reporting this, the fix has now been merged into master.

-Alex

Reply all
Reply to author
Forward
0 new messages