Skip to content

Update NativeAOT-LLVM infrastructure to current ABI#4515

Open
cloutiertyler wants to merge 1 commit intomasterfrom
tyler/update-nativeaot-llvm-infrastructure
Open

Update NativeAOT-LLVM infrastructure to current ABI#4515
cloutiertyler wants to merge 1 commit intomasterfrom
tyler/update-nativeaot-llvm-infrastructure

Conversation

@cloutiertyler
Copy link
Contributor

@cloutiertyler cloutiertyler commented Mar 2, 2026

Summary

  • Update the experimental NativeAOT-LLVM build path (EXPERIMENTAL_WASM_AOT=1) to include all host function imports from ABI versions 10.0 through 10.4
  • Fix the compiler package reference to work on both Windows x64 and Linux x64 (was hardcoded to Windows only)
  • Add a CI smoketest to verify AOT builds work on Linux x64

Context

See #4514 for the full writeup on the C# AOT situation. The wasi-experimental workload that all C# module builds depend on is deprecated and removed from .NET 9+. NativeAOT-LLVM is the recommended path forward for ahead-of-time compilation of C# to WebAssembly.

The existing NativeAOT-LLVM support (added by RReverser in #713) was stale: missing imports added since then and a Windows-only package reference.

Changes

SpacetimeDB.Runtime.targets:

  • Add 10 missing WasmImport declarations across spacetime_10.0 through 10.4
  • Replace runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM with runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM so it resolves correctly on Linux x64 as well
  • Use explicit version strings instead of the $(SpacetimeNamespace) variable

ci.yml:

  • Add AOT build smoketest step in the csharp-testsuite job

Test plan

  • CI smoketest passes: EXPERIMENTAL_WASM_AOT=1 dotnet publish -c Release builds successfully on Linux x64
  • Existing C# tests continue to pass (no changes to the default interpreter path)

The experimental NativeAOT-LLVM build path (EXPERIMENTAL_WASM_AOT=1) was
missing several host function imports added in ABI versions 10.0-10.4,
and the compiler package reference was hardcoded to Windows x64 only.

Changes to SpacetimeDB.Runtime.targets:
- Add missing spacetime_10.0 imports: datastore_update_bsatn, identity
- Add all spacetime_10.1 imports: bytes_source_remaining_length
- Add all spacetime_10.2 imports: get_jwt
- Add all spacetime_10.3 imports: procedure_start_mut_tx,
  procedure_commit_mut_tx, procedure_abort_mut_tx, procedure_http_request
- Add all spacetime_10.4 imports: datastore_index_scan_point_bsatn,
  datastore_delete_by_index_scan_point_bsatn
- Replace hardcoded runtime.win-x64 package reference with
  runtime.$(NETCoreSdkPortableRuntimeIdentifier) so the AOT compiler
  package resolves correctly on both Windows x64 and Linux x64
- Use explicit version strings instead of $(SpacetimeNamespace) variable

Changes to ci.yml:
- Add AOT build smoketest in csharp-testsuite job to verify the
  NativeAOT-LLVM build path works on Linux x64

See #4514 for full context on the C# AOT situation.
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.

1 participant