You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WASI components import wasi:cli/environemnt and wasi:cli/exit when not being used #107405
When building a component for wasi:http when running in wasmtime I get the following error:
wasmtime serve .\bin\Debug\net8.0\wasi-wasm\native\MyApp.wasm --addr 127.0.0.1:3000
Error: component imports instance `wasi:cli/environment@0.2.0`, but a matching implementation was not found in the linker
Caused by:
0: instance export `get-environment` has the wrong type
1: function implementation is missing
When inspecting the component built I see imports for wasi:cli/environemnt and wasi:cli/exit, even though I only built against the wasi:http world:
Note that you can specify -Wl,--wasi-adapter,proxy to the linker (e.g. as a CustomLinkerArg) when targeting wasi-http, which will stub out those imports.
It is by design that the actual imports is a superset of "used" imports (including from other worlds). I expect that in the long term, as both WASI and .NET's use of it mature, this set will only grow.
It is by design that the actual imports is a superset of "used" imports (including from other worlds). I expect that in the long term, as both WASI and .NET's use of it mature, this set will only grow.
I guess I am not following this fully. In this case the component implements wasi-http not wasi-cli. Why would it have wasi-cli imports if it's not using it?
I guess I am not following this fully. In this case the component implements wasi-http not wasi-cli
The .NET runtime assumes that it has access to the full "system library"; it differentiates these libraries by the OS component of the RID. Since we only have wasi-wasm, there is one and only monolithic WASI.
Why would it have wasi-cli imports if it's not using it?
There is a path somewhere (which could be dynamically unreachable) that eventually calls the imports. Consider e. g. that a lot of knobs that .NET exposes are configured via environment variables.
Activity
dicej commentedon Sep 5, 2024
Note that you can specify
-Wl,--wasi-adapter,proxyto the linker (e.g. as aCustomLinkerArg) when targeting wasi-http, which will stub out those imports.SingleAccretion commentedon Sep 5, 2024
It is by design that the actual imports is a superset of "used" imports (including from other worlds). I expect that in the long term, as both WASI and .NET's use of it mature, this set will only grow.
CustomLinkerArg->LinkerArg(#107194 (comment)).dotnet-policy-service commentedon Sep 5, 2024
Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.
jsturtevant commentedon Sep 6, 2024
I guess I am not following this fully. In this case the component implements wasi-http not wasi-cli. Why would it have wasi-cli imports if it's not using it?
SingleAccretion commentedon Sep 10, 2024
The .NET runtime assumes that it has access to the full "system library"; it differentiates these libraries by the OS component of the RID. Since we only have
wasi-wasm, there is one and only monolithic WASI.There is a path somewhere (which could be dynamically unreachable) that eventually calls the imports. Consider e. g. that a lot of knobs that .NET exposes are configured via environment variables.