[wasm][wasi] Throw error when WasmBuildNative is explicitly set to false during a single-file build
WasmSingleFileBundle requires native build; therefore, explicitly setting WasmBuildNative to false is not allowed.
Fixes https://github.com/dotnet/runtime/issues/96863
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.
Issue Details
WasmSingleFileBundle requires native build; therefore, explicitly setting WasmBuildNative to false is not allowed.
Fixes https://github.com/dotnet/runtime/issues/96863
| Author: | mkhamoyan |
|---|---|
| Assignees: | mkhamoyan |
| Labels: |
|
| Milestone: | - |
I wonder if
WasmSingleFileBundleshould also be added to_BoolPropertiesThatTriggerRelinkinginstead of
That is a good idea. The error should happen everytime when _BoolPropertiesThatTriggerRelinking is triggered and the WasmBuildNative is explicitly set to false.
I wonder if
WasmSingleFileBundleshould also be added to_BoolPropertiesThatTriggerRelinkinginstead ofhttps://github.com/dotnet/runtime/blob/97aba7843fbb033fdb02f9f25d52765e7c89bd02/src/mono/wasm/build/WasmApp.Common.targets#L524
Thanks! Updated.
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
I see few common
_BoolPropertiesThatTriggerRelinkinginBrowserWasmApp.targetsand inWasiApp.targetscould we have them in common place ?
Moved only WasmNativeStrip. WasmEnableSIMD has different default values on wasi/browser.
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
That is a good idea. The error should happen everytime when _BoolPropertiesThatTriggerRelinking is triggered and the WasmBuildNative is explicitly set to false.
Can we implement a general rule? For example setting WasmEnableSIMD=false and WasmBuildNative=false is also not supported combination.
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
Can we implement a general rule? For example setting
WasmEnableSIMD=falseandWasmBuildNative=falseis also not supported combination.
Updated the rule.
dotnet-linker-tests fail for some reason
dotnet-linker-testsfail for some reason
yes , that's because we run these tests with WasmBuildNative=false https://github.com/dotnet/runtime/blob/e3165d613ff58466e3508114c20296777d378415/eng/pipelines/runtime-linker-tests.yml#L127
And artifacts/bin/trimmingTests/projects/System.Runtime.TrimmingTests/InvariantGlobalizationTrue/browser-wasm/project.csproj has InvariantGlobalization enabled.
I'm thinking that test suite is not configured correctly, and we need to enable WasmBuildNative=true there.
@radical do you remember why this change was needed https://github.com/dotnet/runtime/commit/eceb5c8951ca3e5902a6eecdd594f82916ff4762 ?
@radical do you remember why this change was needed https://github.com/dotnet/runtime/commit/eceb5c8951ca3e5902a6eecdd594f82916ff4762 ?
We didn't want native relinking for the linker tests. You can remove that WasmBuildNative=false from the command line, but then ensure that only the InvariantGlobalization* tests are being relinked on the dotnet-linker-tests pipeline.
We didn't want native relinking for the linker tests. You can remove that
WasmBuildNative=falsefrom the command line, but then ensure that only theInvariantGlobalization*tests are being relinked on the dotnet-linker-tests pipeline.
Removed WasmBuildNative=false , will check if it affects build times.
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
Removed
WasmBuildNative=false, will check if it affects build times.
This caused other failures like Could not find AOT cross compiler at $(_MonoAotCrossCompilerPath)=.
Removed
WasmBuildNative=false, will check if it affects build times.This caused other failures like
Could not find AOT cross compiler at $(_MonoAotCrossCompilerPath)=.
Make sure that WasmApp.InTree.targets is imported at https://github.com/dotnet/runtime/blob/ac149359907423b90513a8fa392b6977fd919a7c/eng/testing/tests.browser.targets . Check the binlog to see why it didn't get imported. It might be explicitly disabled somewhere for trimming tests.
Make sure that
WasmApp.InTree.targetsis imported at https://github.com/dotnet/runtime/blob/ac149359907423b90513a8fa392b6977fd919a7c/eng/testing/tests.browser.targets . Check the binlog to see why it didn't get imported. It might be explicitly disabled somewhere for trimming tests.
From binlog WasmApp.InTree.targets is imported.
After executing this block https://github.com/dotnet/runtime/blob/9699f39112b2aea89a05a74199baf9049db85537/src/mono/browser/build/BrowserWasmApp.targets#L233 _MonoAotCrossCompilerPath is empty , which is strange as from binlog I see
MonoAotCrossCompiler
/__w/1/s/artifacts/bin/mono/browser.wasm.Release/cross/browser-wasm/mono-aot-cross
RuntimeIdentifier = browser-wasm
Looking at the binlog the native build is being run for all the projects which is not what you want. And that is happening because of WasmNativeStrip is defaulting to true. Explicitly set that to false for the trimming projects.
Then you should have only the projects that do really want a native build like the ones with InvariantGlobalization.
which is strange as from binlog I see
MonoAotCrossCompiler /__w/1/s/artifacts/bin/mono/browser.wasm.Release/cross/browser-wasm/mono-aot-cross RuntimeIdentifier = browser-wasm
It is set only in the llvm-init project. src/mono/Directory.Build.props does set this up for in-tree builds, but it is not imported when the project is in artifacts because that is explicitly disabled with a custom Directory.Build.props. So, you would need to make the item available in the trimming project. You could do bring this in via eng/targetingpacks.targets.
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).
/azp run runtime-wasm
Azure Pipelines successfully started running 1 pipeline(s).