-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for building Wasm on Windows #45545
Conversation
Emscripten and EMSDK_PATH must be set up externally. This differs from linux and macos where we optionally can do it for you.
@lewing @akoeplinger Thoughts on where this should build on CI? |
cc @yowl |
/cc @radical |
We would need to get a Windows machine with Emscripten. The easiest way to do that is to install Emscripten on the fly. https://github.com/dotnet/runtimelab/blob/d0cda961aeda26faae17c474e26d822cd1e45438/eng/pipelines/runtimelab/install-emscripten.cmd is a small script to do that. I am not sure whether it would be appropriate for dotnet/runtime CI though. |
I think we'll mostly want to protect the Windows wasm build for local developer purposes, official builds will likely always use Linux so to me this would make it a good fit for the I'm not a big fan of introducing the on the fly download of Emscripten like you do in the runtimelab since it's another dependency that can break dotnet/runtime CI. |
Agreed re: not downloading emscripten every time. @lewing @radical Do you see the need to run tests? Or will only build validation suffice? |
@@ -110,4 +108,109 @@ | |||
SkipUnchangedFiles="true" /> | |||
</Target> | |||
|
|||
<UsingTask TaskName="GenerateWasmVersionFile" | |||
AssemblyFile="$(WasmBuildTasksAssemblyPath)"/> | |||
<Target Name="BuildWinWasmRuntimes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this target replace the make
invocation in BuildWasmRuntimes
? I mean, are they two effectively the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
Similar to what we do in build.sh
To avoid this error: Installing tool 'node-12.18.1-64bit'.. Installation failed! Error: Downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v12.18.1-win-x64.zip': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)> Warning: Possibly SSL/TLS issue. Update or install Python SSL root certificates (2048-bit or greater) supplied in Python folder or https://pypi.org/project/certifi/ and try again. Warning: The SDK/tool 'node-12.18.1-64bit' cannot be activated since it is not installed! Skipping this tool... The script comes from runtimelabs repo https://github.com/dotnet/runtimelab/blob/d0cda961aeda26faae17c474e26d822cd1e45438/eng/pipelines/runtimelab/update-machine-certs.ps1
And use it in Makefile and mono.proj
I think we are missing cmake and failing with: configure: cmake -DENABLE_WERROR=1 -DCMAKE_INSTALL_PREFIX=D:\workspace\_work\1\s\artifacts\obj\mono\Browser.wasm.Debug\out -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Debug -DGC_SUSPEND=preemptive -DENABLE_MINIMAL=jit,portability,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,shared_perfcounters,interpreter,threads,eventpipe,qcalls -DENABLE_INTERP_LIB=1 -DDISABLE_ICALL_TABLES=1 -DDISABLE_CRASH_REPORTING=1 -DENABLE_ICALL_EXPORT=1 -DENABLE_LAZY_GC_THREAD_CREATION=1 -DENABLE_LLVM_RUNTIME=1 -DENABLE_METADATA_UPDATE=1 "-DCMAKE_C_FLAGS= -fexceptions -ID:\workspace\_work\1\s\.packages\microsoft.netcore.runtime.icu.transport\6.0.0-preview.3.21151.1/runtimes/browser-wasm/native/include" "-DCMAKE_CXX_FLAGS= -fexceptions" D:\workspace\_work\1\s\src\mono\ -DCMAKE_TOOLCHAIN_FILE=D:\workspace\_work\1\s\src\mono\wasm\emsdk\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR="D:/workspace/_work/1/s/src/mono/wasm/emsdk/node/12.18.1_64bit/bin/node.exe" -G Ninja Traceback (most recent call last): File "D:\workspace\_work\1\s\src\mono\wasm\emsdk\upstream\emscripten\\emcmake.py", line 33, in <module> sys.exit(run()) File "D:\workspace\_work\1\s\src\mono\wasm\emsdk\upstream\emscripten\\emcmake.py", line 26, in run building.configure(sys.argv[1:]) File "D:\workspace\_work\1\s\src\mono\wasm\emsdk\upstream\emscripten\tools\building.py", line 339, in configure run_process(args, stdout=stdout, stderr=stderr, env=env, **kwargs) File "D:\workspace\_work\1\s\src\mono\wasm\emsdk\upstream\emscripten\tools\shared.py", line 94, in run_process ret = subprocess.run(cmd, check=check, input=input, *args, **kw) File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 472, in run File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 775, in __init__ File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 1178, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified D:\workspace\_work\1\s\src\mono\mono.proj(410,5): error MSB3073: The command "call D:\workspace\_work\1\s\src\mono\wasm\emsdk\emsdk_env.bat && emcmake cmake -DENABLE_WERROR=1 -DCMAKE_INSTALL_PREFIX=D:\workspace\_work\1\s\artifacts\obj\mono\Browser.wasm.Debug\out -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Debug -DGC_SUSPEND=preemptive -DENABLE_MINIMAL=jit,portability,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,shared_perfcounters,interpreter,threads,eventpipe,qcalls -DENABLE_INTERP_LIB=1 -DDISABLE_ICALL_TABLES=1 -DDISABLE_CRASH_REPORTING=1 -DENABLE_ICALL_EXPORT=1 -DENABLE_LAZY_GC_THREAD_CREATION=1 -DENABLE_LLVM_RUNTIME=1 -DENABLE_METADATA_UPDATE=1 -DCMAKE_C_FLAGS=" -fexceptions -ID:\workspace\_work\1\s\.packages\microsoft.netcore.runtime.icu.transport\6.0.0-preview.3.21151.1/runtimes/browser-wasm/native/include" -DCMAKE_CXX_FLAGS=" -fexceptions" D:\workspace\_work\1\s\src\mono\" exited with code 1. ##[error]src\mono\mono.proj(410,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command "call D:\workspace\_work\1\s\src\mono\wasm\emsdk\emsdk_env.bat && emcmake cmake -DENABLE_WERROR=1 -DCMAKE_INSTALL_PREFIX=D:\workspace\_work\1\s\artifacts\obj\mono\Browser.wasm.Debug\out -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Debug -DGC_SUSPEND=preemptive -DENABLE_MINIMAL=jit,portability,sgen_major_marksweep_conc,sgen_split_nursery,sgen_gc_bridge,sgen_toggleref,sgen_debug_helpers,sgen_binary_protocol,logging,shared_perfcounters,interpreter,threads,eventpipe,qcalls -DENABLE_INTERP_LIB=1 -DDISABLE_ICALL_TABLES=1 -DDISABLE_CRASH_REPORTING=1 -DENABLE_ICALL_EXPORT=1 -DENABLE_LAZY_GC_THREAD_CREATION=1 -DENABLE_LLVM_RUNTIME=1 -DENABLE_METADATA_UPDATE=1 -DCMAKE_C_FLAGS=" -fexceptions -ID:\workspace\_work\1\s\.packages\microsoft.netcore.runtime.icu.transport\6.0.0-preview.3.21151.1/runtimes/browser-wasm/native/include" -DCMAKE_CXX_FLAGS=" -fexceptions" D:\workspace\_work\1\s\src\mono\" exited with code 1.
This reverts commit bd95f34.
Can't wait to use this. 👀 |
To try if it helps with the cmake issue
Also revert emscripten version back
This reverts commit b1c4da1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. There are some issues like it breaks if the runtime checkout is in a path with spaces, but we can fix those in a follow up PR. CI doesn't have the same issue.
Great job everyone! |
jobParameters: | ||
testGroup: innerloop | ||
nameSuffix: Browser_wasm_Windows | ||
buildArgs: -subset mono+libs /p:RuntimeFlavor=Mono |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that it's the runtime-staging pipeline this is probably fine temporarily but for regular runs we need to take another look since right now this clones emsdk and downloads binaries from google storage on each PR which is something we generally want to avoid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, looking forward to use the nuget instead
@ivan-prodanov we have few more pieces to get into place first but we will be documenting the process soon. |
@@ -360,11 +386,12 @@ | |||
</ItemGroup> | |||
|
|||
<PropertyGroup> | |||
<_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) $(MonoProjectRoot)</_MonoCMakeConfigureCommand> | |||
<_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) $(MonoProjectRoot.TrimEnd('\/'))</_MonoCMakeConfigureCommand> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there some msbuild magic function for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find any. There are functions that do the opposite - make sure that there is trailing slash. @radical do you know if there's better way to do this?
Emscripten and EMSDK_PATH must be set up externally. This differs from linux and macos where we optionally can do it for you.