Skip to content

Dynamically linked Bevy (bevy_dylib) doesn't work in panic = "abort" programs #24300

@dlight

Description

@dlight

What problem does this solve or what need does it fill?

Currently it is not possible to compile with panic = "abort" and also dynamically link Bevy. It fails with

   Compiling bevy_dylib v0.18.1
error: the linked panic runtime `panic_unwind` is not compiled with this crate's panic strategy `abort`

What solution would you like?

Maybe some feature flag, or some other way to still use Bevy with dynamic linking (maybe through another crate bevy_dylib_nounwind? not sure about the details) on projects that set panic = "abort".

What alternative(s) have you considered?

Maybe locally patching Bevy to make it compile the dylib with panic = "abort" rather than panic = "unwind"? I'm currently investigating that

Additional context

Aborting on panic makes the compiler have less work to perform and also makes binaries smaller. Not sure if this translates to meaningful gains on either compile time or target/ dir size, but it should not harm anything (I don't want to run destructors on panic, panic hooks are sufficient).

Here I'm supposing that there is no part of Bevy that will not work without stack unwinding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-FeatureA new feature, making something new possibleS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions