Stream: wit-bindgen

Topic: ✔ [async] dropped from wasm names?


view this post on Zulip Notification Bot (Dec 08 2025 at 18:26):

Scott Waye has marked this topic as resolved.

view this post on Zulip Scott Waye (Dec 10 2025 at 00:14):

I know I marked this as resolved, but can I have a follow up? I can reproduce @Joel Dice output for the c generation, and I think I have the c# the same. The export side for the runner looks ok, but I now have an issue with its imports, e.g. one-argument. I see that the c generates these as

__attribute__((__import_module__("a:b/i"), __import_name__("[async-lower]one-argument")))
extern int32_t __wasm_import_a_b_i_one_argument(int32_t);

Which looks simple enough, and the c# generates

            [global::System.Runtime.InteropServices.DllImportAttribute("a:b/i", EntryPoint = "[async-lower]one-argument"), global::System.Runtime.InteropServices.WasmImportLinkageAttribute]
            public static extern uint wasmImportOneArgument(int p0);

Which seems correct. The object files produce (sorry for mixing windows and linux)

scott@surface7:/mnt/c/github/wit-bindgen/target/artifacts/simple-import-params-results/runner-csharp/bindings/obj/Debug/net9.0/wasi-wasm/native$ ~/github/emsdk/upstream/bin/llvm-nm *.o | grep one-argument
         U cell.__wasm_import_a:b/i_[async-lower]one-argument
         U cell.__wasm_import_a:b/i_[async-lower]one-argument-and-result
         U __wasm_import_a:b/i_[async-lower]one-argument
         U __wasm_import_a:b/i_[async-lower]one-argument-and-result
00000000 D cell.__wasm_import_a:b/i_[async-lower]one-argument
00000000 D cell.__wasm_import_a:b/i_[async-lower]one-argument-and-result
scott@surface7:/mnt/c/github/wit-bindgen/target/artifacts/simple-import-params-results/runner-csharp/bindings/obj/Debug/net9.0/wasi-wasm/native$

But the clang link stage fails with

------ Failure: simple-import-params-results --------
  component: runner
  path: tests/runtime-async/async\simple-import-params-results\runner.cs
  error: failed to compile component "tests/runtime-async/async\\simple-import-params-results\\runner.cs"

  Caused by:
      command execution failed
      command: "dotnet" "publish" "C:\\github\\wit-bindgen\\target/artifacts\\simple-import-params-results\\runner-csharp\\bindings\\RunnerWorld.csproj" "-r" "wasi-wasm" "-c" "Debug" "/p:PlatformTarget=AnyCPU" "/p:MSBuildEnableWorkloadResolver=false" "--self-contained" "/p:UseAppHost=false" "-o" "C:\\github\\wit-bindgen\\target/artifacts\\simple-import-params-results\\runner-csharp\\bindings\\csharp-testcase" "/p:_hostArchitecture=x64"
      status: exit code: 1
      stdout:
          Determining projects to restore...
          All projects are up-to-date for restore.
          RunnerWorld -> C:\github\wit-bindgen\target\artifacts\simple-import-params-results\runner-csharp\bindings\bin\Debug\net9.0\wasi-wasm\csharp-testcase.dll
          Generating native code
          LLVM compilation to IR finished in 1.21 seconds
          LLVM generation of bitcode finished in 0.18 seconds
          LLVM generation of debug info finished in 0.12 seconds
          Object writing finished in 0.17 seconds, allocated 35.43 MB
        EXEC : error : failed to encode component [C:\github\wit-bindgen\target\artifacts\simple-import-params-results\runner-csharp\bindings\RunnerWorld.csproj]

          Caused by:
              0: failed to decode world from module
              1: module was not valid
              2: failed to resolve import `a:b/i::[async-lower]one-argument`
              3: import interface `a:b/i` is missing function `one-argument` that is required by the module
        clang : error : linker command failed with exit code 1 (use -v to see invocation) [C:\github\wit-bindgen\target\artifacts\simple-import-params-results\runner-csharp\bindings\RunnerWorld.csproj]
        C:\github\wit-bindgen\target\artifacts\.packages\microsoft.dotnet.ilcompiler.llvm\10.0.0-preview.2.25509.1\build\Microsoft.NETCore.Native.targets(625,5): error MSB3073: The command ""c:\github\wasi-sdk27/bin/clang" @obj\Debug\net9.0\wasi-wasm\native\link.rsp " exited with code 1. [C:\github\wit-bindgen\target\artifacts\simple-import-params-results\runner-csharp\bindings\RunnerWorld.csproj]

view this post on Zulip Scott Waye (Dec 10 2025 at 00:18):

So it appears not to be able to resolve the symbol with the wit supplied to clang with -Wl,--component-type,RunnerWorld_component_type.wit

view this post on Zulip Scott Waye (Dec 10 2025 at 00:22):

This is a result of merging the latest main into the PR, which was green before, so I suspect I've got some more work to do as a result of the merge.

view this post on Zulip Alex Crichton (Dec 10 2025 at 02:23):

Does the C# toolchain itself provide a wasm-component-ld being used? That error is from wasm-component-ld (as opposed to LLVM, wasm-ld, or clang), and that looks like wasm-component-ld is too old

view this post on Zulip Scott Waye (Dec 11 2025 at 01:21):

Thanks, that was it!


Last updated: Jan 09 2026 at 13:15 UTC