]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cmake: remove _FORTIFY_SOURCE define
authorCasey Bodley <cbodley@redhat.com>
Wed, 3 Sep 2025 17:22:30 +0000 (13:22 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Wed, 24 Sep 2025 15:35:40 +0000 (11:35 -0400)
according to `dpkg-buildflags`, ubuntu 24 raised this value to
`-D_FORTIFY_SOURCE=3` which causes `error: "_FORTIFY_SOURCE" redefined`
compilation failures because Ceph itself adds `-D_FORTIFY_SOURCE=2`

`_FORTIFY_SOURCE` is a hardening option. both our rpm and debian builds
already specify that via environment variables, so Ceph's cmake should
leave it alone

Fixes: https://tracker.ceph.com/issues/72361
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit 66bec97b0dc90b91f5be586351f52082beb6374a)

src/CMakeLists.txt

index cbc5f55edf1b6d4df4b08cb6e6fa7911b58fb448..e7d3664b6ff625fcbcec75ba6041da63d469e35e 100644 (file)
@@ -178,14 +178,6 @@ endif()
 
 include(CheckCCompilerFlag)
 if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
-  CHECK_C_COMPILER_FLAG("-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2" HAS_FORTIFY_SOURCE)
-  if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
-    if(HAS_FORTIFY_SOURCE)
-      add_definitions(
-        -U_FORTIFY_SOURCE
-        -D_FORTIFY_SOURCE=2)
-    endif()
-  endif()
     CHECK_C_COMPILER_FLAG(-fstack-protector-strong HAS_STACK_PROTECT)
     if (HAS_STACK_PROTECT)
       add_compile_options(-fstack-protector-strong)