From cdd2c25afa18fc4c997fd16df82d73323de471e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Tue, 2 Dec 2025 14:37:28 -0800 Subject: [PATCH 1/3] [build] Don't include sanitizer AOT runtimes for musl-libc --- sdk/BUILD.gn | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 362ae8c556a7..216e869e2ee5 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -13,6 +13,7 @@ # or ":copy_libraries" may delete/overwrite your addition, and the build will # fail. +import("../build/config/sysroot.gni") import("../build/dart/copy_tree.gni") import("../build/executable_suffix.gni") import("../sdk_args.gni") @@ -379,10 +380,10 @@ copy_sanitizer_deps = [] # If the default toolchain is already using a sanitizer, the sanitizer variant # toolchains will try to use multiple sanitizers at the same time, which # doesn't work. If we're not on Linux, the sanitizers are not statically linked -# and not useable outside our tree. If we're are embedded in another GN -# buildroot, such as Flutter, the sanitizer variant toolchains might not be -# defined. -if (!using_sanitizer && current_os == "linux" && +# and not useable outside our tree. If we're on Linux with musl-libc, the +# sanitizers don't work. If we're are embedded in another GN buildroot, such as +# Flutter, the sanitizer variant toolchains might not be defined. +if (!using_sanitizer && current_os == "linux" && dart_sysroot != "alpine" && get_path_info(".", "abspath") == "//sdk/") { sanitizers = [] if (current_cpu == "x64" || current_cpu == "arm64") { From 6cce5a0c08ca5d5db291543748448dfd7082dfe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Wed, 3 Dec 2025 10:23:08 -0800 Subject: [PATCH 2/3] [build] Don't import sysroot.gni for Flutter --- sdk/BUILD.gn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 216e869e2ee5..9d6c876eeda8 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -13,12 +13,17 @@ # or ":copy_libraries" may delete/overwrite your addition, and the build will # fail. -import("../build/config/sysroot.gni") import("../build/dart/copy_tree.gni") import("../build/executable_suffix.gni") import("../sdk_args.gni") import("../utils/application_snapshot.gni") +# If we're are embedded in another GN buildroot, such as Flutter, the sysroot +# might already be imported from elsewhere. +if (!defined(dart_sysroot)) { + import("../build/config/sysroot.gni") +} + declare_args() { # Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries. dart_platform_sdk = true From e378e31d354b3e254719be4e03c050151453cd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AA=E3=81=A4=E3=81=8D?= Date: Wed, 3 Dec 2025 10:37:26 -0800 Subject: [PATCH 3/3] [build] Don't include sysroot for flutter --- sdk/BUILD.gn | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn index 9d6c876eeda8..3caf66e2cf83 100644 --- a/sdk/BUILD.gn +++ b/sdk/BUILD.gn @@ -20,7 +20,7 @@ import("../utils/application_snapshot.gni") # If we're are embedded in another GN buildroot, such as Flutter, the sysroot # might already be imported from elsewhere. -if (!defined(dart_sysroot)) { +if (get_path_info(".", "abspath") == "//sdk/") { import("../build/config/sysroot.gni") } @@ -388,7 +388,8 @@ copy_sanitizer_deps = [] # and not useable outside our tree. If we're on Linux with musl-libc, the # sanitizers don't work. If we're are embedded in another GN buildroot, such as # Flutter, the sanitizer variant toolchains might not be defined. -if (!using_sanitizer && current_os == "linux" && dart_sysroot != "alpine" && +if (!using_sanitizer && current_os == "linux" && + !(defined(dart_sysroot) && dart_sysroot == "alpine") && get_path_info(".", "abspath") == "//sdk/") { sanitizers = [] if (current_cpu == "x64" || current_cpu == "arm64") {