jbehley / point_labeler

My awesome point cloud labeling tool
MIT License
647 stars 161 forks source link

Issue with catkin build #62

Closed kirilllzaitsev closed 1 year ago

kirilllzaitsev commented 1 year ago

Hi, I'm trying to build point_labeler and voxelizer repositories following the instructions, however, I receive an error in both:

/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o: in function `(anonymous namespace)::ColorTest_testConversionFromHSV_Test::~ColorTest_testConversionFromHSV_Test()':
color-test.cpp:(.text+0xcf): undefined reference to `testing::Test::~Test()'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o: in function `(anonymous namespace)::ColorTest_testBrightness_Test::~ColorTest_testBrightness_Test()':
color-test.cpp:(.text+0x10f): undefined reference to `testing::Test::~Test()'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o: in function `(anonymous namespace)::ColorTest_testBrightness_Test::TestBody() [clone .cold]':
color-test.cpp:(.text.unlikely+0x24): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: color-test.cpp:(.text.unlikely+0x53): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: color-test.cpp:(.text.unlikely+0x85): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: color-test.cpp:(.text.unlikely+0xb7): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: color-test.cpp:(.text.unlikely+0xe9): undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:color-test.cpp:(.text.unlikely+0x118): more undefined references to `testing::internal::AssertHelper::~AssertHelper()' follow
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o: in function `_GLOBAL__sub_I_color_test.cpp':
color-test.cpp:(.text.startup+0x1f5): undefined reference to `testing::internal::GetTestTypeId()'
/usr/bin/ld: color-test.cpp:(.text.startup+0x25f): undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: color-test.cpp:(.text.startup+0x2cf): undefined reference to `testing::internal::GetTestTypeId()'
/usr/bin/ld: color-test.cpp:(.text.startup+0x339): undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:(.data.rel.ro+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:(.data.rel.ro+0x28): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:(.data.rel.ro+0x80): undefined reference to `testing::Test::SetUp()'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:(.data.rel.ro+0x88): undefined reference to `testing::Test::TearDown()'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:(.data.rel.ro+0xc0): undefined reference to `testing::Test::SetUp()'
/usr/bin/ld: CMakeFiles/glow_test.dir/color-test.cpp.o:(.data.rel.ro+0xc8): undefined reference to `testing::Test::TearDown()'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/glow_test.dir/build.make:173: /home/master/catkin_ws/devel/.private/glow/lib/glow/glow_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:345: test/CMakeFiles/glow_test.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

My g++ has version 12.2.0.

I would be grateful for some instructions on how to proceed.

jbehley commented 1 year ago

Please try to compile without the tests of glow (comment out the corresponding part in the CMakeList.txt of the glow subdirectory). If you want to compile with tests, you might need to install or get a new version of the google test libs.

hope that helps.

jbehley commented 1 year ago

is the issue resolved without compiling the tests?

kirilllzaitsev commented 1 year ago

@jbehley now it fails on a different bunch of tests:

Finished  <<< glow                         [ 1.0 seconds ]                                                                                                
Starting  >>> point_labeler                                                                                                                               
__________________________________________________________________________________________________________________________________________________________
Errors     << point_labeler:make /tmp/catkin_ws/logs/point_labeler/build.make.001.log                                                                     
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::AssertionResult testing::internal::CmpHelperEQ<int, unsigned long>(char const*, char const*, int const&, unsigned long const&)':
/usr/include/gtest/gtest.h:1546: undefined reference to `testing::AssertionSuccess()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `TriangulateTest_triangulate_Test::TestBody()':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:23: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:23: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:23: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: /tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:39: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::AssertionResult testing::internal::CmpHelperEQ<int, unsigned long>(char const*, char const*, int const&, unsigned long const&)':
/usr/include/gtest/gtest.h:1546: undefined reference to `testing::AssertionSuccess()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `TriangulateTest_triangulate_Test::TestBody()':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:39: undefined reference to `testing::Message::Message()'
/usr/bin/ld: /tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:39: undefined reference to `testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)'
/usr/bin/ld: /tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:39: undefined reference to `testing::internal::AssertHelper::operator=(testing::Message const&) const'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `TriangulateTest_triangulate_Test::~TriangulateTest_triangulate_Test()':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:12: undefined reference to `testing::Test::~Test()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `TriangulateTest_triangulate_Test::~TriangulateTest_triangulate_Test()':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:12: undefined reference to `testing::Test::~Test()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `TriangulateTest_triangulate_Test::TriangulateTest_triangulate_Test()':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:12: undefined reference to `testing::Test::Test()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::AssertionResult testing::internal::CmpHelperEQFailure<int, unsigned long>(char const*, char const*, int const&, unsigned long const&)':
/usr/include/gtest/gtest.h:1529: undefined reference to `testing::internal::EqFailure(char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `TriangulateTest_triangulate_Test::TestBody()':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:39: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: /tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:23: undefined reference to `testing::internal::AssertHelper::~AssertHelper()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int)':
/usr/include/gtest/internal/gtest-internal.h:529: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int)':
/usr/include/gtest/internal/gtest-internal.h:550: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: /usr/include/gtest/internal/gtest-internal.h:550: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int)':
/usr/include/gtest/internal/gtest-internal.h:529: undefined reference to `testing::internal::IsTrue(bool)'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `_GLOBAL__sub_I_triangulateTest.cpp':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:12: undefined reference to `testing::internal::GetTestTypeId()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `__static_initialization_and_destruction_0':
/tmp/catkin_ws/src/point_labeler/src/test/triangulateTest.cpp:12: undefined reference to `testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::internal::SuiteApiResolver<testing::Test>::GetSetUpCaseOrSuite(char const*, int)':
/usr/include/gtest/internal/gtest-internal.h:529: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/include/gtest/internal/gtest-internal.h:529: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o: in function `testing::internal::SuiteApiResolver<testing::Test>::GetTearDownCaseOrSuite(char const*, int)':
/usr/include/gtest/internal/gtest-internal.h:550: undefined reference to `testing::internal::GTestLog::GTestLog(testing::internal::GTestLogSeverity, char const*, int)'
/usr/bin/ld: /usr/include/gtest/internal/gtest-internal.h:550: undefined reference to `testing::internal::GTestLog::~GTestLog()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o:(.data.rel.ro._ZTI32TriangulateTest_triangulate_Test[_ZTI32TriangulateTest_triangulate_Test]+0x10): undefined reference to `typeinfo for testing::Test'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o:(.data.rel.ro._ZTV32TriangulateTest_triangulate_Test[_ZTV32TriangulateTest_triangulate_Test]+0x20): undefined reference to `testing::Test::SetUp()'
/usr/bin/ld: CMakeFiles/test_core.dir/triangulateTest.cpp.o:(.data.rel.ro._ZTV32TriangulateTest_triangulate_Test[_ZTV32TriangulateTest_triangulate_Test]+0x28): undefined reference to `testing::Test::TearDown()'
collect2: error: ld returned 1 exit status
make[2]: *** [src/test/CMakeFiles/test_core.dir/build.make:221: /tmp/catkin_ws/src/point_labeler/bin/test_core] Error 1
make[1]: *** [CMakeFiles/Makefile2:372: src/test/CMakeFiles/test_core.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
kirilllzaitsev commented 1 year ago

Removing the tests from point_labeler as well allowed to compile a binary that works nicely

jbehley commented 1 year ago

so we can close the issue? maybe your PR with directly installing libgtest-dev resolves also the problems.

I think in the long run, I have to replace the catkin-based building with a proper cmake-based build.

kirilllzaitsev commented 1 year ago

Yes, let's close it. As a wrap-up, the issue is resolved by commenting out add_subdirectory(src/test) in CMakeFiles.txt found in point_labeler and glow.

libgtest-dev by itself helped me only to remedy No such file or directory problems related to GTest.