Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtsam does not include <cassert> where assertions are made #1902

Open
mcm001 opened this issue Nov 17, 2024 · 0 comments
Open

Gtsam does not include <cassert> where assertions are made #1902

mcm001 opened this issue Nov 17, 2024 · 0 comments

Comments

@mcm001
Copy link

mcm001 commented Nov 17, 2024

Description

While compiling gtsam for the RoboRIO (an embedded arm32 device), I saw a bunch of compiler errors similar to this (full compile command included for completeness):

[11/302] Building CXX object _deps/gtsam-build/gtsam/CMakeFiles/gtsam.dir/geometry/EssentialMatrix.cpp.o
FAILED: _deps/gtsam-build/gtsam/CMakeFiles/gtsam.dir/geometry/EssentialMatrix.cpp.o 
ccache /home/matt/github/thirdparty-gtsam/bin/arm-frc2024-linux-gnueabi-g++ --sysroot=/home/matt/github/thirdparty-gtsam/arm-nilrt-linux-gnueabi/sysroot -DNDEBUG -Dgtsam_EXPORTS -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-build -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/CppUnitLite -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/metis/include -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/metis/libmetis -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/metis/GKlib -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/cephes -I/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/Eigen -isystem /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/SuiteSparse_config -isystem /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/Spectra -isystem /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/3rdparty/CCOLAMD/Include -Wno-psabi -O2 -g -DNDEBUG -fPIC -fdiagnostics-color=always -Wall -fPIC -Wreturn-local-addr -Werror=return-local-addr -Wreturn-type -Werror=return-type -Wformat -Werror=format-security -Wsuggest-override -g -O3 -Wno-unused-local-typedefs -MD -MT _deps/gtsam-build/gtsam/CMakeFiles/gtsam.dir/geometry/EssentialMatrix.cpp.o -MF _deps/gtsam-build/gtsam/CMakeFiles/gtsam.dir/geometry/EssentialMatrix.cpp.o.d -o _deps/gtsam-build/gtsam/CMakeFiles/gtsam.dir/geometry/EssentialMatrix.cpp.o -c /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/geometry/EssentialMatrix.cpp
In file included from /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/base/Matrix.h:28,
                 from /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/base/Manifold.h:22,
                 from /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/geometry/BearingRange.h:21,
                 from /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/geometry/Pose3.h:22,
                 from /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/geometry/EssentialMatrix.h:10,
                 from /home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/geometry/EssentialMatrix.cpp:8:
/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/base/Vector.h: In instantiation of 'double gtsam::dot(const V1&, const V2&) [with V1 = Eigen::Matrix<double, 3, 1>; V2 = Eigen::Product<Eigen::Matrix<double, 3, 3>, Eigen::Matrix<double, 3, 1>, 0>]':
/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/geometry/EssentialMatrix.cpp:113:13:   required from here
/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/base/Vector.h:196:10: error: 'assert' was not declared in this scope
  196 |   assert (b.size()==a.size());
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/matt/github/thirdparty-gtsam/build/_deps/gtsam-src/gtsam/base/Vector.h:32:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
   31 | #include <list>
  +++ |+#include <cassert>
   32 | 
[21/302] Building CXX object _deps/gtsam-build/gtsam/CMakeFiles/gtsam.dir/geometry/triangulation.cpp.o
ninja: build stopped: subcommand failed.

Steps to reproduce

  1. Clone https://github.com/mcm001/thirdparty-gtsam and follow build steps in README
  2. Observe compiler errors

Expected behavior

We should probably include what we use. If that's desired, I am happy to go through and spam includes through the gtsam codebase.

Environment

I'm building for RoboRIO, so my toolchain is a bit bespoke. I'm using the roborio toolchain from opensdk, which I get via curl -SL https://github.com/wpilibsuite/opensdk/releases/download/v2024-1/cortexa9_vfpv3-roborio-academic-2024-x86_64-linux-gnu-Toolchain-12.1.0.tgz | tar xzf - --strip-components=2. The host I am cross-compiling from is Ubuntu 22.04 under WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant