bevyengine / bevyengine/bevy

macOS: main branch fails to compile with cranelift (unsupported section type mod_init_funcs)

Open
#20,785 7 comments 5 reactions 0 assignees View on GitHub
A-Cross-Cutting C-Bug I-Compile-Failure O-MacOS S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

```
error: #[link_section = "__mod_init_func"] is not supported: unsupported section type mod_init_funcs

error: could not compile `bevy_reflect` (lib) due to 1 previous error
```

## Bevy version and features

- main branch commit `cbf989c`

## Relevant system information

running with `cargo 1.91.0-nightly (a6c58d430 2025-08-26)` on macOS 15.6

## Steps to reproduce

create an empty project with bevy set to track the main branch and add cranelift to your `.cargo/config.toml`
```toml
[unstable]
codegen-backend = true

[profile.dev]
codegen-backend = "cranelift"
```

## What went wrong

Project fails to compile `bevy_reflect` with the error
```
error: #[link_section = "__mod_init_func"] is not supported: unsupported section type mod_init_funcs

error: could not compile `bevy_reflect` (lib) due to 1 previous error
```

## Related issues

This appears to be an issue in cranelift itself
- https://github.com/rust-lang/rustc_codegen_cranelift/issues/1588

That being said (i think) downstream crates found workarounds?
- https://github.com/dtolnay/inventory/issues/82

im not very knowledgeable on either of these topics however so i cant say for sure.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.