Closed timmydo closed 2 years ago
I'm not super enthusiastic about adding clang by default for all our users.
There are three options:
sdk
image.sdk
image.It seems like we should go with the first one until more people start asking for it. That can be handled with documentation.
Fair?
@jkotas
It seems like we should go with the first one until more people start asking for it
Yes, I agree.
It is not just clang. We have the prerequisites documented at https://docs.microsoft.com/en-us/dotnet/core/deploying/native-aot.
@jkotas I'm not sure those instructions are straightforward for installing toolchain in a windows container? I think https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022 might work also, but it would be nice to have option 3, an -aot
SDK version that works out of the box.
[Triage] - We're in agreement that adding these packages to the sdk
image is out of scope at this point. We'll listen for feedback to see if there's more demand as time goes on.
It does seem worthwhile to include some form of documentation on this repo. The question is whether it should be a scenario document or if it should be more front-and-center as a sample.
Given that Windows and Linux have different requirements for dependencies, it would be good to provide examples of both of these. Installing in a container environment differs in some ways than non-container environments and would be useful to have that specific use case documented for customers.
The Windows case is notable because it would only be possible in Windows Server Core because the VS Tools require .NET Fx which is not available in Nano Server. We do provide Windows Server Core sdk
images that would be suitable for this scenario.
it would be nice to have option 3, an -aot SDK version that works out of the box.
Sure. We're not going to do that until we see higher demand.
Visual Studio
This is what we do for a related need with .NET Framework:
I am adding sample Linux and Windows x64 NativeAOT build Dockerfiles as part of https://github.com/dotnet/samples/pull/5222
We have added a sample to this repo in the past. I'd suggest that this repo is the better place.
The guidance has been to have all samples that are linked from the docs in the samples repo. It means that you pretty much always want the sample to be in the samples repo to make it discoverable.
The samples repo has samples with Dockerfiles too. For example, https://github.com/dotnet/samples/tree/main/orleans/Voting
Why would be this repo be better for the nativeaot hello world sample than the samples repo?
I see. I didn't realize that there were other Dockerfile samples in that repo and that you were going to link from docs.
Since there are some samples that cover this in other repos, we'll just close this issue.
Describe the Bug
The new PublishAot option in .NET 7 will precompile your application offering various benefits...etc. But for it to work, the SDK needs a C/C++ compiler.
/usr/share/dotnet/sdk/7.0.100-preview.5.22307.18/Sdks/Microsoft.DotNet.ILCompiler/build/Microsoft.NETCore.Native.Unix.props(110,5): error : Platform linker ('clang') not found. Try installing clang or the appropriate package for your platform to resolve the problem.
Steps to Reproduce
Using dotnet publish -r RID --self-contained with -p:PublishAot=true fails due to SDK images not having clang installed.
cc @MichalStrehovsky @agocke