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

Improve experience when using PublishAot with unsupported RID #73678

Closed
Tracked by #79570
MichalStrehovsky opened this issue Aug 10, 2022 · 21 comments
Closed
Tracked by #79570

Improve experience when using PublishAot with unsupported RID #73678

MichalStrehovsky opened this issue Aug 10, 2022 · 21 comments

Comments

@MichalStrehovsky
Copy link
Member

#61231 (comment)

E.g. win-x86, win-arm, linux-arm, osx-x64, all work with .NET, but we current don't support them in NativeAOT. We should make it more obvious that that's the problem.

Also, we should add linux-musl-arm64 to the list of supported RIDs.

Cc @LakshanF

@MichalStrehovsky MichalStrehovsky modified the milestones: 7.0.0, 8.0.0 Aug 10, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 12, 2022
@MichalStrehovsky MichalStrehovsky moved this to High Priority in AppModel Aug 12, 2022
@MichalStrehovsky MichalStrehovsky removed the untriaged New issue has not been triaged by the area owner label Aug 12, 2022
@kamyker
Copy link

kamyker commented Sep 16, 2022

Using net7.0-rc1 I'm unable to build for unsupported RIDs. With PublishAot=true (and with or without package reference) it says runtime is missing. With no PublishAot and package reference it doesn't compile native code at all. I've heard it works in .net 8 but that's not available using Azure Pipelines that only support main releases https://github.com/dotnet/core/blob/main/release-notes/releases-index.json

@jkotas
Copy link
Member

jkotas commented Sep 16, 2022

Using net7.0-rc1 I'm unable to build for unsupported RIDs

This should be fixed in rc2 by dotnet/installer#14464

@kamyker
Copy link

kamyker commented Sep 16, 2022

Using net7.0-rc1 I'm unable to build for unsupported RIDs

This should be fixed in rc2 by dotnet/installer#14464

Ok thanks, would be nice to add all RIDs in docs https://docs.microsoft.com/en-us/dotnet/core/deploying/native-aot/ and https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/compiling.md.

Supported/unsupported wording is a bit confusing, I'd call RIDs that can be compiled but aren't supported 'experimental'.

@kamyker
Copy link

kamyker commented Oct 19, 2022

Using net7.0-rc1 I'm unable to build for unsupported RIDs

This should be fixed in rc2 by dotnet/installer#14464

In rc2 osx-64x started working but osx-arm64 doesn't. Is it not possible to build in net7? @jkotas

I've tried to reference dotnet8 nuget package but that seems impossible as PublishAot always removes it:
<PackageReference Include="Microsoft.DotNet.ILCompiler; runtime.osx-arm64.Microsoft.DotNet.ILCompiler" Version="8.0.0-alpha.1.22461.3" />

Gets removed during compilation (and replaced with rc2 ilcompiler):
/Users/runner/.nuget/packages/microsoft.dotnet.ilcompiler/8.0.0-alpha.1.22461.3/build/Microsoft.DotNet.ILCompiler.SingleEntry.targets(49,5): warning : Delete explicit 'Microsoft.DotNet.ILCompiler' package reference in your project file. Explicit 'Microsoft.DotNet.ILCompiler' package reference can run into version errors.

Without PublishAot it doesn't compile native code.

If that's not a bug - is it possible to use alpha net8 in Azure pipelines?

@jkotas
Copy link
Member

jkotas commented Oct 20, 2022

I've tried to reference dotnet8 nuget package but that seems impossible as PublishAot always removes it:

@agocke @LakshanF Is this going to be fixed by dotnet/sdk#28495 ?

@agocke
Copy link
Member

agocke commented Oct 20, 2022

There are a couple questions here, let me pull some of them apart.

  1. How can I publish for AOT on OSX in .NET 7?
  2. How can I use the latest AOT bits?
  3. What about the NuGet packages?

For (1) the answer is: no, you cannot publish using NativeAOT in .NET 7. That's not a supported scenario.

