Comments (5)
I'm a bit skeptical that this is related to corrosion. Corrosion / CMake does all its work at configure time. At build time the Generator (in your case ninja) invokes the build rules (e.g. cargo rustc ....
. There are multiple build rules, and Ninja will also spend some time evaluating Generator expressions and checking if a file was actually generated by the command. However, ninja is widely used and I doubt there is something there that could take a noticable amount of time. You could of course check if the issue also occurs when using Unix Makefiles
as the Generator.
sccache
is invoked by cargo
(assuming you are using RUSTC_WRAPPER=sccache
or something similar), so if the hang is related to sccache, then the issue is either on sccache or cargos side, since CMake / Ninja knows nothing about sccache.
from corrosion.
CMake sometimes hangs indefinitely after Cargo finishes building a crate.
Are your sure it is actually CMake that hangs? I've recently been experimenting on integrating a workaround for #413 into corrosion until it is fixed upstream, and have noticed hangs for the following dead simple program (only tested on mac):
// use std::ffi::OsString;
use std::process::Command;
fn main() {
// let args = std::env::args_os()
// .chain([OsString::from("--target=abcdefg")]);
let mut handle = Command::new("echo")
// .args(args)
.spawn()
.expect("Failed to spawn");
handle.wait().expect("Command wasn't running");
}
I get the following output:
❯ time $HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo run --release
Finished release [optimized] target(s) in 0.00s
Running `target/release/wrapper`
target/release/wrapper --target=abcdefg
$HOME/.rustup/toolchains/stable-aarch64-apple-darwin/bin/cargo run --release 0.01s user 0.01s system 0% cpu 3.081 total
The hang happens between "Running" which is printed immediately and the output of "echo" which can take seconds to appear, even though compilation has already finished!.
When cargo is removed from the picture I have not seen any hangs yet.
from corrosion.
Note that I used to have hangs as well when using vscode + CMake, but since disabling sccache i haven't observed them again. So I think it is somehow related to having sccache enabled.
from corrosion.
I think you are right that this only shows up with sccache. When the build hangs, neither rustc nor cargo processes are running. I don't know if Corrosion, CMake, or sccache are the problem; my guess is the bug is in sccache.
from corrosion.
Potentially related:
mozilla/sccache#1011
mozilla/sccache#756
I have never encountered this using sccache with Cargo alone (not using CMake + Corrosion).
from corrosion.
Related Issues (20)
- Rename CRATES parameter to PACKAGES or ONLY_PACKAGES
- Rename `Rust_CARGO_HOST_TARGET_ARCH` variable and friends
- Projects with multiple Rust targets have broken incremental compilation HOT 4
- Is there a way to have "corrosion_import_crate" import the crates at build time instead of configure time ? HOT 2
- `cc-rs` link issue on windows msvc targets when using Clang with GNU cmdline syntax HOT 10
- Recommanded way to have multiple staticlib with corrosion HOT 2
- Multi configuration builds don't work HOT 2
- Investigate FOLDER property for targets HOT 2
- Relevant upstream Cmake issues for corrosion custom target name improvements
- [Question]: How to maintain order of libraries HOT 2
- Cross-Compiling Rust cdylibs with clang as the linker is likely broken HOT 1
- Cross-compiling with clang and (c)dylibs in the dependency graph is broken
- Support installing libraries HOT 4
- MacOS fat binaries support HOT 8
- [Bug]: detecting native-static-libs on Windows with Rust 1.71 fails when linking crate from a workspace HOT 22
- Custom target support HOT 4
- Multi-crate setup: Recompiling shared dependencies HOT 4
- [Bug]: toxic `proc-macro2` version HOT 6
- `cargo rustc --crate-type` support HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from corrosion.