Cargo build hanging on macOS when spawning cc subprocess
⚓ Rust 📅 2025-12-10 👤 surdeus 👁️ 3Every now and then when building my project using cargo build the build process will hang on building a third-party crate. Up until now it's always been aws-lc-sys, but today I'm getting what looks like the same behaviour with mimalloc-sys.
Through verbose cargo output I trace this to the execution of build-script-build hanging. I then ran that binary manually which seemed to suggest the C compiler was hanging. Running again with CC_ENABLE_DEBUG_OUTPUT=1 confirmed that. The last output line I see is
running: "cc" "-E" "<project_root>/target/release/build/libmimalloc-sys-8a98c87ac87a2446/out/13408290981209617847detect_compiler_family.c"
Full build-script-build output (click for more details)
at this point in activity monitor I can see a clang subprocess running with 0% cpu usage. A dump of the process show it's hanging in a write syscall.
Running the exact same cc invocation manually works fine and produces the following output
The best I can make of this is that something's going wrong in the communication between the parent and child process. Perhaps the child's stdout or stderr pipe is not being drained properly or something like that.
Does anyone have an idea what could be going on here or how I can troubleshoot further?
4 posts - 2 participants
🏷️ Rust_feed