Skip to content

Luau compilation fails with the wasm32-unknown-emscripten target on Windows. #2

@DynamicField

Description

@DynamicField

When compiling mlua with the luau feature using cargo build -target wasm32-unknown-emscripten on a Windows machine, an error occurs where the compiler believes that /std:c++17 is a path to a compiled file:

warning: mlua-sys@0.6.0: em++: error: /std:c++17: No such file or directory ("/std:c++17" was expected to be an input file, based on the commandline arguments provided)

error: failed to run custom build command for `mlua-sys v0.6.0`
[...]

error occurred: Command "cmd" "/c" "em++.bat" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-emscripten" "-I" "C:\\Users\\jeuxj\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\luau0-src-0.9.1+luau625\\luau\\Ast\\include" "-I" "C:\\Users\\jeuxj\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\luau0-src-0.9.1+luau625\\luau\\Common\\include" "-std=c++17" "/std:c++17" "-fexceptions" "-fno-math-errno" "-DLUAI_MAXCSTACK=1000000" "-DLUA_VECTOR_SIZE=3" "-DNDEBUG" "-o" "C:\\Users\\jeuxj\\FastDev\\Proj\\target\\wasm32-unknown-emscripten\\release\\build\\mlua-sys-7b31f19e5a5927e4\\out\\luau-build\\lib\\9bb9ba4c8bd32a76-Ast.o" "-c" "C:\\Users\\jeuxj\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\luau0-src-0.9.1+luau625\\luau\\Ast\\src\\Ast.cpp" with args cmd did not execute successfully (status code exit code: 1).

This likely due to both -std=c++17 and /std:c++17 arguments being specified, which causes the compiler to be weirdly confused (see https://github.com/mlua-rs/luau-src-rs/blob/main/src/lib.rs#L116-L117)

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