Skip to content

Commit

Permalink
fix(swc_malloc): Add target_env = "gnu" check (#10118)
Browse files Browse the repository at this point in the history
**Description:**

Fix build
  • Loading branch information
kdy1 authored Feb 27, 2025
1 parent 214f347 commit da81e11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/wise-hotels-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
swc_core: patch
swc_malloc: patch
---

fix(swc_malloc): Add `target_env = "gnu"` check
8 changes: 4 additions & 4 deletions crates/swc_malloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
6 changes: 5 additions & 1 deletion crates/swc_malloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit da81e11

Please sign in to comment.