Skip to content

Commit 0bb6f49

Browse files
committed
chore(cmake): drop FORTIFY_SOURCE=2 from release builds.
It causes weird issues with zig finding the prototypes for `strlcat` and `strlcpy` in `lib/libc/include/generic-glibc/bits/string_fortified.h`, but their implementation is not present, leading to link time build failure. This means: * check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY) fails * `HAVE_STRLCPY` and `HAVE_STRLCAT` are not defined * `<libscap/strl.h>` defines both `strlcat` and `strlcpy` * but `string.h` included at the start of `strl.h` will find the prototypes, thus failing because of symbol redefinition Signed-off-by: Federico Di Pierro <[email protected]>
1 parent 9550af7 commit 0bb6f49

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

cmake/modules/CompilerFlags.cmake

+2-7
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ endif()
4848

4949

5050
if(NOT MSVC)
51-
52-
if(CMAKE_BUILD_TYPE STREQUAL "release")
53-
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -D_FORTIFY_SOURCE=2")
54-
endif()
55-
5651
if(USE_ASAN)
5752
set(FALCO_SECURITY_FLAGS "${FALCO_SECURITY_FLAGS} -fsanitize=address")
5853
endif()
@@ -74,8 +69,8 @@ if(NOT MSVC)
7469
set(CMAKE_COMMON_FLAGS "${CMAKE_COMMON_FLAGS} -Wextra ${CMAKE_SUPPRESSED_WARNINGS}")
7570
endif()
7671

77-
set(CMAKE_C_FLAGS "${CMAKE_COMMON_FLAGS}")
78-
set(CMAKE_CXX_FLAGS "-std=c++17 ${CMAKE_COMMON_FLAGS}")
72+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_COMMON_FLAGS}")
73+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 ${CMAKE_COMMON_FLAGS}")
7974

8075
set(CMAKE_C_FLAGS_DEBUG "${FALCO_EXTRA_DEBUG_FLAGS}")
8176
set(CMAKE_CXX_FLAGS_DEBUG "${FALCO_EXTRA_DEBUG_FLAGS}")

cmake/modules/falcosecurity-libs.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ set(LIBS_PACKAGE_NAME "falcosecurity")
5656

5757
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
5858
add_definitions(-D_GNU_SOURCE)
59-
add_definitions(-DHAS_CAPTURE)
6059
endif()
6160

6261
if(MUSL_OPTIMIZED_BUILD)

0 commit comments

Comments
 (0)