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

Fails to build from source on prerelease Ubuntu, GCC #4464

Closed
jwbee opened this issue Mar 21, 2024 · 6 comments
Closed

Fails to build from source on prerelease Ubuntu, GCC #4464

jwbee opened this issue Mar 21, 2024 · 6 comments

Comments

@jwbee
Copy link

jwbee commented Mar 21, 2024

Problem:

The quickstart instructions do not succeed using the tools and libraries of Ubuntu 24.04, which will be released in a month. It fails whether I use GCC 12 or 13. It succeeds with clang 17.

% cmake --build build
[  0%] Building C object CMakeFiles/s2n.dir/crypto/s2n_aead_cipher_aes_gcm.c.o
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
cc1: all warnings being treated as errors
gmake[2]: *** [CMakeFiles/s2n.dir/build.make:76: CMakeFiles/s2n.dir/crypto/s2n_aead_cipher_aes_gcm.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1365: CMakeFiles/s2n.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
@jwbee
Copy link
Author

jwbee commented Mar 21, 2024

It appears that a solution might be:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5713558d3..55d33a548 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -176,6 +176,7 @@ target_compile_options(${PROJECT_NAME} PUBLIC -fPIC)

 add_definitions(-D_POSIX_C_SOURCE=200809L)
 if(CMAKE_BUILD_TYPE MATCHES Release)
+    add_definitions(-U_FORTIFY_SOURCE)
     add_definitions(-D_FORTIFY_SOURCE=2)
 endif()

@camshaft
Copy link
Contributor

Hey thanks for reaching out. I don't think we want to completely unset the variable but instead should only set it if it hasn't already been defined. I can get a PR out to try and address that.

@camshaft
Copy link
Contributor

I've opened #4465, which should address the issue. Just need to work through the OpenBSD failure before merging it. If you want to try out my branch to confirm it fixes what you're seeing, that would also be helpful 😃

@jwbee
Copy link
Author

jwbee commented Mar 22, 2024

It is fixed for me on your tree.

@goatgoose
Copy link
Contributor

Hi @jwbee, I've executed the ubuntu quickstart instructions on a Ubuntu 24.04 instance and have been unsuccessful in reproducing this issue so far. I've tried using GCC 12 and 13, and both succeeded. I wonder if the behavior could have changed since the prerelease. Are you still running into this issue with the final 24.04 release?

@jwbee
Copy link
Author

jwbee commented May 2, 2024

You're right, it builds and tests on the release ubuntu, from main branch.

@jwbee jwbee closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants