Search code examples
c++homebreweigenceres-solver

What is the simplest way to match the versions for Eigen and Ceres-Solver?


I installed both Eigen and Ceres-Solver with brew as prerequisites for an existing project.

When I run make for the project, I get the following message

Found Eigen dependency, but the version of Eigen found (3.3.1) does not exactly match the version of Eigen Ceres was compiled with (3.3.0). This can cause subtle bugs by triggering violations of the One Definition Rule. See the Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule for more details

My first idea was to compile Ceres-solver from source using the Eigen from brew, but this produced other error messages during make.

Specifically, it builds up to 54% and then prints

[ 54%] Linking C executable ../bin/curve_fitting_c
Undefined symbols for architecture x86_64:
  "___kmpc_atomic_fixed4_sub", referenced from:
      __ZN5Eigen8internal29general_matrix_matrix_productIldLi1ELb0EdLi1ELb0ELi0EE3runElllPKdlS4_lPdldRNS0_15level3_blockingIddEEPNS0_16GemmParallelInfoIlEE in libceres.a(gradient_checker.cc.o)
      __ZN5Eigen8internal29general_matrix_matrix_productIldLi1ELb0EdLi0ELb0ELi0EE3runElllPKdlS4_lPdldRNS0_15level3_blockingIddEEPNS0_16GemmParallelInfoIlEE in libceres.a(dogleg_strategy.cc.o)

__ZN5ceres8internal11EventLoggerC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libceres.a(wall_time.cc.o)
  __ZN5ceres8internal11EventLoggerC1ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libceres.a(wall_time.cc.o)
  __ZN5ceres8internal11EventLoggerD2Ev in libceres.a(wall_time.cc.o)

... Skipping some lines ...

    __ZN5ceres8internal11EventLogger8AddEventERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in libceres.a(wall_time.cc.o)
ld: symbol(s) not found for architecture x86_64
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)

The ceres installation page recommends Eigen 3.2.2 or later, so 3.3.1 should be fine, unless there were some structural changes between 3.2 and 3.3.

My Question:

What is the next step I should try? Installing an older version of Eigen?


Solution

  • I was trying to build ceres from source using the instructions on the ceres website. I'm still not sure why this failed, but building from source using brew (an option that I did not previously know existed) works.

    brew install --build-from-source ceres-solver

    It uses the Eigen dependency installed via brew (Eigen 3.3.1) and does not produce any error messages.