artivis / manif

A small C++11 header-only library for Lie theory.
https://artivis.github.io/manif
MIT License
1.46k stars 239 forks source link

Fixes to the build: set the required C++ standard for tests; add a missing header #277

Closed barracuda156 closed 10 months ago

barracuda156 commented 1 year ago

This fixes two issues:

  1. This: https://github.com/artivis/manif/issues/269 (actually fixes instead of discarding or leaving it to an end-user to fix).
  2. Numerous errors due to a missing <cassert> header, like:
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/lie_group_base.h:6,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/SO2.h:6,
                 from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/test/so2/gtest_so2.cpp:1:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/so2/SO2_base.h: In instantiation of 'Eigen::Matrix<typename manif::LieGroupBase<Derived>::Scalar, 2, 1> manif::SO2Base<_Derived>::act(const Eigen::MatrixBase<OtherDerived>&, tl::optional<Eigen::Ref<Eigen::Matrix<typename manif::LieGroupBase<Derived>::Scalar, 2, 1> > >, tl::optional<Eigen::Ref<Eigen::Matrix<typename manif::LieGroupBase<Derived>::Scalar, 2, 2> > >) const [with _EigenDerived = Eigen::Matrix<double, 2, 1>; _Derived = manif::SO2<double>; typename manif::LieGroupBase<Derived>::Scalar = double; typename std::conditional<Eigen::Matrix<typename manif::LieGroupBase<Derived>::Scalar, 2, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type = Eigen::InnerStride<1>; typename std::conditional<Eigen::Matrix<typename manif::LieGroupBase<Derived>::Scalar, 2, 2>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type = Eigen::OuterStride<>]':
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/test/so2/gtest_so2.cpp:509:35:   required from here
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/eigen.h:94:9: error: 'assert' was not declared in this scope
   94 |   assert(x.cols() == 1 && "Expected a vector !"); \
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/eigen.h:97:3: note: in expansion of macro 'assert_is_vector'
   97 |   assert_is_vector(x); \
      |   ^~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/so2/SO2_base.h:243:3: note: in expansion of macro 'assert_vector_dim'
  243 |   assert_vector_dim(v, 2);
      |   ^~~~~~~~~~~~~~~~~
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/SO2.h:10:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/so2/SO2_base.h:1:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
  +++ |+#include <cassert>
    1 | #ifndef _MANIF_MANIF_SO2_BASE_H_
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/eigen.h:64:9: error: 'assert' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
   64 |   assert(x.rows() == dim && "x.rows != "#dim" .");
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/manif-bb3f6758ae467b7f24def71861798d131f157032/include/manif/impl/eigen.h:98:3: note: in expansion of macro 'assert_rows_dim'
   98 |   assert_rows_dim(x, dim);
      |   ^~~~~~~~~~~~~~~
barracuda156 commented 1 year ago

Perhaps I should also change CXX_11_TEST_TARGETS to CXX_14_TEST_TARGETS eslewhere.

barracuda156 commented 1 year ago

@artivis I got it build and tests passing:

--->  Testing manif
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/build" && /usr/bin/make test 
Running tests...
/opt/local/bin/ctest --force-new-ctest-process 
Test project /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_manif/manif/work/build
      Start  1: gtest_misc
 1/16 Test  #1: gtest_misc .......................   Passed    0.08 sec
      Start  2: gtest_rn
 2/16 Test  #2: gtest_rn .........................   Passed    0.23 sec
      Start  3: gtest_so2
 3/16 Test  #3: gtest_so2 ........................   Passed    0.24 sec
      Start  4: gtest_so2_map
 4/16 Test  #4: gtest_so2_map ....................   Passed    0.10 sec
      Start  5: gtest_so2_tangent
 5/16 Test  #5: gtest_so2_tangent ................   Passed    0.08 sec
      Start  6: gtest_so2_tangent_map
 6/16 Test  #6: gtest_so2_tangent_map ............   Passed    0.08 sec
      Start  7: gtest_so3
 7/16 Test  #7: gtest_so3 ........................   Passed    0.39 sec
      Start  8: gtest_se2
 8/16 Test  #8: gtest_se2 ........................   Passed    0.24 sec
      Start  9: gtest_se2_map
 9/16 Test  #9: gtest_se2_map ....................   Passed    0.08 sec
      Start 10: gtest_se2_tangent
10/16 Test #10: gtest_se2_tangent ................   Passed    0.07 sec
      Start 11: gtest_se2_tangent_map
11/16 Test #11: gtest_se2_tangent_map ............   Passed    0.07 sec
      Start 12: gtest_se3
12/16 Test #12: gtest_se3 ........................   Passed    0.39 sec
      Start 13: gtest_se_2_3
13/16 Test #13: gtest_se_2_3 .....................   Passed    0.43 sec
      Start 14: gtest_bundle
14/16 Test #14: gtest_bundle .....................   Passed    0.37 sec
      Start 15: gtest_bundle_single_group
15/16 Test #15: gtest_bundle_single_group ........   Passed    0.88 sec
      Start 16: gtest_bundle_large
16/16 Test #16: gtest_bundle_large ...............   Passed    0.92 sec

100% tests passed, 0 tests failed out of 16

Total Test time (real) =   4.77 sec
barracuda156 commented 1 year ago

Let me add a fix for 32-bit platforms for gtest_rn though.

UPD. Rerunning build and tests now, if everything works as expected, gonna update the PR.

barracuda156 commented 1 year ago

@artivis OK, everything works now, tests pass.

artivis commented 10 months ago

Hi,

This isn't really a fix in the sens that it only bumps the CXX standard defined for the tests. Instead I'd rather go with #280 that sets a default (current behavior) only if no global standard was set by the user. Regarding the missing header, I'd like to understand why is it missing in your case to find a more appropriate fix. Finally, it looks like you are running out of memory on your 32bit device while compiling. I'd suggest you locally/manually disable chunks of tests simply commenting them out.

Closing in favor of #280.