Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the compiler-flag compatibility change.
No open issues 🎉
What changed in this PR
Updates mimalloc’s native build configuration to avoid failures on compilers that reject -Wno-error=date-time, while preserving the existing workaround on supporting compilers.
Changes:
- Uses
flag_if_supportedfor the date/time warning flag on non-Windows targets.
| File | Description |
|---|---|
libmimalloc-sys/build.rs |
Checks compiler support before applying -Wno-error=date-time. |
Review effort: Balanced
CPunisher
pushed a commit
to swc-project/swc-next
that referenced
this pull request
Nov 2, 2026
## Motivation During the 0.5.0 release, the `aarch64-unknown-linux-gnu`, `powerpc64le-unknown-linux-gnu`, and `s390x-unknown-linux-gnu` builds failed while compiling mimalloc. NAPI's bundled GCC compilers reject `-Wno-error=date-time`, which `libmimalloc-sys` adds unconditionally. Pinning Clang 15 also fails on Ubuntu 26.04 because that package is no longer available. ## Changes Use Ubuntu's system Clang at `/usr/bin/clang` for the three affected targets while keeping `ubuntu-latest`. Install the unversioned `clang` package if needed, verify that it includes the required AArch64, PowerPC64LE, or SystemZ backend, and export `TARGET_CC` for the build. The absolute path avoids selecting another Clang earlier on `PATH`; NAPI retains its cross sysroot and linker configuration. Validation: actionlint passed; 13 matrix selections, nine compiler setup/backend scenarios, and three environment checks against the official NAPI CLI passed. Complete Linux builds using this final configuration have not been rerun; no release workflow was dispatched. ## Related Links - [Failed 0.5.0 GNU builds](https://github.com/swc-project/swc-next/actions/runs/41408325522) - [Ubuntu 26.04 cannot install clang-15](https://github.com/swc-project/swc-next/actions/runs/41412324382/job/125168000441) - [Rspack's Clang cross-build configuration](https://github.com/web-infra-dev/rspack/blob/1bd28315243e5351a41384366307cbd689c71d54/.github/workflows/reusable-build-build.yml#L89-L168) - [GitHub runner installation of system Clang](https://github.com/actions/runner-images/blob/main/images/ubuntu/scripts/build/install-clang.sh) - purpleprotocol/mimalloc_rust#175
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-Wdate-timewas introduced in GCC 4.9. Modern GCC versions support it, but older compilers are still used in cross-compilation toolchains. For example, another user reported a toolchain bundling GCC 4.8.5.The build script unconditionally adds
-Wno-error=date-timeon non-Windows targets. Older compilers that do not recognize this warning option fail with:Use
flag_if_supportedto check compiler support before adding the flag. Supporting compilers retain the date/time warning suppression introduced in #139; other compilers omit the unsupported option.Validation
cargo testandcargo test --features v2passed on macOS arm64.cargo fmt --all -- --checkandgit diff --checkpassed.cc 1.2.45and a compiler wrapper that rejects this option fails before the change and passes after it. With a supporting compiler, the flag remains in the mimalloc compile command.Related Links