Skip to content

Commit 635ed66

Browse files
morrisonleviclaude
andauthored
build: update and shrink build images, migrate to clang 19 (#3771)
* build: migrate clang 17 -> 19 This matches Rust 1.84, but libdatadog recently introduced a flag which was introduced in this version. Although this should not cause a hard failure and libdatadog should be patched, it's also a good idea to upgrade. * ci: avoid interactive mode for docker login * ci: -u must come before --pasword-stdin * build: drop LLVM components that need python, drop protobuf * build: shrink centos-7 base image by ~2.4 GB - Exclude kernel-core, kernel-modules, linux-firmware globally via yum.conf (~183 MB; these are useless in containers) - Move devtoolset-9 into the LLVM RUN layer and remove it afterward (~196 MB) - Build LLVM with CLANG_BUILD_TOOLS=OFF and LLVM_INSTALL_TOOLCHAIN_ONLY=ON to skip building unused tools (~1.3 GB) - Remove LLVM internal C++ headers and cmake config dirs post-install (~54 MB) - Add --disable-static to libxml2, libffi, oniguruma, curl, sqlite3 configure - Remove .a static archives from openssl and zlib after install - Fix catch2 build/source cleanup (cd - && rm -fr build was a no-op) - Remove cmake Help docs and man pages post-install (~10 MB) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: bump PHP versions across CI images - PHP 8.5: RC3 -> 8.5.4 (stable) across centos-7, bookworm - PHP 8.4: 8.4.1/8.4.16 -> 8.4.19 across centos-7, bookworm - PHP 8.3: 8.3.14/8.3.29 -> 8.3.30 across centos-7, bookworm - PHP 8.2: 8.2.26/8.2.28 -> 8.2.30 across centos-7, bookworm - PHP 8.1: 8.1.8/8.1.31 -> 8.1.32 across centos-6, centos-7 - PHP 8.0: 8.0.15/8.0.21/8.0.27 -> 8.0.30 across centos-6, centos-7, alpine - PHP 7.4: 7.4.30 -> 7.4.33 on centos-6 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: drop ccmake, cpack, ctest * build: pin sqlsrv and grpc PECL versions for PHP compatibility - sqlsrv 5.13.0 raised minimum to PHP 8.3; pin PHP 8.1-8.2 to 5.12.0 - grpc 1.80.0 uses EG(max_allowed_stack_size) gated on PHP_VERSION_ID>=80300 but the field is absent in ASan builds because the ZEND_CHECK_STACK_LIMIT autoconf test cannot execute sanitized binaries during configure; pin to 1.78.0 which predates that change Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: patch PHP 8.5 to disable preserve_none under ASan preserve_none + -fsanitize=address crashes clang 19+ on x86-64 (llvm/llvm-project#95928). Apply a patch at source-tree build time that guards ZEND_PRESERVE_NONE with __has_feature(address_sanitizer), following the fix pattern from llvm-project commit 996157c. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: silence make recipe output in bookworm PHP builds Adds -s (silent) to all make invocations in build-php.sh and to MAKEFLAGS in build-extensions.sh (which covers pecl installs too). Compiler errors still print via stderr; only the cc/ld recipe lines are suppressed. Reduces log volume significantly given parallel stages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: bump CI images from bookworm-6/5 to bookworm-7 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: update clang/llvm references from 17 to 19 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(centos-7): restore ctest, update clang/llvm/clang-tidy 17 → 19 ctest is required by the appsec C components ASAN job (make test calls ctest internally). cpack remains removed as it is genuinely unused. Also updates clang-tidy, llvm-cov, llvm-profdata, clang-format, and libc++ references from version 17 to 19 in appsec CI and cmake config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: put bookworm next down to 7 in case I need to rebuild * fix: update remaining llvm17/clang17 references to 19 - Alpine compile extension image: llvm17-libs/clang17-dev/llvm17 → 19 - build-profiler.sh, generate-profiler.php, build-debug-artifact: Alpine aarch64 clang symlink llvm17 → llvm19 - appsec/cmake/clang-format.cmake: llvm@17 → llvm@19 - centos-7 base.Dockerfile: remove -DCLANG_BUILD_TOOLS=OFF which prevented the clang binary itself from being built/installed, leaving broken symlinks and breaking bindgen Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(appsec): find fuzzer runtime lib in Debian's linux/ layout Newer clang versions return a per-target path from -print-runtime-dir (e.g. .../lib/x86_64-pc-linux-gnu) but Debian/Ubuntu packages install compiler-rt runtime libs in a sibling "linux/" directory. Add that as a fallback search path for both find_library and target_link_directories. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(appsec): pass __VA_ARGS__ through CONFIG to SYSCFG to avoid empty variadic clang 19 with -Werror,-Wc23-extensions rejects calling a variadic macro with no argument for '...'. CONFIG's body called SYSCFG(type, name) with only 2 args. Pass CONFIG's own __VA_ARGS__ through instead — CONFIG is always called with at least a default value, so the variadic arg is never empty. SYSCFG ignores the extra args in this context anyway. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * style(appsec): clang-format-19 helper sources Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: bump bookworm NEXT version to 8 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: revert CentOS 6 changes to avoid appearing that it's maintained * fix(appsec): address clang-tidy 19 new checks - acceptor.cpp: use designated initializer for timeval (layout is system-dependent, so positional init is unsafe) - extension/.clang-tidy: suppress checks new in clang-tidy 19 that fire on pre-existing C code (math-missing-parentheses, macro-to-enum, multi-level-implicit-pointer-conversion, redundant-casting) - helper/.clang-tidy: suppress modernize-use-designated-initializers for internal structs where positional init is unambiguous Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(appsec): separate void return from call expression in waf.cpp clang-tidy 19 readability-avoid-return-with-void-value rejects returning the result of a void function call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci(appsec): revert clang-19 migration, keep clang-17, bump to bookworm-7 Reverts all appsec source/config changes that were made to accommodate clang-19 warnings and formatting. Appsec jobs stay on clang-17 for now. Bumps appsec CI image from bookworm-6 to bookworm-7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci(appsec): revert bookworm-7, keep bookworm-6 bookworm-7 only ships clang-19 in its apt repo; appsec jobs still need clang-17 so stay on bookworm-6 for now. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: xfail ext/sockets/tests/gh21161.phpt on PHP 8.4 and 8.5 The test lacks a SKIPIF guard for IPv6 availability. In CI (Kubernetes pods), IPv6 is unavailable so socket_create() returns false, causing a TypeError instead of the expected warnings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: suppress ASAN stack-use-after-return in sandbox observer bailout zai_reset_observed_frame_post_bailout (PHP 8.0/8.1) calls zend_observer_fcall_end_all after a sandbox bailout. At that point current_observed_frame may point to a dummy_execute_data that was stack-allocated inside zend_call_function and already freed by the unwind. PHP 8.2+ is safe via zai_set_observed_frame(NULL). Suppress for the "multiple observers" ASAN job while Bob investigates a proper fix in zai_reset_observed_frame_post_bailout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: suppress sandbox observer ASAN error in ZAI tests too Same stack-use-after-return in zai_reset_observed_frame_post_bailout seen in Zend Abstract Interface Tests with debug-zts-asan. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: use detect_stack_use_after_return=0 to suppress sandbox observer ASAN error ASAN suppression files don't support fun: entries; that's TSan/LSan format. Use detect_stack_use_after_return=0 in the affected jobs instead. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 78df648 commit 635ed66

25 files changed

+181
-138
lines changed

.github/workflows/prof_asan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
CARGO_TARGET_DIR: /tmp/build-cargo
1717
RUST_TOOLCHAIN: nightly-2025-06-13
1818
container:
19-
image: datadog/dd-trace-ci:php-${{matrix.php-version}}_bookworm-6
19+
image: datadog/dd-trace-ci:php-${{matrix.php-version}}_bookworm-7
2020
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user
2121
options: --user root --privileged
2222

@@ -49,7 +49,7 @@ jobs:
4949
set -eux
5050
switch-php nts-asan
5151
cd profiling
52-
export CC=clang-17
52+
export CC=clang-19
5353
export CFLAGS='-fsanitize=address -fno-omit-frame-pointer'
5454
export LDFLAGS='-fsanitize=address -shared-libasan'
5555
export RUSTC_LINKER=lld-17

.gitlab/build-profiler.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717
# /usr/lib/llvm20/lib/clang/20/include/arm_neon.h:6374:25: error: incompatible constant for this __builtin_neon function
1818
# etc.
1919
if [ -f /sbin/apk ] && [ $(uname -m) = "aarch64" ]; then
20-
ln -sf ../lib/llvm17/bin/clang /usr/bin/clang
20+
ln -sf ../lib/llvm19/bin/clang /usr/bin/clang
2121
fi
2222

2323
set -u

.gitlab/ci-images.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CentOS:
3434
- php-7.0
3535
script:
3636
- cd dockerfiles/ci/centos/7
37-
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
37+
- echo "$CI_REGISTRY_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
3838
- docker buildx bake --no-cache --pull --push $PHP_VERSION
3939

4040
Alpine:
@@ -63,7 +63,7 @@ Alpine:
6363
- 7.0-alpine
6464
script:
6565
- cd dockerfiles/ci/alpine_compile_extension
66-
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
66+
- echo "$CI_REGISTRY_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
6767
- docker buildx bake --no-cache --pull --push $PHP_VERSION
6868

6969
Bookworm:
@@ -94,7 +94,7 @@ Bookworm:
9494
- php-7.0
9595
script:
9696
- cd dockerfiles/ci/bookworm
97-
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
97+
- echo "$CI_REGISTRY_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
9898
- docker buildx bake --no-cache --pull --push $PHP_VERSION
9999

100100
Buster:
@@ -125,5 +125,5 @@ Buster:
125125
- php-7.0
126126
script:
127127
- cd dockerfiles/ci/buster
128-
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_TOKEN" $CI_REGISTRY
128+
- echo "$CI_REGISTRY_TOKEN" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
129129
- docker buildx bake --no-cache --pull --push $PHP_VERSION

.gitlab/generate-package.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
$asan_build_platforms = [
4949
[
5050
"triplet" => "x86_64-unknown-linux-gnu",
51-
"image_template" => "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-%s_bookworm-6",
51+
"image_template" => "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-%s_bookworm-7",
5252
"arch" => "amd64",
5353
"host_os" => "linux-gnu",
5454
],
5555
[
5656
"triplet" => "aarch64-unknown-linux-gnu",
57-
"image_template" => "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-%s_bookworm-6",
57+
"image_template" => "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-%s_bookworm-7",
5858
"arch" => "arm64",
5959
"host_os" => "linux-gnu",
6060
]
@@ -319,7 +319,7 @@
319319

320320
"pecl build":
321321
stage: tracing
322-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-7.4_bookworm-6"
322+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-7.4_bookworm-7"
323323
tags: [ "arch:amd64" ]
324324
needs: [ "prepare code" ]
325325
script:
@@ -369,7 +369,7 @@
369369
<?php foreach ($arch_targets as $arch): ?>
370370
"aggregate tracing extension: [<?= $arch ?>]":
371371
stage: tracing
372-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-7.4_bookworm-6"
372+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-7.4_bookworm-7"
373373
tags: [ "arch:amd64" ]
374374
script: ls ./
375375
variables:
@@ -1136,7 +1136,7 @@
11361136

11371137
"pecl tests":
11381138
stage: verify
1139-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_VERSION}_bookworm-6"
1139+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_VERSION}_bookworm-7"
11401140
tags: [ "arch:amd64" ]
11411141
services:
11421142
- !reference [.services, request-replayer]
@@ -1307,7 +1307,7 @@
13071307
variables:
13081308
VALGRIND: false
13091309
ARCH: "<?= $arch ?>"
1310-
CONTAINER_SUFFIX: bookworm-6
1310+
CONTAINER_SUFFIX: bookworm-7
13111311
needs:
13121312
- job: "package loader: [<?= $arch ?>]"
13131313
artifacts: true

