-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fatal runtime error: failed to initiate panic, error 5 #304
Comments
No idea, why use static crt? It’s not common to do that on macOS. |
Whether it is dynamic linking or static linking, debug or release, I tried the following compilation commands and encountered the same issue: fatal runtime error: failed to initiate panic, error 5 cargo zigbuild --release --target aarch64-apple-darwin |
Nothing I can do here unless you can provide a minimal reproducible example. |
fn main() {
std::thread::spawn(|| {
std::thread::sleep(std::time::Duration::from_secs(1));
panic!("panic xxx");
});
loop {
std::thread::sleep(std::time::Duration::from_secs(1));
println!("continue...");
}
} compile using the docker image ghcr.io/rust-cross/cargo-zigbuild:latest: And then run the bin on my MacBook M1 Pro. But the Process terminated beacuse the panic. error: fatal runtime error: failed to initiate panic, error 5 If I compile directly on macOS without using zigbuild, it runs normally and a panic does not cause the process to exit: I need your help, thanks! |
The following command successfully compiles the result:
RUSTFLAGS='-C target-feature=+crt-static' cargo zigbuild --release --target aarch64-apple-darwin
However, at runtime, a panic in the program causes the process to exit. error: fatal runtime error: failed to initiate panic, error 5
If I compile directly on macOS without using zigbuild, it runs normally and a panic does not cause the process to exit:
RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target aarch64-apple-darwin
Why does the same code exhibit different panic behavior when compiled with cargo build versus cargo zigbuild?
The same issue occurs with x86_64-apple-darwin, where a panic causes the process to terminate:
RUSTFLAGS='-C target-feature=+crt-static' cargo zigbuild --release --target x86_64-apple-darwin
However, x86_64-pc-windows-gnu does not have this problem.
Thanks!
The text was updated successfully, but these errors were encountered: