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

Build Failed /usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization #1885

Closed
jiangyunpeng opened this issue Nov 8, 2023 · 2 comments
Labels
bug type bug

Comments

@jiangyunpeng
Copy link

jiangyunpeng commented Nov 8, 2023

Version

OS: CentOS Linux release 7.9.2009
kvrocks: 2.6.0

Minimal reproduce step

./x.py build

What did you expect to see?

Build success

What did you see instead?

[  5%] Building CXX object _deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
In file included from /opt/rh/devtoolset-11/root/usr/include/c++/11/x86_64-redhat-linux/bits/os_defines.h:39,
                 from /opt/rh/devtoolset-11/root/usr/include/c++/11/x86_64-redhat-linux/bits/c++config.h:2732,
                 from /opt/rh/devtoolset-11/root/usr/include/c++/11/type_traits:38,
                 from /root/kvrocks-2.6.0/build/_deps/tbb-src/src/tbb/../../include/oneapi/tbb/detail/_utils.h:20,
                 from /root/kvrocks-2.6.0/build/_deps/tbb-src/src/tbb/address_waiter.cpp:17:
/usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
  330 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
compilation terminated due to -Wfatal-errors.
cc1plus: all warnings being treated as errors
gmake[3]: *** [_deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o] Error 1
gmake[2]: *** [_deps/tbb-build/src/tbb/CMakeFiles/tbb.dir/all] Error 2
gmake[1]: *** [CMakeFiles/kvrocks.dir/rule] Error 2
gmake: *** [kvrocks] Error 2
Traceback (most recent call last):
  File "./x.py", line 422, in <module>
    args.func(**arg_dict)
  File "./x.py", line 137, in build
    run(cmake, *options, verbose=True, cwd=dir)
  File "./x.py", line 68, in run
    raise RuntimeError(err)
RuntimeError:
failed to run: ('/usr/bin/cmake', '--build', '.', '-t', 'kvrocks', 'kvrocks2redis')
exit with code: 2

@jiangyunpeng jiangyunpeng added the bug type bug label Nov 8, 2023
@PragmaTwice
Copy link
Member

To workaround it, you can type ./x.py build -DTBB_STRICT=OFF.

But it's a little weird to me since by default the optimization build is already enabled (hence there is no reason for this warning)

@jiangyunpeng
Copy link
Author

Thanks @PragmaTwice it works!

PragmaTwice added a commit that referenced this issue Nov 9, 2023
In a glibc header, a warning diagnostic message will be emitted while optimization level is low.

And if `TBB_STRICT` is enabled, all warnings will be treated as error and then make the compilation of TBB fail.

We disable the option and thus solve #1885.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug
Projects
None yet
Development

No branches or pull requests

2 participants