.gitlab/generate-profiler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
IMAGE_SUFFIX: _centos-7
4444
script:
4545
- if [ -d '/opt/rh/devtoolset-7' ]; then set +eo pipefail; source scl_source enable devtoolset-7; set -eo pipefail; fi
46-
- if [ -f /sbin/apk ] && [ $(uname -m) = "aarch64" ]; then ln -sf ../lib/llvm17/bin/clang /usr/bin/clang; fi
46+
- if [ -f /sbin/apk ] && [ $(uname -m) = "aarch64" ]; then ln -sf ../lib/llvm19/bin/clang /usr/bin/clang; fi
4747

4848
- cd profiling
4949
- 'echo "nproc: $(nproc)"'
@@ -82,7 +82,7 @@
8282
"clippy NTS":
8383
stage: test
8484
tags: [ "arch:amd64" ]
85-
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-6
85+
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7
8686
variables:
8787
KUBERNETES_CPU_REQUEST: 5
8888
KUBERNETES_MEMORY_REQUEST: 3Gi
@@ -101,7 +101,7 @@
101101
"Cargo test":
102102
stage: test
103103
tags: [ "arch:amd64" ]
104-
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-8.5_bookworm-5
104+
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-8.5_bookworm-7
105105
variables:
106106
KUBERNETES_CPU_REQUEST: 5
107107
KUBERNETES_MEMORY_REQUEST: 3Gi

.gitlab/generate-shared.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- IMAGE:
2222
- "datadog/dd-trace-ci:centos-7"
2323
- "datadog/dd-trace-ci:php-compile-extension-alpine"
24-
- "datadog/dd-trace-ci:bookworm-6"
24+
- "datadog/dd-trace-ci:bookworm-7"
2525
script:
2626
- if [ -f "/opt/libuv/lib/pkgconfig/libuv.pc" ]; then export PKG_CONFIG_PATH="/opt/libuv/lib/pkgconfig:$PKG_CONFIG_PATH"; fi
2727
- if [ -d "/opt/catch2" ]; then export CMAKE_PREFIX_PATH=/opt/catch2; fi
@@ -45,7 +45,7 @@
4545
"C components UBSAN":
4646
tags: [ "arch:amd64" ]
4747
stage: test
48-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:bookworm-6"
48+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:bookworm-7"
4949
needs: []
5050
script:
5151
- if [ -f "/opt/libuv/lib/pkgconfig/libuv.pc" ]; then export PKG_CONFIG_PATH="/opt/libuv/lib/pkgconfig:$PKG_CONFIG_PATH"; fi
@@ -69,7 +69,7 @@
6969
"Build & Test Tea":
7070
tags: [ "arch:amd64" ]
7171
stage: build
72-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-6"
72+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7"
7373
parallel:
7474
matrix:
7575
- PHP_MAJOR_MINOR: *no_asan_minor_major_targets
@@ -98,7 +98,7 @@
9898
.tea_test:
9999
tags: [ "arch:amd64" ]
100100
stage: test
101-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-6"
101+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7"
102102
interruptible: true
103103
rules:
104104
- if: $CI_COMMIT_BRANCH == "master"
@@ -122,7 +122,7 @@
122122
needs: []
123123
variables:
124124
PHP_MAJOR_MINOR: "<?= $all_minor_major_targets[count($all_minor_major_targets) - 1] ?>"
125-
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-6"
125+
image: "registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7"
126126
script:
127127
- |
128128
if ! command -v cc >/dev/null 2>&1 && ! command -v clang >/dev/null 2>&1 && ! command -v gcc >/dev/null 2>&1; then
@@ -157,6 +157,9 @@
157157
extends: .tea_test
158158
variables:
159159
PHP_MAJOR_MINOR: "<?= $major_minor ?>"
160+
<?php if ($switch_php_version == "debug-zts-asan"): ?>
161+
ASAN_OPTIONS: "detect_stack_use_after_return=0"
162+
<?php endif; ?>
160163
needs:
161164
- job: "Build & Test Tea"
162165
parallel:

.gitlab/generate-tracer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function before_script_steps($with_docker_auth = false) {
6767
"compile extension: debug":
6868
stage: compile
6969
tags: [ "arch:${ARCH}" ]
70-
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-6
70+
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7
7171
parallel:
7272
matrix:
7373
- PHP_MAJOR_MINOR: *all_minor_major_targets
@@ -187,7 +187,7 @@ function before_script_steps($with_docker_auth = false) {
187187
.base_test:
188188
stage: test
189189
tags: [ "arch:${ARCH}" ]
190-
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-6
190+
image: registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-${PHP_MAJOR_MINOR}_bookworm-7
191191
timeout: 60m
192192
interruptible: true
193193
rules:
@@ -311,6 +311,7 @@ function before_script_steps($with_docker_auth = false) {
311311
PHP_MAJOR_MINOR: "<?= $major_minor ?>"
312312
ARCH: "amd64"
313313
TEST_PHP_JUNIT: "${CI_PROJECT_DIR}/tmp/build_extension/artifacts/tests/php-tests.xml"
314+
ASAN_OPTIONS: "abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1:detect_stack_use_after_return=0"
314315
script:
315316
- mkdir -p "${CI_PROJECT_DIR}/tmp/build_extension/artifacts/tests"
316317
- make test_c_observer

appsec/cmake/clang-format.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
set(_LLVM17_FORMAT /opt/homebrew/opt/llvm@17/bin/clang-format)
2-
if(EXISTS ${_LLVM17_FORMAT})
3-
set(CLANG_FORMAT ${_LLVM17_FORMAT})
4-
message(STATUS "Using Homebrew LLVM 17 clang-format: ${CLANG_FORMAT}")
1+
set(_LLVM19_FORMAT /opt/homebrew/opt/llvm@19/bin/clang-format)
2+
if(EXISTS ${_LLVM19_FORMAT})
3+
set(CLANG_FORMAT ${_LLVM19_FORMAT})
4+
message(STATUS "Using Homebrew LLVM 19 clang-format: ${CLANG_FORMAT}")
55
else()
6-
find_program(_CF_VERSIONED clang-format-17)
6+
find_program(_CF_VERSIONED clang-format-19)
77
if(NOT _CF_VERSIONED STREQUAL _CF_VERSIONED-NOTFOUND)
88
set(CLANG_FORMAT ${_CF_VERSIONED})
99
else()
@@ -14,15 +14,15 @@ else()
1414
OUTPUT_VARIABLE _CF_VERSION
1515
OUTPUT_STRIP_TRAILING_WHITESPACE
1616
ERROR_QUIET)
17-
if(_CF_VERSION MATCHES " 17\\.")
17+
if(_CF_VERSION MATCHES " 19\\.")
1818
set(CLANG_FORMAT ${_CF_UNVERSIONED})
1919
endif()
2020
endif()
2121
endif()
2222
if(NOT CLANG_FORMAT)
2323
set(CLANG_FORMAT ${CMAKE_CURRENT_LIST_DIR}/clang-tools/clang-format)
2424
if(NOT EXISTS ${CLANG_FORMAT})
25-
message(STATUS "Cannot find clang-format version 17, either set CLANG_FORMAT or make it discoverable")
25+
message(STATUS "Cannot find clang-format version 19, either set CLANG_FORMAT or make it discoverable")
2626
return()
2727
endif()
2828
message(STATUS "Using Docker-based clang-format wrapper: ${CLANG_FORMAT}")

appsec/cmake/clang-tidy.cmake

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Prefer a locally installed LLVM 17 run-clang-tidy (e.g. via brew install llvm@17)
1+
# Prefer a locally installed LLVM 19 run-clang-tidy (e.g. via brew install llvm@19)
22
# over the Docker-based wrapper, since native execution avoids SDK incompatibilities.
3-
set(_LLVM17_BIN /opt/homebrew/opt/llvm@17/bin)
4-
set(_LLVM17_TIDY ${_LLVM17_BIN}/run-clang-tidy)
3+
set(_LLVM19_BIN /opt/homebrew/opt/llvm@19/bin)
4+
set(_LLVM19_TIDY ${_LLVM19_BIN}/run-clang-tidy)
55
set(CLANG_TIDY_BINARY_OPT "")
6-
if(EXISTS ${_LLVM17_TIDY})
7-
set(CLANG_TIDY ${_LLVM17_TIDY})
8-
set(CLANG_TIDY_BINARY_OPT -clang-tidy-binary ${_LLVM17_BIN}/clang-tidy)
9-
message(STATUS "Using Homebrew LLVM 17 run-clang-tidy: ${CLANG_TIDY}")
6+
if(EXISTS ${_LLVM19_TIDY})
7+
set(CLANG_TIDY ${_LLVM19_TIDY})
8+
set(CLANG_TIDY_BINARY_OPT -clang-tidy-binary ${_LLVM19_BIN}/clang-tidy)
9+
message(STATUS "Using Homebrew LLVM 19 run-clang-tidy: ${CLANG_TIDY}")
1010
else()
11-
find_program(_RCT_VERSIONED run-clang-tidy-17)
11+
find_program(_RCT_VERSIONED run-clang-tidy-19)
1212
if(NOT _RCT_VERSIONED STREQUAL _RCT_VERSIONED-NOTFOUND)
1313
set(CLANG_TIDY ${_RCT_VERSIONED})
14-
find_program(_CT_VERSIONED clang-tidy-17)
14+
find_program(_CT_VERSIONED clang-tidy-19)
1515
if(NOT _CT_VERSIONED STREQUAL _CT_VERSIONED-NOTFOUND)
1616
set(CLANG_TIDY_BINARY_OPT -clang-tidy-binary ${_CT_VERSIONED})
1717
endif()
@@ -37,7 +37,7 @@ else()
3737
if(NOT CLANG_TIDY)
3838
set(CLANG_TIDY ${CMAKE_CURRENT_LIST_DIR}/clang-tools/run-clang-tidy)
3939
if(NOT EXISTS ${CLANG_TIDY})
40-
message(STATUS "Cannot find clang-tidy version 17, either set CLANG_TIDY or make it discoverable")
40+
message(STATUS "Cannot find clang-tidy version 19, either set CLANG_TIDY or make it discoverable")
4141
return()
4242
endif()
4343
message(STATUS "Using Docker-based run-clang-tidy wrapper: ${CLANG_TIDY}")

appsec/tests/fuzzer/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,24 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSIO
1919
OUTPUT_VARIABLE LLVM_RUNTIME_DIR
2020
OUTPUT_STRIP_TRAILING_WHITESPACE
2121
)
22+
# Newer clang versions return a per-target path (e.g. .../lib/x86_64-pc-linux-gnu) but
23+
# Debian/Ubuntu packages install runtime libs in the sibling "linux" directory.
24+
get_filename_component(LLVM_RUNTIME_PARENT "${LLVM_RUNTIME_DIR}" DIRECTORY)
25+
set(LLVM_RUNTIME_LINUX_DIR "${LLVM_RUNTIME_PARENT}/linux")
2226

2327
execute_process(COMMAND uname -m COMMAND tr -d '\n' OUTPUT_VARIABLE ARCHITECTURE)
2428
target_compile_definitions(ddappsec_helper_fuzzer PUBLIC ZLIB_CONST=1)
25-
target_link_directories(ddappsec_helper_fuzzer PRIVATE ${LLVM_RUNTIME_DIR})
29+
target_link_directories(ddappsec_helper_fuzzer PRIVATE ${LLVM_RUNTIME_DIR} ${LLVM_RUNTIME_LINUX_DIR})
2630
target_link_libraries(ddappsec_helper_fuzzer PRIVATE
2731
libddwaf_objects pthread spdlog cpp-base64 msgpack_c rapidjson_appsec
2832
boost_system zlibstatic)
2933

3034
set(FUZZER_LIB_NAME "libclang_rt.fuzzer_no_main-${ARCHITECTURE}.a")
31-
find_library(FUZZER_LIB ${FUZZER_LIB_NAME} PATHS ${LLVM_RUNTIME_DIR})
35+
find_library(FUZZER_LIB ${FUZZER_LIB_NAME} PATHS ${LLVM_RUNTIME_DIR} ${LLVM_RUNTIME_LINUX_DIR})
3236

3337
if(NOT FUZZER_LIB)
3438
set(FUZZER_LIB_NAME_FALLBACK "libclang_rt.fuzzer_no_main.a")
35-
find_library(FUZZER_LIB ${FUZZER_LIB_NAME_FALLBACK} PATHS ${LLVM_RUNTIME_DIR})
39+
find_library(FUZZER_LIB ${FUZZER_LIB_NAME_FALLBACK} PATHS ${LLVM_RUNTIME_DIR} ${LLVM_RUNTIME_LINUX_DIR})
3640
endif()
3741

3842
if(NOT FUZZER_LIB)

0 commit comments

Comments
 (0)