From da81e112df25dca8f94c18eb3d60ddc9bb63248a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 27 Feb 2025 17:46:00 +0900 Subject: [PATCH] fix(swc_malloc): Add `target_env = "gnu"` check (#10118) **Description:** Fix build --- .changeset/wise-hotels-train.md | 6 ++++++ crates/swc_malloc/Cargo.toml | 8 ++++---- crates/swc_malloc/src/lib.rs | 6 +++++- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .changeset/wise-hotels-train.md diff --git a/.changeset/wise-hotels-train.md b/.changeset/wise-hotels-train.md new file mode 100644 index 000000000000..42f2e65ff556 --- /dev/null +++ b/.changeset/wise-hotels-train.md @@ -0,0 +1,6 @@ +--- +swc_core: patch +swc_malloc: patch +--- + +fix(swc_malloc): Add `target_env = "gnu"` check diff --git a/crates/swc_malloc/Cargo.toml b/crates/swc_malloc/Cargo.toml index f3231b06ceec..97e736dba8ab 100644 --- a/crates/swc_malloc/Cargo.toml +++ b/crates/swc_malloc/Cargo.toml @@ -6,18 +6,18 @@ edition = { workspace = true } license = { workspace = true } name = "swc_malloc" repository = { workspace = true } -version = "1.2.1" +version = "1.2.0" [lib] bench = false [dependencies] -[target.'cfg(not(any(target_os = "linux", target_family = "wasm", target_env = "musl", all(target_os = "linux", any(target_arch="aarch64", target_arch="arm")))))'.dependencies] +[target.'cfg(not(any(target_os = "linux", target_family = "wasm", target_env = "musl", all(target_os = "linux", any(target_arch="aarch64", target_env = "gnu", target_arch="arm")))))'.dependencies] mimalloc = { version = "0.1.43", features = [] } -[target.'cfg(all(target_os = "linux", not(any(target_family = "wasm", target_env = "musl", all(target_os = "linux", any(target_arch = "aarch64", target_arch = "arm"))))))'.dependencies] +[target.'cfg(all(target_os = "linux", not(any(target_family = "wasm", target_env = "musl", all(target_os = "linux", target_env = "gnu", any(target_arch = "aarch64", target_arch = "arm"))))))'.dependencies] mimalloc = { version = "0.1.43", features = ["local_dynamic_tls"] } -[target.'cfg(all(target_os = "linux", any(target_arch = "aarch64", target_arch = "arm")))'.dependencies] +[target.'cfg(all(target_os = "linux", target_env = "gnu", any(target_arch = "aarch64", target_arch = "arm")))'.dependencies] tikv-jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] } diff --git a/crates/swc_malloc/src/lib.rs b/crates/swc_malloc/src/lib.rs index 47a5c57a486a..bee848f0e923 100644 --- a/crates/swc_malloc/src/lib.rs +++ b/crates/swc_malloc/src/lib.rs @@ -24,6 +24,10 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; // On linux aarch64, mimalloc fails to build. // So we use tikv-jemallocator instead. -#[cfg(all(target_os = "linux", any(target_arch = "aarch64", target_arch = "arm")))] +#[cfg(all( + target_os = "linux", + target_env = "gnu", + any(target_arch = "aarch64", target_arch = "arm") +))] #[global_allocator] static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;