But, as referenced in (2), we will support OSX in .NET 8. To use .NET 8, you'll need to download a .NET 8 SDK. At the moment, we have not publicly shipped a .NET 8 preview. When we do, that will be the recommended path. If you want to live on the bleeding edge, you can download nightlies from https://github.com/dotnet/installer#table.

For (3), how do the Microsoft.NET.ILCompiler packages relate? The intent is that they should provide a similar experience to the SDK, but give you more fine-grained version control, in case there's a specific bug. The packages aren't meant to be a supported experience and aren't meant to substitute for the SDK. In particular, using packages mismatched with the target framework they were built for would not be supported. So, using .NET 8 packages with the .NET 7 SDK to target net7.0 would not be supported.

At the moment it appears that the packages have some strange behavior when interacting with the SDK. I'm not sure of all the issues there, but we'll have to work through them.

Lastly, the change in dotnet/sdk#28495 is intended to improve the experience when building and not actually publishing with AOT. It wouldn't help with using AOT on unsupported platforms.

@kamyker
Copy link

kamyker commented Oct 20, 2022

(1) the answer is: no, you cannot publish using NativeAOT in .NET 7. That's not a supported scenario.

As I said I can publish osx-64x but not osx-arm64. This comment also says something else: #75264 (comment)

It missed the 7.0 deadline by a lot. However, it is possible to consume the ILCompiler package from NuGet so I think the realistic goal is to make it possible to use that with .NET 7 SDK.

Anyway I've tried dotnet8 sdk and got error:

The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative

Command:

dotnet publish -output $(Build.ArtifactStagingDirectory)/arm --configuration $(buildConfiguration) -r osx-arm64 /p:NativeLib=Shared /p:SelfContained=true

Using Azure Pipelines Microsoft hosted agent, the newest mac12 that's x64. Is it possible to cross-compile arm64 (x64 works fine)?

@kamyker
Copy link

kamyker commented Oct 20, 2022

Oh wow, removed

<PackageReference Include="Microsoft.DotNet.ILCompiler; runtime.osx-x64.Microsoft.DotNet.ILCompiler" Version="8.0.0-alpha.1.22461.3" />

Error is gone and building arm64 works fine with NET 8.

https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/compiling.md should be updated.

@AhmedZero
Copy link

Any news about win-x86?

@jkotas
Copy link
Member

jkotas commented Jan 1, 2023

Any news about win-x86?

We would accept community contributions towards enabling it, but we don't have current x86 plans for NativeAOT. #86573 has more discussion about it.

@kamyker

This comment was marked as off-topic.

@lemonmojo

This comment was marked as off-topic.

@kant2002

This comment was marked as off-topic.

@lemonmojo

This comment was marked as off-topic.

@kant2002

This comment was marked as off-topic.

@lemonmojo

This comment was marked as off-topic.

@lemonmojo

This comment was marked as off-topic.

@jkotas

This comment was marked as off-topic.

@kant2002
Copy link
Contributor

Can we also add browser-wasm to

ILCompilerRuntimeIdentifiers="linux-musl-x64;linux-x64;win-x64;linux-arm;linux-arm64;linux-musl-arm;linux-musl-arm64;osx-arm64;osx-x64;win-arm;win-arm64;win-x86"
?
That would make consuming NativeAOT-LLVM package slightly more natural. For context: dotnet/runtimelab#2203

@sbomer
Copy link
Member

sbomer commented Jun 9, 2023

Can we close this now? With the fix from dotnet/sdk#32943, any unsupported RIDs (those not listed in https://github.com/dotnet/installer/blob/c10115c483a4f61f021fc4cde7b66e4919f9785e/src/redist/targets/GenerateBundledVersions.targets#L295-L301) produce errors like the following:

error NETSDK1203: Ahead-of-time compilation is not supported for the target runtime identif
ier 'win-x86'.

linux-musl-arm64 was also added to the supported RIDs in dotnet/installer@5acae40.

@MichalStrehovsky
Copy link
Member Author

Yes, I think we can close.

@ghost ghost locked as resolved and limited conversation to collaborators Jul 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests

8 participants