Skip to content

Wasm-opt fails on Rust 1.87.0+, LLVM 20+ #2601

Description

@MolotovCherry

Describe the bug

An update to Rust with LLVM 20 requires new wasm features in the resulting binary. The new wasm features caused downstream breakage for a lot of people.

Affected: Rust 1.87.0+, LLVM 20+

Log file of failing build:
out.txt

Adding these flags to wasm-opt fixes the compilation
--enable-bulk-memory --enable-threads --enable-nontrapping-float-to-int

Note: I am unsure how exactly the compilation takes place. Perhaps who's at fault here is wasm-pack? In either case, this bridge plugin is still affected though

Please see
rust-lang/rust#137315
rust-lang/rust#137322
https://doc.rust-lang.org/nightly/rustc/platform-support/wasm32-unknown-unknown.html#enabled-webassembly-features

Steps to reproduce

flutter_rust_bridge_codegen build-web --release
flutter build web --wasm --release

Logs

n/a (log is in first post)

Expected behavior

Compiles properly

Generated binding code

n/a

OS

Wasm

Version of flutter_rust_bridge_codegen

2.8.0

Flutter info

[✓] Flutter (Channel stable, 3.29.0, on Microsoft Windows [Version 10.0.26100.3323], locale en-US) [310ms]
    • Flutter version 3.29.0 on channel stable at C:\Users\cherry\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (4 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

Version of clang++

n/a

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaitingWaiting for responses, PR, further discussions, upstream release, etcbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions