error: use of undeclared identifier 'ASSERT_DEATH'
Build fails on FreeBSD:
/wrkdirs/usr/ports/math/fcl/work/fcl-0.6.0/test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl_gjk_doSimplex2.cpp:289:3: error: use of undeclared identifier 'ASSERT_DEATH'
ASSERT_DEATH(doSimplex2(&line_, &dir_),
^
/wrkdirs/usr/ports/math/fcl/work/fcl-0.6.0/test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl_gjk_doSimplex2.cpp:303:3: error: use of undeclared identifier 'ASSERT_DEATH'
ASSERT_DEATH(doSimplex2(&line_, &dir_),
^
/wrkdirs/usr/ports/math/fcl/work/fcl-0.6.0/test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl_gjk_doSimplex2.cpp:317:3: error: use of undeclared identifier 'ASSERT_DEATH'
ASSERT_DEATH(doSimplex2(&line_, &dir_),
^
Version 0.6.0
What version of gtest do you have?
See #358 / #354 / etc.
That explains the feeling of de ja vu.
I don't have gtest installed. Your configure misses this.
FCL has a vendored copy of gtest.
See https://github.com/flexible-collision-library/fcl/blob/a13c681e41eb8180cba7d4fd32637511f588cb82/test/gtest/include/gtest/internal/gtest-port.h#L652.
The problem is that the vendored copy is too old, and lacks FreeBSD support.
I would say, the problem is vendoring that causes this kind of problems. We have googletest-1.10.0_1 in the ports.
I am less familiar with FreeBSD conventions than, say, Debian or Ubuntu. When software packages have unit tests, are those typically compiled and run as part of the packaging ecosystem? (Is BUILD_TESTING usually set to be on or off, for cmake projects?)
I ask because the easy workaround for now is to disable BUILD_TESTING. That might at least unblock work to see what else could be broken by the new fcl.
I am certainly no fan of vendoring in general, though googletest in particular has long steered developers to compile it within their own project, instead of linking to a distribution-supplied library.
Next steps for FCL might be to (some or all of):
- update the vendored copy to be newer -- perhaps 1.8 or 1.10,
- replace the vendored copy with an external project fetch of a gtest source archive,
- offer a cmake option to BYO googletest.
I wonder if using https://cmake.org/cmake/help/latest/module/GoogleTest.html just solves this all anyway. Looks like https://cliutils.gitlab.io/modern-cmake/chapters/testing/googletest.html has some advice.
Maybe @jamiesnape can weigh in.
When software packages have unit tests, are those typically compiled and run as part of the packaging ecosystem? (Is BUILD_TESTING usually set to be on or off, for cmake projects?)
It should be OFF during the package build, and it should be set during the 'test' target in the port.
I ask because the easy workaround for now is to disable BUILD_TESTING.
There is the FCL_BUILD_TESTS variable that is set to OFF. Does BUILD_TESTING do the same?
FCL_BUILD_TESTS and BUILD_TESTING should be theory be in sync. FCL_BUILD_TESTS is a legacy setting. Pretty much all package guidelines would switch those off.
As far as fixing the problem, quoting the above, we should chose one of
- update the vendored copy to be newer -- perhaps 1.8 or 1.10,
- replace the vendored copy with an external project fetch of a gtest source archive,
along with
offer a cmake option to BYO googletest.
The main Kitware projects have tended to vendor lately (since many customers do not have internet connections) with opt-out to use a system version (especially for packagers), but from a technically point of view, an external fetch is just as good. Either way, we should have option for a system/BYO version.
(And as with most Google projects, you really need to keep updating GTest rather than sticking with an old version for a long period of time.)
Can we get this patched for 0.6.1 @jamiesnape? @j-rivero can we squeeze this in for the next ubuntu or has that ship sailed?
Yes, but it should not really matter for Ubuntu (tests should be disabled).
It builds fine with disabled tests.