Skip to content

Commit 0eff6c9

Browse files
authored
fix(ci): sanitizers build (#4457)
* compile with clang * update container to version 24 * move to x86 github runner ubuntu 24 * use compiler-rt instead of libgcc * add cmake glue
1 parent e89c15b commit 0eff6c9

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/workflows/daily-sanitizers.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ on:
77

88
jobs:
99
build:
10-
runs-on: [self-hosted, linux, ARM64]
10+
runs-on: [ubuntu-24.04]
1111
strategy:
1212
matrix:
13-
container: ["ubuntu-dev:22"]
13+
container: ["ubuntu-dev:24"]
1414
build-type: [Debug]
15-
compiler: [{ cxx: g++, c: gcc }]
16-
cxx_flags: ["-Werror"]
15+
compiler: [{ cxx: clang++, c: clang }]
16+
# TODO bring it back when warnings on clang are fixed
17+
# cxx_flags: ["-Werror"]
1718
timeout-minutes: 90
1819
env:
1920
SCCACHE_GHA_ENABLED: "true"
@@ -59,6 +60,10 @@ jobs:
5960
6061
- name: Configure & Build
6162
run: |
63+
apt -y update
64+
apt -y upgrade
65+
apt install -y clang
66+
which clang
6267
echo "ulimit is"
6368
ulimit -s
6469
echo "-----------------------------"
@@ -76,7 +81,10 @@ jobs:
7681
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
7782
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
7883
-DWITH_ASAN=ON \
79-
-DWITH_USAN=ON
84+
-DWITH_USAN=ON \
85+
-DCMAKE_C_FLAGS=-Wno-error=unused-command-line-argument \
86+
-DCMAKE_CXX_FLAGS=-Wno-error=unused-command-line-argument
87+
# https://maskray.me/blog/2023-08-25-clang-wunused-command-line-argument (search for compiler-rt)
8088
8189
ninja src/all
8290

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,24 @@ option(DF_USE_SSL "Provide support for SSL connections" ON)
4040

4141
find_package(OpenSSL)
4242

43+
SET(SANITIZERS OFF)
44+
4345
option(WITH_ASAN "Enable -fsanitize=address" OFF)
4446
if (SUPPORT_ASAN AND WITH_ASAN)
4547
message(STATUS "address sanitizer enabled")
4648
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
49+
set(SANITIZERS ON)
4750
endif()
4851

4952
option(WITH_USAN "Enable -fsanitize=undefined" OFF)
5053
if (SUPPORT_USAN AND WITH_USAN)
5154
message(STATUS "ub sanitizer enabled")
5255
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined")
56+
set(SANITIZERS ON)
57+
endif()
58+
59+
if(SANITIZERS)
60+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -rtlib=compiler-rt")
5361
endif()
5462

5563
include(third_party)

0 commit comments

Comments
 (0)