cargo: `cargo build` intermittently fails on darwin platform
Problem
cargo build intermittently fails for a project or its dependencies and subsequent re-builds succeed. For example, bitfield doesn’t have dependencies but this problem is observed for the project itself:
ash@cube ~/git/rust-bitfield % cargo build
Compiling bitfield v0.13.2 (/Users/ash/git/rust-bitfield)
error: could not compile `bitfield`
Caused by:
process didn't exit successfully: `rustc --crate-name bitfield src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=c7b624d34760ee7b -C extra-filename=-c7b624d34760ee7b --out-dir /Users/ash/git/rust-bitfield/target/debug/deps -C incremental=/Users/ash/git/rust-bitfield/target/debug/incremental -L dependency=/Users/ash/git/rust-bitfield/target/debug/deps` (signal: 6, SIGABRT: process abort signal)
ash@cube ~/git/rust-bitfield % cargo build
Compiling bitfield v0.13.2 (/Users/ash/git/rust-bitfield)
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
Subsequent rebuilds sometimes don’t help and some project continue failing.
Steps
- Try to build a cargo project
Possible Solution(s)
No response
Notes
This problem is observed on:
macOs Monterey
Version 12.0.1
Version
cargo 1.55.0
release: 1.55.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (8 by maintainers)
Commits related to this issue
- CI: bump Rust to 1.59.0 I had to disable Clippy on macOS because it fails with SIGABRT on Monterey. I found an ostensible workaround[1], but it didn't work for me. Since we're already running Clippy ... — committed to newsboat/newsboat by Minoru 2 years ago
- fix issue with toolchain compilation, fix from here - https://github.com/rust-lang/cargo/issues/10022\#issuecomment-985514227 — committed to mobilecoinofficial/rust-bitcode by the-real-adammork 2 years ago
I have opened https://github.com/rust-lang/rust/issues/92173 on the rustc side for this issue, as the realloc failure is almost certainly not a cargo issue.
I’m still curious about the discussion above about the descriptor limits. That seems unrelated, but I’d like to better understand if it is something that needs attention.
@akscram and everyone else here, can you say how you installed rust? Was it via the official builds (rustup or manually)? Or was it through a package manager?
I can confirm, raising fd limit helps on my system as well: