Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Werror causes compile errors #52

Open
mortie opened this issue Oct 23, 2021 · 4 comments
Open

-Werror causes compile errors #52

mortie opened this issue Oct 23, 2021 · 4 comments

Comments

@mortie
Copy link

mortie commented Oct 23, 2021

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.

@echometerain
Copy link

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

@echometerain
Copy link

nvm it's working now with #50

@13xforever
Copy link

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

@timboudreau
Copy link

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants