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
This commit is contained in:
Kostas Kyrimis 2025-01-15 12:39:43 +02:00 committed by GitHub
parent e89c15bc6a
commit 0eff6c93f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 5 deletions

View file

@ -7,13 +7,14 @@ on:
jobs: jobs:
build: build:
runs-on: [self-hosted, linux, ARM64] runs-on: [ubuntu-24.04]
strategy: strategy:
matrix: matrix:
container: ["ubuntu-dev:22"] container: ["ubuntu-dev:24"]
build-type: [Debug] build-type: [Debug]
compiler: [{ cxx: g++, c: gcc }] compiler: [{ cxx: clang++, c: clang }]
cxx_flags: ["-Werror"] # TODO bring it back when warnings on clang are fixed
# cxx_flags: ["-Werror"]
timeout-minutes: 90 timeout-minutes: 90
env: env:
SCCACHE_GHA_ENABLED: "true" SCCACHE_GHA_ENABLED: "true"
@ -59,6 +60,10 @@ jobs:
- name: Configure & Build - name: Configure & Build
run: | run: |
apt -y update
apt -y upgrade
apt install -y clang
which clang
echo "ulimit is" echo "ulimit is"
ulimit -s ulimit -s
echo "-----------------------------" echo "-----------------------------"
@ -76,7 +81,10 @@ jobs:
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \ -DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
-DWITH_ASAN=ON \ -DWITH_ASAN=ON \
-DWITH_USAN=ON -DWITH_USAN=ON \
-DCMAKE_C_FLAGS=-Wno-error=unused-command-line-argument \
-DCMAKE_CXX_FLAGS=-Wno-error=unused-command-line-argument
# https://maskray.me/blog/2023-08-25-clang-wunused-command-line-argument (search for compiler-rt)
ninja src/all ninja src/all

View file

@ -40,16 +40,24 @@ option(DF_USE_SSL "Provide support for SSL connections" ON)
find_package(OpenSSL) find_package(OpenSSL)
SET(SANITIZERS OFF)
option(WITH_ASAN "Enable -fsanitize=address" OFF) option(WITH_ASAN "Enable -fsanitize=address" OFF)
if (SUPPORT_ASAN AND WITH_ASAN) if (SUPPORT_ASAN AND WITH_ASAN)
message(STATUS "address sanitizer enabled") message(STATUS "address sanitizer enabled")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
set(SANITIZERS ON)
endif() endif()
option(WITH_USAN "Enable -fsanitize=undefined" OFF) option(WITH_USAN "Enable -fsanitize=undefined" OFF)
if (SUPPORT_USAN AND WITH_USAN) if (SUPPORT_USAN AND WITH_USAN)
message(STATUS "ub sanitizer enabled") message(STATUS "ub sanitizer enabled")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined")
set(SANITIZERS ON)
endif()
if(SANITIZERS)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -rtlib=compiler-rt")
endif() endif()
include(third_party) include(third_party)