bevyengine / bevyengine/bevy

Hotpatching has linker issue

Open
#24,832 0 comments 0 reactions 0 assignees View on GitHub
A-Dev-Tools C-Bug D-Complex S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

I couldn't find any info on **not** using latest dioxus, so I did. The Guide recommended 0.7.0rc.0, which I didn't deem important.

This linker error Deons't appear using `cargo run`

## Bevy version and features

- 0.17.3
- hotpatching

## Relevant system information

- cargo 1.98.0-nightly (a335d47ff 2026-06-26)
- dioxus 0.7.9 (bfcc111)
- macOS 27 beta 2

## What you did

Run `BEVY_ASSET_ROOT=. dx serve --hot-patch --features bevy/hotpatching --open false`

## What went wrong

I received the following linker issue:

```
18:48:11 [dev] Failed to generate fat binary: ld: reference to symbol (which has not been assigned an address) __RNvNvNvNtNtCsk61RC1e8olq_11bevy_hanabiclang: error: linker command failed with exit code 1 (use -v to see invocation)

18:48:11 [dev] Build failed: Failed to generate fat binary: ld: reference to symbol (which has not been assigned an address) __RNvNvNvNtNtCsk61RC1e8olqclang: error: linker command failed with exit code 1 (use -v to see invocation)
```

## Additional information

config.toml

```toml
# Optimize compiliation with faster codegen for our code, but keeps llvm for packages.
# NOTE: Cranelift is fast but results in slower binaries. We only use it for dev and not build.
#
# run `rustup component add rustc-codegen-cranelift-preview --toolchain nightly`
# to install

# Comment llvm/cranelift options when profiling. The profiler doesn't like it.
[unstable]
codegen-backend = true

# NOTE: cranelift doesn't work on macOS for now
# [profile.dev]
# codegen-backend = "cranelift"

[profile.dev.package."*"]
codegen-backend = "llvm"

# NOTE: For maximum performance, build using a nightly compiler
# If you are using rust stable, remove the "-Zshare-generics=y" below.

[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = [
"-Clink-arg=-fuse-ld=lld", # Use LLD Linker
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

[target.x86_64-apple-darwin]
rustflags = [
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

[target.aarch64-apple-darwin]
rustflags = [
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

[target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" # Use LLD Linker
rustflags = [
"-Zshare-generics=n",
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

[target.x86_64-pc-windows-gnu]
rustflags = [
"-Zshare-generics=y", # (Nightly) Make the current crate share its generic instantiations
"-Zthreads=0", # (Nightly) Use improved multithreading with the recommended amount of threads.
]

# Optional: Uncommenting the following improves compile times, but reduces the amount of debug info to 'line number tables only'
# In most cases the gains are negligible, but if you are on macos and have slow compile times you should see significant gains.
[profile.dev]
debug = 1
```


cargo.toml

```toml
[package]
name = "app"
version = "0.1.0"
edition = "2024"

[features]
webgl2 = []
default = ["debug_inspector"]
embed_assets = ["dep:bevy_embedded_assets"]
debug_inspector = ["dep:bevy-inspector-egui", "bevy/dynamic_linking"]
cross_windows = ["dep:blake3"]

[dependencies]
bevy = { version = "0.17.3", features = ["wav"] }
avian2d = "0.5"
bevy-inspector-egui = { version = "0.35", optional = true }
bevy_embedded_assets = { version = "0.14", optional = true }
bevy_hanabi = "0.17"
log = { version = "*", features = [
"max_level_debug",
"release_max_level_warn",
] }
rand = "0.9"

# For windows
[target.x86_64-pc-windows-msvc.dependencies]
# Use pure rust implementation of blake3 for cross-compilation, as blake3 assumes
# windows environment and tries to run EXE during compilation, which can fail
# during cross-compilation.
blake3 = { version = "1.8", features = ["pure"], optional = true }

# Enable a small amount of optimization in the dev profile.
[profile.dev]
opt-level = 1

# Enable a large amount of optimization in the dev profile for dependencies.
[profile.dev.package."*"]
opt-level = 3

# Enable more optimization in the release profile at the cost of compile time.
[profile.release]
opt-level = 3
# Compile the entire crate as one unit.
# Slows compile times, marginal improvements.
codegen-units = 1
# Do a second optimization pass over the entire program, including dependencies.
# Slows compile times, marginal improvements.
lto = "thin"
# NOTE: Use fat when releasing, but thin is also fine for profiling

# lto = "fat"

# Optimize for size in the wasm-release profile to reduce load times and bandwidth usage on web.
[profile.wasm-release]
# Default to release profile values.
inherits = "release"
# Optimize with size in mind (also try "z", sometimes it is better).
# Slightly slows compile times, great improvements to file size and runtime performance.
opt-level = "s"
# Strip all debugging information from the binary to slightly reduce file size.
strip = "debuginfo"

```


Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `dx serve --hot-patch --features bevy/hotpatching --open false`, comparing it with the working `cargo run` path. Review the linker and codegen settings in `config.toml` and the hotpatch-related dependencies and features in `cargo.toml`; done means the hotpatch build links successfully on the reported macOS setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.