From b10369631e0ef986114b2ba1beb07877c198d02d Mon Sep 17 00:00:00 2001 From: Laura Nao Date: Wed, 19 Nov 2025 15:03:25 +0100 Subject: [PATCH] ci/container: Add script to build Perfetto tracebox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a script to build Perfetto’s tracebox tool for x86_64 and arm64 targets on Linux and Android. Signed-off-by: Laura Nao Part-of: --- .gitlab-ci/container/build-perfetto.sh | 77 +++++++++++++++++++ ...-library-build-errors-with-Debian-13.patch | 49 ++++++++++++ 2 files changed, 126 insertions(+) create mode 100755 .gitlab-ci/container/build-perfetto.sh create mode 100644 .gitlab-ci/container/patches/build-perfetto-Fix-C-standard-library-build-errors-with-Debian-13.patch diff --git a/.gitlab-ci/container/build-perfetto.sh b/.gitlab-ci/container/build-perfetto.sh new file mode 100755 index 00000000000..328851d348f --- /dev/null +++ b/.gitlab-ci/container/build-perfetto.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +set -uex + +section_start perfetto "Building perfetto" + +BASE_PWD=$PWD + +PERFETTO_REVISION=$(grep 'revision =' subprojects/perfetto.wrap | cut -d ' ' -f3) + +patch_files=( + "build-perfetto-Fix-C-standard-library-build-errors-with-Debian-13.patch" +) + +# Set PERFETTO_ARCH based on DEBIAN_ARCH +if [[ -z "${PERFETTO_ARCH:-}" ]]; then + case "$DEBIAN_ARCH" in + amd64) PERFETTO_ARCH=x64;; + arm64) PERFETTO_ARCH=arm64;; + esac +fi + +git clone --branch "$PERFETTO_REVISION" --depth 1 https://github.com/google/perfetto /perfetto + +pushd /perfetto + +for patch in "${patch_files[@]}"; do + echo "Applying patch: $patch" + git am "$BASE_PWD/.gitlab-ci/container/patches/$patch" +done + +# Base GN args +mkdir -p _build +cat >_build/args.gn < arm64 cross-compiler. + cat >>_build/args.gn < +Date: Wed, 12 Nov 2025 14:45:32 +0100 +Subject: [PATCH] Fix C++ standard library build errors with Debian 13 + +Address missing and includes that caused build +failures ("no member named 'find' in namespace 'std'" and +"error: no template named 'optional' in namespace 'std'") when building +with the native toolchain on Debian 13. + +This was fixed upstream in v48[1] and v49[2] respectively, so this patch +can be dropped once Perfetto is updated to v48+. + +[1] https://github.com/google/perfetto/commit/d005c0123b2f929b918359a53ffe61d7ca2212a0 +[2] https://github.com/google/perfetto/commit/acc24608c84d2d2d8d684f40a110d0a6f4eddc51 + +Signed-off-by: Laura Nao +--- + src/profiling/common/producer_support.cc | 1 + + src/traced/probes/sys_stats/sys_stats_data_source.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/profiling/common/producer_support.cc b/src/profiling/common/producer_support.cc +index 5303658..e9e193d 100644 +--- a/src/profiling/common/producer_support.cc ++++ b/src/profiling/common/producer_support.cc +@@ -16,6 +16,7 @@ + + #include "src/profiling/common/producer_support.h" + ++#include + #include + + #include "perfetto/ext/base/android_utils.h" +diff --git a/src/traced/probes/sys_stats/sys_stats_data_source.h b/src/traced/probes/sys_stats/sys_stats_data_source.h +index e09cd8a..7e4749b 100644 +--- a/src/traced/probes/sys_stats/sys_stats_data_source.h ++++ b/src/traced/probes/sys_stats/sys_stats_data_source.h +@@ -21,6 +21,7 @@ + + #include + #include ++#include + #include + + #include "perfetto/ext/base/paged_memory.h" +-- +2.39.5 +