seemoo-lab/owl

`-Werror` causes compile errors

mortie opened this issue · 4 comments

The "build from source" instructions should build in a mode which disables -Werror. I just had to go digging through your CMakeLists.txt to disable -Werror just because my version of gcc is slightly different from the one you happen to use.

For reference, here's the warning which causes the build to fail in my case:

In file included from /home/martin/src/owl/googletest/googletest/src/gtest-all.cc:42:
/home/martin/src/owl/googletest/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/martin/src/owl/googletest/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/home/martin/src/owl/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/martin/src/owl/googletest/googletest/src/gtest-death-test.cc:1299:7: note: ‘dummy’ declared here
 1299 |   int dummy;
      |       ^~~~~
ls
cc1plus: all warnings being treated as errors

But the bug here is that -Werror is being used for builds on systems you don't know with compiler versions and library versions you don't know.

How did you disable -Werror? I am trying to compile owl on Ubuntu Impish and I'm encountering the same issue.

nvm it's working now with #50

this is still an issue building with both gcc 12.2.1 and clang 14.0.5

FYI, append

set(CMAKE_C_FLAGS "-O2 -Wno-error=maybe-uninitialized")

to CMakeLists.txt to allow compilation to succeed on newer gcc (it would be a better idea to fix the uninitialized variables).