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

Project not compiling with gcc-13 #46

Open
NicolasIriarte opened this issue Jun 18, 2023 · 0 comments
Open

Project not compiling with gcc-13 #46

NicolasIriarte opened this issue Jun 18, 2023 · 0 comments

Comments

@NicolasIriarte
Copy link

NicolasIriarte commented Jun 18, 2023

It seems later versions of GCC requires the -O to FORTIFY this makes the compilation error fail with:

[115/198] Building CXX object _deps/catch2-build/src/CMakeFiles/Catch2.dir/catch2/matchers/catch_matchers_string.cpp.o
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/matchers/catch_matchers_string.cpp:8:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/matchers/catch_matchers_string.hpp:11:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/matchers/catch_matchers.hpp:11:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/matchers/internal/catch_matchers_impl.hpp:11:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/internal/catch_test_macro_impl.hpp:12:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/internal/catch_assertion_handler.hpp:11:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/catch_assertion_info.hpp:12:
In file included from /home/user/.cache/CPM/catch2/8336fa0dd617945aa607363db497172b01dc4bf1/src/catch2/../catch2/internal/catch_source_line_info.hpp:11:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../include/c++/13.1.1/cstddef:49:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../include/c++/13.1.1/x86_64-pc-linux-gnu/bits/c++config.h:679:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.1.1/../../../../include/c++/13.1.1/x86_64-pc-linux-gnu/bits/os_defines.h:39:
/usr/include/features.h:413:4: warning: _FORTIFY_SOURCE requires compiling with optimization (-O) [-W#warnings]
#  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
   ^
1 warning generated.

For all sources files, and as -Werror is enabled the whole compilation fails for GCC and CLANG.

I inspected the problematic file /usr/include/features.h:413:4 and here is the content:

#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0
# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0
#  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
# elif !__GNUC_PREREQ (4, 1)
#  warning _FORTIFY_SOURCE requires GCC 4.1 or later
# elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0)		      \
			       || __GNUC_PREREQ (12, 0))

#  if _FORTIFY_SOURCE > 3
#   warning _FORTIFY_SOURCE > 3 is treated like 3 on this platform
#  endif
#  define __USE_FORTIFY_LEVEL 3
# elif _FORTIFY_SOURCE > 1
#  if _FORTIFY_SOURCE > 2
#   warning _FORTIFY_SOURCE > 2 is treated like 2 on this platform
#  endif
#  define __USE_FORTIFY_LEVEL 2
# else
#  define __USE_FORTIFY_LEVEL 1
# endif
#endif
#ifndef __USE_FORTIFY_LEVEL
# define __USE_FORTIFY_LEVEL 0
#endif

It seems it only wants to use FORTIFY for __OPTIMIZE__ > 0.


For the meantime, do you recommend disabling FORTIFY or downgrading GCC?

Thanks for your time and this great repository.

EDIT 1:

  • Platform: ArchLinux
  • GCC: 13.1.1 20230429
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

1 participant