robotology / blocktest

Test system for generic robot middlewares
GNU Lesser General Public License v3.0
8 stars 2 forks source link

Error when trying to install blocktest #64

Closed martinaxgloria closed 10 months ago

martinaxgloria commented 10 months ago

I was trying to install this repo following the instructions in the README.md but I retrieved the following error:

/home/mgloria/iit/blocktest/build/_deps/unittest-src/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/mgloria/iit/blocktest/build/_deps/unittest-src/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/mgloria/iit/blocktest/build/_deps/unittest-src/googletest/src/gtest-death-test.cc:1290:13: note: by argument 1 of type ‘const void*’ to ‘void testing::internal::StackLowerThanAddress(const void*, bool*)’ declared here
 1290 | static void StackLowerThanAddress(const void* ptr, bool* result) {
      |             ^~~~~~~~~~~~~~~~~~~~~
/home/mgloria/iit/blocktest/build/_deps/unittest-src/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [_deps/unittest-build/googletest/CMakeFiles/gtest.dir/build.make:90: _deps/unittest-build/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:462: _deps/unittest-build/googletest/CMakeFiles/gtest.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

This seems an error related to gtest, not this repo. Looking at the gtest issues, I found that a lot of people have experienced this bug and this happens with gcc version 11.x and googletest v1.10 (which I think is the version used in here). This issue got fixed by this PR and the fix is available since gtest v1.11.0.

To correctly install BlockTest, maybe it is sufficient to update the GIT_TAG argument of the FetchContent_Declare call.