Skip to content

Commit 2d573ed

Browse files
committed
fix: patch libmimalloc-sys to use upstream fix for cross-compilation
Use git version of libmimalloc-sys from master branch which includes the fix for -Wdate-time cross-compilation issue (PR #139). The upstream fix adds -Wno-error=date-time flag to the build script for non-Windows targets, which resolves the compilation error when cross-compiling to ARM architectures (aarch64, armv7). This allows us to: - Use mimalloc on all architectures (not just x86_64) - Remove conditional compilation workarounds - Get the performance benefits of mimalloc everywhere Reference: purpleprotocol/mimalloc_rust#139
1 parent 274f535 commit 2d573ed

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,18 @@ socket2 = "0.6"
8989
libc = "0.2"
9090
clap-verbosity-flag = { version = "3.0.4", default-features = false, features = ["tracing"] }
9191
chrono = { version = "0.4.42", features = ["clock"] }
92-
mimalloc = { version = "0.1", features = ["v3"], optional = true }
92+
mimalloc = { version = "0.1", features = ["v3"] }
9393
compact_str = { version = "0.9", features = ["serde"] }
9494
smallvec = { version = "1.13", features = ["serde"] }
9595

9696
[features]
97-
default = ["mimalloc"]
97+
default = []
9898
metrics = ["prometheus", "lazy_static"]
99-
mimalloc = ["dep:mimalloc"]
99+
100+
[patch.crates-io]
101+
# Use git version with fix for -Wdate-time cross-compilation issue
102+
# https://github.com/purpleprotocol/mimalloc_rust/pull/139
103+
libmimalloc-sys = { git = "https://github.com/purpleprotocol/mimalloc_rust", branch = "master" }
100104

101105
[build-dependencies]
102106
anyhow = "1.0.95"

src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
// Use mimalloc only on x86_64 to avoid cross-compilation issues
2-
#[cfg(all(feature = "mimalloc", target_arch = "x86_64"))]
31
use mimalloc::MiMalloc;
42

5-
#[cfg(all(feature = "mimalloc", target_arch = "x86_64"))]
63
#[global_allocator]
74
static GLOBAL: MiMalloc = MiMalloc;
85

0 commit comments

Comments
 (0)