Skip to content

Compilation issue with emscripten on Rust 1.93 #690

@vanyle

Description

@vanyle

In Rust 1.93.0, on Emscripten, the unwinding ABI used when compiling with panic=unwind was changed from the JS exception handling ABI to the wasm exception handling ABI.

Because of this, when using mlua with the wasm32-unknown-emscripten target, I get the following build errors:

asm-ld: error: /lua-emscripten/target/wasm32-unknown-emscripten/debug/deps/libmlua_sys-8018e743eb3fbf84.rlib(77fdd488a8a04085-ldo.o):
undefined symbol: llvm_eh_typeid_for

          wasm-ld: error: /lua-emscripten/target/wasm32-unknown-emscripten/debug/deps/libmlua_sys-8018e743eb3fbf84.rlib(77fdd488a8a04085-lvmload.o):
undefined symbol: __resumeException

This seems to fail for all Lua versions as well as Luau.
To reproduce:

mise.toml

[tools]
"asdf:mise-plugins/mise-emsdk" = "5.0.3"
rust = "1.93.0"

cargo.toml

[package]
name = "lua-emscripten"
version = "0.1.0"
edition = "2024"

[dependencies]
mlua = { version = "0.11.6", features = [
    "luau",
    "serde",
    "vendored",
] }

src/main.rs

use mlua::Lua;

fn main() {
    let lua = Lua::new();
    println!("{}", lua.globals().get::<String>("_VERSION").unwrap());
}

I couldn't find any set of flags to pass to cargo to make the compilation work. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions