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

Remove the Windows specific dep in SDK #54

Closed
wants to merge 4 commits into from

Conversation

jsturtevant
Copy link
Contributor

@jsturtevant jsturtevant commented Oct 28, 2024

The reference to <Import Project="build\BytecodeAlliance.Componentize.DotNet.Wasm.SDK.props" />

was causing the SDK to pull the Windows specific dep in at packaging time:

 dotnet list .\src\WasmComponent.Sdk\WasmComponent.Sdk.csproj package --include-transitive
Project 'WasmComponent.Sdk' has the following package references
   [net8.0]:
   Top-level Package                                          Requested                Resolved
   > Microsoft.DotNet.ILCompiler.LLVM                         10.0.0-alpha.1.24525.6   10.0.0-alpha.1.24525.6
   > Microsoft.NET.ILLink.Tasks                         (A)   [8.0.10, )               8.0.10
   > runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM         10.0.0-alpha.1.24525.6   10.0.0-alpha.1.24525.6

(A) : Auto-referenced package.

This was overriding the package reference where the runtime specific dep was being pulled in which was fixed in #50

        <PackageReference Include="runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM" PrivateAssets="None" />

Update: After doing some digging I found that you can't move PackageReference to the MsBuild Props: https://learn.microsoft.com/en-us/nuget/concepts/msbuild-props-and-targets#guidance-for-the-content-of-msbuild-props-and-targets

Some examples of items that must not be added or updated: PackageReference, PackageVersion, PackageDownload, etc.

Since we don't reference the IL package anymore this forces removing the DependsOnTargets="LinkNativeLlvm" (which wasn't being used anyways and we don't have access to NativeOutputPath property anymore in the tests

Update: This is probably a good change anyways, as it is more precises

jsturtevant and others added 2 commits October 28, 2024 11:48
Signed-off-by: James Sturtevant <[email protected]>
@jsturtevant jsturtevant force-pushed the fix-win-dep branch 2 times, most recently from deab4c7 to 37e1b96 Compare October 29, 2024 17:46
@SeanOMik
Copy link

SeanOMik commented Nov 6, 2024

I tried using this to build on Arch Linux, but I get an error:

$ dotnet build
Restore complete (0.2s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  WitBindgen failed with 1 error(s) (68.7s)
    /home/seanomik/Downloads/componentize-dotnet/src/WitBindgen/WitBindgen.csproj(73,9): error MSB3073: The command "tar -xf "temp/win-x64.zip" -C win-x64 --strip-components=1" exited with code 2.

I was able to get past it by manually extracing that .zip (WitBindgen/tools/temp/win-x64.zip) to WitBindgen/tools/win-x64. I got a similar error when WasmComponent.Sdk was compiling, so I had to do the same thing. I tried to recompile, but got another error:

$ dotnet build
Restore complete (0.3s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  WitBindgen succeeded (0.0s) → /home/seanomik/Downloads/componentize-dotnet/src/WitBindgen/bin/Debug/net8.0/WitBindgen.dll
  WasmComponent.Sdk succeeded (0.1s) → /home/seanomik/Downloads/componentize-dotnet/src/WasmComponent.Sdk/bin/Debug/net8.0/WasmComponent.Sdk.dll
  Adder failed with 1 error(s) (0.2s) → bin/Debug/net8.0/wasi-wasm/Adder.dll
    /home/seanomik/.nuget/packages/microsoft.dotnet.ilcompiler.llvm/9.0.0-preview.5.24304.1/build/Microsoft.NETCore.Native.targets(354,5): error MSB3073: The command ""\tools\\ilc" @"obj/Debug/net8.0/wasi-wasm/native/Adder.ilc.rsp"" exited with code 127.

I tried changing the dotnet target version, from net8.0 to net9.0, but got this error:

$ dotnet build
Restore complete (0.3s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  WitBindgen succeeded (0.0s) → /home/seanomik/Downloads/componentize-dotnet/src/WitBindgen/bin/Debug/net8.0/WitBindgen.dll
  WasmComponent.Sdk succeeded (0.1s) → /home/seanomik/Downloads/componentize-dotnet/src/WasmComponent.Sdk/bin/Debug/net8.0/WasmComponent.Sdk.dll
  Adder failed with 1 error(s) (0.2s) → bin/Debug/net9.0/wasi-wasm/Adder.dll
    /home/seanomik/.nuget/packages/microsoft.net.illink.tasks/9.0.0-rc.2.24473.5/build/Microsoft.NET.ILLink.targets(207,5): error NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app.

This looks like the same error that the Ubuntu CI is running into, I'm not sure if its any farther ahead in building then the error with ilc.

@jsturtevant
Copy link
Contributor Author

jsturtevant commented Nov 25, 2024

@SeanOMik sorry this PR wasn't quite ready. the work around was #55

@jsturtevant
Copy link
Contributor Author

After trying a few different approach's it does not seem like this is possible. See #55 (comment).

I found a few other issues that call this out: host vs published rid and NuGet/Home#1660

I also tried how Aspire dynamically adds the reference: https://github.com/dotnet/aspire/blob/c9326c75b42b28e3f3a4174f9b24bad9f22305e9/src/Aspire.AppHost.Sdk/SDK/Sdk.in.targets#L56 but it ends up that gets filtered out later because of the RID.

I am going to close this and go a different direction.

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.

2 participants