Skip to content

Luau MSVC target is compiled without exceptions #6

@trumank

Description

@trumank

This seems to be just a warning compiling on windows via MSVC:

[mlua-sys 0.8.3] C:\Users\truman\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\luau0-src-0.15.9+luau694\luau\Ast\src\Parser.cpp(219): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

But when cross compiling to x86_64-pc-windows-msvc via xwin (using clang-cl) it become an error:

cargo xwin build --release --target x86_64-pc-windows-msvc --features=luau

...

error: failed to run custom build command for `mlua-sys v0.8.3 (mlua/mlua-sys)`

Caused by:
  process didn't exit successfully: `mlua/target/release/build/mlua-sys-a4b95a46e60ed4ca/build-script-main` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=build
  cargo:warning=luau-src-rs/luau/Ast/src/Parser.cpp(123,5): error: cannot use 'throw' with exceptions disabled
  cargo:warning=  123 |     throw ParseError(location, message);
  cargo:warning=      |     ^
  cargo:warning=luau-src-rs/luau/Ast/src/Parser.cpp(219,5): error: cannot use 'try' with exceptions disabled
  cargo:warning=  219 |     try
  cargo:warning=      |     ^
  cargo:warning=luau-src-rs/luau/Ast/src/Parser.cpp(241,5): error: cannot use 'try' with exceptions disabled
  cargo:warning=  241 |     try
  cargo:warning=      |     ^
  cargo:warning=luau-src-rs/luau/Ast/src/Parser.cpp(4361,9): error: cannot use 'throw' with exceptions disabled
  cargo:warning= 4361 |         throw ParseError(location, message);
  cargo:warning=      |         ^
  cargo:warning=4 errors generated.

I do not know if keeping exceptions disabled is intended, but adding the following to src/lib.rs allows compiling via xwin:

if target.ends_with("msvc") {
    config.flag_if_supported("/EHsc");
}

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