Build gtsam against Eigen from nixpkgs

Without this change, gtsam is built against a vendored copy, which is
different version (3.3) than what's in nixpkgs (3.4). Dependent
packages using Eigen then fail with the following error:

    /nix/store/lic85q2svs3ymv0zkgl727af9khm1x4l-ros-jazzy-gtsam-4.2.0-r4/include/gtsam/base/Vector.h:76:30: error: static assertion failed: Error: GTSAM was built against a different version of Eigen
       76 |     GTSAM_EIGEN_VERSION_MAJOR==EIGEN_MAJOR_VERSION,
          |                              ^
    /nix/store/lic85q2svs3ymv0zkgl727af9khm1x4l-ros-jazzy-gtsam-4.2.0-r4/include/gtsam/base/Vector.h:76:30: note: the comparison reduces to '(3 == 4)'

This is the case for mola_state_estimation (which was recently added
to ROS) as well as for some 3rd-party ROS packages I worked with.
This commit is contained in:
Michal Sojka 2025-01-16 22:09:38 +01:00 committed by Ben Wolsieffer
parent 83e76fd9da
commit 8af42e985e

View file

@ -70,6 +70,14 @@ let
setupHook = ./gazebo-ros-setup-hook.sh;
});
gtsam = rosSuper.gtsam.overrideAttrs ({
cmakeFlags ? [], ...
}: {
# Don't use vendored version of Eigen, which can collide with
# Eigen version in dependent packages.
cmakeFlags = cmakeFlags ++ [ "-DGTSAM_USE_SYSTEM_EIGEN=ON" ];
});
joint-state-publisher-gui = rosSuper.joint-state-publisher-gui.overrideAttrs ({
nativeBuildInputs ? [], postFixup ? "", ...
}: {