Skip to content

Bevy dynamic-linking makes the program crash #1530

Open
@GglLfr

Description

@GglLfr

Minimal reproducible example: https://github.com/GlennFolker/cranedrop

The dynamic_linking feature flag, which converts bevy and std into a dylib for compile-time speedup, completely fails when using the Cranelift codegen backend.

System information:

  • OS and arch: Windows 11, x64.
  • Rustc version: rustc 1.83.0-nightly (0609062a9 2024-09-13).
  • Contents of ~/.cargo/Config.toml:
    [unstable]
    codegen-backend = true
    
    [profile.dev]
    codegen-backend = "cranelift"
    incremental = true
    lto = "off"
    
    [profile.dev.package."*"]
    opt-level = 3
    
    [profile.release]
    codegen-units = 1
    incremental = false
    lto = "on"
    
    [target.x86_64-pc-windows-msvc]
    linker = "rust-lld.exe"
    rustflags = [
        "-Z", "share-generics=no",
        "-Z", "threads=0",
    ]
    

cargo run with multi_threading disabled made the program encounter a segfault:

error: process didn't exit successfully: `target\x86_64-pc-windows-msvc\debug\cranedrop.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

cargo run with multi_threading enabled made the program panic:

thread 'main' panicked at C:\Users\glenn\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.14.2\src\task_pool.rs:186:22:
Failed to spawn thread.: Os { code: 87, kind: InvalidInput, message: "The parameter is incorrect." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\x86_64-pc-windows-msvc\debug\cranedrop.exe` (exit code: 0xe06d7363)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windowsOperating system: Windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions