Skip to content

fatal runtime error: failed to initiate panic, error 5 #304

Description

@rcitsz

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions