Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasi] Improve error message for missing WASI SDK #94671

Closed
RReverser opened this issue Nov 13, 2023 · 6 comments · Fixed by #94688
Closed

[wasi] Improve error message for missing WASI SDK #94671

RReverser opened this issue Nov 13, 2023 · 6 comments · Fixed by #94688
Labels
arch-wasm WebAssembly architecture area-Build-mono os-wasi Related to WASI variant of arch-wasm

Comments

@RReverser
Copy link

Description

Trying to build a project targeting wasi-wasm with latest preview results in:

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk\8.0.0-rc.2.23479.6\Sdk\WasiApp.Native.targets(54,5): error : Could not fin
d wasi-sdk. Either set $(WASI_SDK_PATH), or use workloads to get the sdk. SDK is required for building native files.

Reproduction Steps

Build any project with <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>, e.g. the default wasi console template while not having WASI SDK installed globally.

Expected behavior

It should provision WASI SDK automatically when installing the wasi-experimental workload. It seems there is some code for this in the repo

runtime/src/mono/mono.proj

Lines 174 to 186 in af0227f

<Target Name="ProvisionWasiSdk"
Condition="'$(ShouldProvisionWasiSdk)' == 'true' and '$(SkipMonoCrossJitConfigure)' != 'true'">
<ReadLinesFromFile File="$(MSBuildThisFileDirectory)/wasi/wasi-sdk-version.txt">
<Output TaskParameter="Lines" ItemName="_VersionLines" />
</ReadLinesFromFile>
<PropertyGroup>
<WasiLocalPath>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasi'))</WasiLocalPath>
<WasiSdkVersion>%(_VersionLines.Identity)</WasiSdkVersion>
<WasiSdkUrl>https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-linux.tar.gz</WasiSdkUrl>
<WasiSdkUrl Condition="'$(HostOS)' == 'osx'" >https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-macos.tar.gz</WasiSdkUrl>
<WasiSdkUrl Condition="'$(HostOS)' == 'windows'" >https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0.m-mingw.tar.gz</WasiSdkUrl>
</PropertyGroup>
but I guess it's not hooked up all the way?

Alternatively, at least provide a clear error message on how to retrieve one manually for now.

Actual behavior

The error message says

or use workloads to get the sdk

even though that doesn't seem to be supported.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 13, 2023
@RReverser RReverser changed the title Misleading message for provisioning WASI SDK [wasi] Misleading message for provisioning WASI SDK Nov 13, 2023
@radical radical added arch-wasm WebAssembly architecture os-wasi Related to WASI variant of arch-wasm labels Nov 13, 2023
@ghost
Copy link

ghost commented Nov 13, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Trying to build a project targeting wasi-wasm with latest preview results in:

C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk\8.0.0-rc.2.23479.6\Sdk\WasiApp.Native.targets(54,5): error : Could not fin
d wasi-sdk. Either set $(WASI_SDK_PATH), or use workloads to get the sdk. SDK is required for building native files.

Reproduction Steps

Build any project with <RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>, e.g. the default wasi console template while not having WASI SDK installed globally.

Expected behavior

It should provision WASI SDK automatically when installing the wasi-experimental workload. It seems there is some code for this in the repo

runtime/src/mono/mono.proj

Lines 174 to 186 in af0227f

<Target Name="ProvisionWasiSdk"
Condition="'$(ShouldProvisionWasiSdk)' == 'true' and '$(SkipMonoCrossJitConfigure)' != 'true'">
<ReadLinesFromFile File="$(MSBuildThisFileDirectory)/wasi/wasi-sdk-version.txt">
<Output TaskParameter="Lines" ItemName="_VersionLines" />
</ReadLinesFromFile>
<PropertyGroup>
<WasiLocalPath>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'wasi'))</WasiLocalPath>
<WasiSdkVersion>%(_VersionLines.Identity)</WasiSdkVersion>
<WasiSdkUrl>https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-linux.tar.gz</WasiSdkUrl>
<WasiSdkUrl Condition="'$(HostOS)' == 'osx'" >https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0-macos.tar.gz</WasiSdkUrl>
<WasiSdkUrl Condition="'$(HostOS)' == 'windows'" >https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$(WasiSdkVersion)/wasi-sdk-$(WasiSdkVersion).0.m-mingw.tar.gz</WasiSdkUrl>
</PropertyGroup>
but I guess it's not hooked up all the way?

Alternatively, at least provide a clear error message on how to retrieve one manually for now.

Actual behavior

The error message says

or use workloads to get the sdk

even though that doesn't seem to be supported.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Author: RReverser
Assignees: -
Labels:

arch-wasm, untriaged, area-Build-mono, os-wasi

Milestone: -

@radical
Copy link
Member

radical commented Nov 13, 2023

It seems there is some code for this in the repo

That code is specifically for provisioning the sdk for the runtime build.

It should provision WASI SDK automatically when installing the wasi-experimental workload.

The aim is to make it be a part of the workload itself. This work is being tracked in #82788 . cc @directhex

@radical radical changed the title [wasi] Misleading message for provisioning WASI SDK [wasi] wasi-experimental should include the wasi sdk Nov 13, 2023
@RReverser
Copy link
Author

RReverser commented Nov 13, 2023

Yeah I saw the other issue, but wanted to raise one specifically for the error message (hence the title before it was edited).

As far as I understand, the actual integration will take some time, and for the .NET 8.0 release it would be good to fix the error message itself so that it doesn't confuse other users. I believe for now it should just point users to the official repo they can install WASI SDK from.

@RReverser
Copy link
Author

Do you mind if I edit the title back so that this issue is not accidentally confused with / as a duplicate of #82788?

@radical
Copy link
Member

radical commented Nov 13, 2023

Do you mind if I edit the title back so that this issue is not accidentally confused with / as a duplicate of #82788?

Indeed the message can be improved.

@RReverser RReverser changed the title [wasi] wasi-experimental should include the wasi sdk [wasi] Improve error message for missing WASI SDK Nov 13, 2023
@radical radical changed the title [wasi] Improve error message for missing WASI SDK [wasi] Misleading message for provisioning WASI SDK Nov 13, 2023
@RReverser
Copy link
Author

Oh oops we edited at the same time 😅

@RReverser RReverser changed the title [wasi] Misleading message for provisioning WASI SDK [wasi] Improve error message for missing WASI SDK Nov 13, 2023
radical added a commit to radical/runtime that referenced this issue Nov 14, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Nov 14, 2023
@ghost ghost removed in-pr There is an active PR which will close this issue when it is merged untriaged New issue has not been triaged by the area owner labels Nov 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Build-mono os-wasi Related to WASI variant of arch-wasm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants