Eigen errors when compiling GTSAM 3.2.1

Issue #358 resolved
Anup created an issue

I get the following error when compiling GTSAM 3.2.1 on Windows 10 x64 with Visual Studio 2015 x64 (VS14).

...
C:\gtsam\gtsam\base\SymmetricBlockMatrix.cpp(68): error C2280: 'Eigen::Block<Derived,-1,-1,false> &Eigen::Block<Derived,-1,-1,false>::operator =(const Eigen::Block<Derived,-1,-1,false> &)': attempting to reference a deleted function
2>          with
2>          [
2>              Derived=Eigen::Matrix<double,-1,-1,0,-1,-1>
2>          ]
2>  c:\gtsam\gtsam\3rdparty\eigen\eigen\src/Core/Block.h(143): note: compiler has generated 'Eigen::Block<Derived,-1,-1,false>::operator =' here
2>          with
2>          [
2>              Derived=Eigen::Matrix<double,-1,-1,0,-1,-1>
2>          ]
...

Here's my full config in case it's helpful:

GTSAM_SOURCE_ROOT_DIR: [C:/gtsam]
Boost version: 1.64.0
Found the following Boost libraries:
  serialization
  system
  filesystem
  thread
  program_options
  date_time
  regex
  timer
  chrono
  atomic
Ignoring Boost restriction on optional lvalue assignment from rvalues
[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set $ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).
Found Intel TBB
Building 3rdparty
Could NOT find GeographicLib (missing:  GeographicLib_LIBRARY_DIRS GeographicLib_LIBRARIES GeographicLib_INCLUDE_DIRS) 
Building base
Building geometry
Building inference
Building symbolic
Building discrete
Building linear
Building nonlinear
Building slam
Building navigation
GTSAM Version: 3.2.1
Install prefix: C:/Program Files/GTSAM
Building GTSAM - shared
Building wrap module gtsam
Installing Matlab Toolbox to C:/Program Files/GTSAM/gtsam_toolbox
Building base_unstable
Building geometry_unstable
Building discrete_unstable
Building dynamics_unstable
Building nonlinear_unstable
Building slam_unstable
GTSAM_UNSTABLE Version: 3.2.1
Install prefix: C:/Program Files/GTSAM
Building GTSAM_UNSTABLE - shared
Building wrap module gtsam_unstable
Installing Matlab Toolbox to C:/Program Files/GTSAM/gtsam_toolbox
Wrote C:/gtsam/build/GTSAMConfig.cmake
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
===============================================================
================  Configuration Options  ======================
Build flags                                               
  Build Tests                    : Enabled
  Build examples with 'make all' : Enabled
  Build timing scripts with 'make all': Disabled
  Build static GTSAM library instead of shared: Disabled
  Put build type in library name : Enabled
  Build libgtsam_unstable        : Enabled
  Use Intel TBB                  : Yes
  Eigen will use MKL             : Yes
  Eigen will use MKL and OpenMP  : OpenMP found but GTSAM_WITH_EIGEN_MKL_OPENMP is disabled
  Default allocator              : TBB
Packaging flags                                               
  CPack Source Generator         : TGZ
  CPack Generator                : TGZ
GTSAM flags                                               
  Quaternions as default Rot3    : Enabled
  Runtime consistency checking   : Disabled
  Pose3 retract is full ExpMap   : Enabled
MATLAB toolbox flags                                      
  Install matlab toolbox         : Enabled
  Build Wrap                     : Enabled
===============================================================

Comments (6)

  1. Anup reporter

    I've also tried disabling the unstable modules (GTSAM_BUILD_UNSTABLE) and disabled the exponential maps (GTSAM_POSE3_EXPMAP, GTSAM_ROT3_EXPMAP, GTSAM_USE_QUATERNIONS) and I still get the same error.

  2. Anup reporter

    I think I've fixed the issue. To compile using Visual Studio 2015 and 2017, one must edit the builtin Eigen Macros file, line 309, change from:

    #if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
    

    to

    #if defined(_MSC_VER) && (_MSC_VER < 1900) && (!defined(__INTEL_COMPILER))
    

    Also, as mentioned in #159 and the bottom of the gtsam page, gtsam version 3.2.1 is compatible with boost version <= 1.57, and one should enable Boost_USE_STATIC_LIBS in cmake. Also, if you're using TBB, use the modifications in PR303

  3. Mike Sheffler

    Besides Boost_USE_STATIC_LIBS, did you make any (non-TBB-related) changes?

    I enabled Boost_USE_STATIC_LIBS and got the toolbox (this is Visual Studio 2013 with GTSAM 3.2.1 and boost 1.57) to build, but I get

    Invalid MEX-file 'C:\GTSAM\Gtsam-3.21\gtsam_toolbox\gtsam_wrapper.mexw64': The specified module could not be found.

    when I actually try to run code that exercises the MEX function, which (the error) is usually a result of of a mix up in the CRT the MEX function is trying to use.

    I tried enabling Boost_USE_STATIC_RUNTIME, but that doesn't build.

    I tried enabling GTSAM_BUILD_STATIC_LIBRARY, but got the error (at configure) GTSAM_INSTALL_MATLAB_TOOLBOX and GTSAM_BUILD_STATIC_LIBRARY

    Put another way: How is the downloadable toolbox built? The downloadable toolbox works for me, and building GTSAM seems to work for me, but building the toolbox doesn't seem to work for me.

    If you don't have a suggestion or no one chimes in, I'll open a new issue so other people searching can find it.

  4. Mike Sheffler

    Whoa. Hang on a second: I added

    C:\GTSAM\Gtsam-3.21\bin (which is my CMAKE_INSTALL_PREFIX + \bin), to my PATH variable, and it looks like I am in business.

    I loaded the gtsam_wrapper.mexw64 MEX function I built in Dependency Walker and then loaded the gtsam_wrapper.mexw64 that came with the downloadable toolbox and noticed that the MEX function I built couldn't resolve the location of GTSAM.DLL, but the downloadable one could.

    I hadn't added my previous build (the one where I was using the downloadable toolbox) of GTSAM to the PATH, so I didn't understand what was going on until I remembered that I used the default CMAKE_INSTALL_PREFIX the first time I built GTSAM, which put GTSAM in Program Files, which gets a free pass for being on the PATH. This time around, I had moved to a different prefix because I was afraid the reason it wasn't building the toolbox was that I was installing to a privileged area (the real problem was that I wasn't using Boost_USE_STATIC_RUNTIME).

    So, to summarize, I had to enable, Boost_USE_STATIC_RUNTIME, add CMAKE_INSTALL_PREFIX + \bin, to my PATH variable, and enable GTSAM_INSTALL_ENABLE_TOOLBOX. I also set MATLAB_COMPILER to mex, but I don't know if that did anything or not.

  5. Anup reporter

    I was not compiling the matlab portions of gtsam, but it looks like you've found a way to do it.

  6. Log in to comment