Skip to content

Produce CoreCLR and native AOT WASI runtime packs - #10703

Open
MichalStrehovsky wants to merge 3 commits into
mainfrom
MichalStrehovsky-patch-1
Open

MichalStrehovsky wants to merge 3 commits into
mainfrom
MichalStrehovsky-patch-1

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

I ran an official build with the change here and it seems to work - the packages were produced: https://dev.azure.com/dnceng/internal/_build/results?buildId=3126023&view=results. The entire build still failed because CoreCLR is busted and asserted in unrelated legs (dotnet/runtime#136814 (comment)).

The packages will be produced as part of the existing WASI shortstack build. This is a departure from the Browser build but it is the desirable thing (#5954 (review)).

Cc @jkoritzinsky @akoeplinger @dotnet/ilc-contrib

@MichalStrehovsky
MichalStrehovsky requested review from a team as code owners November 4, 2026 11:43
Copilot AI balanced review requested due to automatic review settings November 4, 2026 11:43
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The default WASI build now feeds CoreCLR’s CoreLib metadata into Mono’s image generator, producing P/Invoke and interpreter-call tables from the wrong runtime unless mono.wasiruntime explicitly sets RuntimeFlavor=Mono.

1 open issue
What changed in this PR

Enables CoreCLR and Native AOT WASI runtime packs within the existing WASI short-stack build, rather than adding a separate build job.

Changes:

  • Includes CoreCLR alongside Mono in the default WASI build subsets.
  • Limits the VMR’s Native AOT restriction to browser builds.
  • Adds libPortableRuntime.a to the native platform manifest.
File Description
src/​runtime/​src/​installer/​pkg/​sfx/​Microsoft.NETCore.App/​Directory.Build.props Registers libPortableRuntime.a as a native manifest entry.
src/​runtime/​eng/​Subsets.props Enables combined CoreCLR and Mono WASI builds by default.
repo-projects/​runtime.proj Allows Native AOT for WASI while retaining the browser restriction.

Review effort: Balanced

<!-- OHOS is CoreCLR + NativeAOT only (no Mono dependency). -->
<DefaultSubsets Condition="'$(TargetsOpenHarmony)' == 'true'">clr.nativeaotruntime+clr.nativeaotlibs+clr+libs+host+packs</DefaultSubsets>
<DefaultSubsets Condition="'$(TargetsBrowser)' == 'true' and '$(RuntimeFlavor)' == 'CoreCLR'">clr+libs+tools+host+packs</DefaultSubsets>
<DefaultSubsets Condition="'$(TargetsWasi)' == 'true'">clr+mono+libs+host+packs</DefaultSubsets>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is the reason why we have the separate Browser_CoreCLR_Shortstack leg? I'll switch this to the same plan, I do not trust that the AdditionalProperties would be sufficient and we're clearly not equipped to detect this problem in the CI.

<PlatformManifestFileEntry Include="libbootstrapperdll.o" IsNative="true" />
<PlatformManifestFileEntry Include="libeventpipe-disabled.a" IsNative="true" />
<PlatformManifestFileEntry Include="libeventpipe-enabled.a" IsNative="true" />
<PlatformManifestFileEntry Include="libPortableRuntime.a" IsNative="true" />

@jkotas jkotas Nov 4, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this libRuntime.WorkstationGC.a like others architectures?

The "portable runtime" is meant to be a variant of the runtime for IL to C++ transpiler. It is not really the case for the current wasm runtime. The current wasm runtime is as "non-portable" as the runtime for any other platforms.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep it as-is. Otherwise, it's not clear to me how far we would we go with that; another "unnecessary" difference is that the portable build produces AsmOffsetsPortable.cs instead of AsmOffsets.cs. Would that change too?

I'm having trouble reasoning about this because on one hand we care about the imaged IL2CPP scenario when writing new code, and on the other hand we don't want the pre-existing support for it (the imaged IL2CPP scenario would likely need a separate libPortableRuntime.a).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need to be maintaining the "portable" build at all for the time being and resurrect it only if it becomes actually needed (with matching ILC support). It is something we have inherited from the original CoreRT that we can live without.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we dotnet/runtime#136511 (comment) the imaged IL2CPP scenario

I care about these opportunistically to separate different high-level concerns. It is ok if the thing does not actually work end-to-end, but it makes the code easier to understand and it makes it easier to enable it end-to-end once needed. For example, we have added PORTABLE_ENTRY_POINTS instead of just conditioning everything related to portable-entrypoint based on Wasm when the wasm port was starting that made the Wasm NAOT port less painful later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants