Rust errors / Build and Cargo
Rust build error · checked with Rust 1.99.0
error: could not compile `foo`... process didn't exit successfully (signal: 9, SIGKILL: kill)
error: could not compile `foo`... process didn't exit successfully (signal: 9, SIGKILL: kill)
What it meansThe operating system killed the compiler because it ran out of memory. Common on small CI runners, Docker containers and cheap VPSes, especially with release builds and LTO.
Why it happens
- Too many parallel rustc jobs for the RAM available.
- LTO or very large generic-heavy crates.
How to fix it
1. Build with fewer jobs
cargo build --release -j 22. Lighter release settings
In Cargo.toml.
[profile.release]
codegen-units = 16
lto = false3. Add swap on the build machine
sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfileOther wordings of this error
signal: 9, SIGKILL: kill, rustc killed signal 9, cargo build out of memory, process didn't exit successfully signal 9
Other build errors
- error: linker `link.exe` not found
- error: linker `cc` not found
- error: failed to run custom build command for `openssl-sys`
- error: failed to select a version for the requirement
- error: failed to select a version for `libsqlite3-sys`... the package `libsqlite3-sys` lin
- error: could not compile `my-crate` (bin "my-crate") due to 1 previous error
- error: package `foo v1.2.3` cannot be built because it requires rustc 1.80 or newer, while
- feature `edition2024` is required
Up next
Find the right pagePaste any Rust errorCompiler codes and build errors in one finder.Read it next →Also worth your time
Did this answer your question?