Illumina / ExpansionHunter

A tool for estimating repeat sizes
Other
182 stars 51 forks source link

Error: ‘dummy’ may be used uninitialized #160

Open VJalili opened 2 years ago

VJalili commented 2 years ago

I am building EH from source following the steps listed on the installation page. I get the following error when building EH.

$ git clone https://github.com/Illumina/ExpansionHunter
$ cd ExpansionHunter/
$ mkdir build
$ cd build
$ cmake ..
$ make
...
[ 12%] Building CXX object googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /home/user/ExpansionHunter/build/googletest-prefix/src/googletest/googletest/src/gtest-all.cc:42:
/home/user/ExpansionHunter/build/googletest-prefix/src/googletest/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/user/ExpansionHunter/build/googletest-prefix/src/googletest/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/user/ExpansionHunter/build/googletest-prefix/src/googletest/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/user/ExpansionHunter/build/googletest-prefix/src/googletest/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~
cc1plus: all warnings being treated as errors
make[5]: *** [googletest/CMakeFiles/gtest.dir/build.make:76: googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:172: googletest/CMakeFiles/gtest.dir/all] Error 2
make[3]: *** [Makefile:146: all] Error 2
make[2]: *** [CMakeFiles/googletest.dir/build.make:86: googletest-prefix/src/googletest-stamp/googletest-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:171: CMakeFiles/googletest.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I'm running on Ubuntu, 22.04.

I believe this error is related to the issue discussed here, so I tried reinstalling the current latest release of google test following these instructions. That did not fix the error.

ccario83 commented 1 year ago

This is a known googletest issue when compiling with GCC 11. It can be solved by upgrading googletest to 1.11:

CMakeLists.txt, line 65, change:

URL https://github.com/google/googletest/archive/refs/tags/release-1.10.0.tar.gz

to

URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz

You may have other errors compiling ExpansionHunter with GCC11, however. It may be better to downgrade the compilier. 🤷