-
Notifications
You must be signed in to change notification settings - Fork 199
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
[NativeAOT LLVM] Using together with .NET 8 SDK #2235
Comments
Thank you for looking into this! I'll share my thinking on the problem space. At a high level, this can be approached from 2 angles:
I have a feeling One way to look at this is that it is categorically not possible to avoid some kind of project file manipulation beyond the package references (either shimming of There is also dotnet/sdk#28495 which would help us a lot if finished. |
I think PublishAot==false + old package based scheme would work best for as-long-as the project lives in runtimelab. |
@kant2002 you might want to try this again with the latest packages. |
Don't worry, I keep close eye on this :) |
.NET 7.0.200 working
|
Thanks, yes agree, does removing the line |
That does not working. For .NET 8 (because it rely on Now I have to use
But that combination does not work with .NET 7 SDK |
Okay. I seems to have working workaround.
|
This simplifies so much compared to the previous template 😍 |
I should be able to use |
You can simply pass /p:PublishTrimmed=true as well to fix this. |
So this worked for me when you published it but seems it got broken over the last week or so:
I guess I need to find a pinned version to revert to, as adding said package reference does not help (it doesn't resolve). |
Looks like 8.0.0-alpha.1.23208.2 is the last one that works w/o modifications, going to pin to that. |
@RReverser You can set IlcHostPackagePath in property manually to workaround this issue, e.g. |
Yeah I don't want to hardcode paths in a shared repo like that, I'm okay with pinned version for now. |
To avoid hardcoding a path I worked around it like this: <Target Name="FixIlcHostPackageName" BeforeTargets="ImportRuntimeIlcPackageTarget">
<PropertyGroup>
<IlcHostPackageName>runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM</IlcHostPackageName>
</PropertyGroup>
</Target> |
With the latest packages this should be fixed. Add
to your |
with net8 preview 5, you dont need it |
Seeing some new build issue on
Although it's been couple of months since I touched NativeAOT, maybe this is not new and just me not having something configured locally? |
Looks a lot like the problem that was fixed in #2334. |
Hm that PR seems reasonably old so the fix should be shipped in the latest version that I'm using? |
The error itself in the PR description looks different too. |
Agree it actually looks different. It is also odd that it'd depend on the configuration. Could you share a binlog? |
Actually nevermind, I think I changed something unrelated - it does fail on Debug too. |
One thing that I should have noted sooner - we never had a Unix build of the host compiler working, and this looks suspiciously like a Unix system. |
Oh. Yes, it is.
Weird, I thought I did build NativeAOT Wasm experiments successfully on Unix in the past?.. Unless I always did it outside WSL, but that would be weird as I still have some projects in WSL configured for NativeAOT... |
What I believe was "working" in the past is host build of the compiler targeting not-WASM (i. e. basically the same compiler that's in the mainline |
Hm does |
The build output makes it seem that the native runtime pieces are not built at all, which would explain the missing If I were debugging this, I would diff |
FWIW if you're referring to |
Sorry, missed it was the |
The missing include is in Also now that I looked upstream, I see it has the same line I had to add: https://github.com/dotnet/runtime/blob/ce3b14da2fcc4c97ebdfbbd26d47a9e441db5297/src/coreclr/nativeaot/Runtime/unix/UnixContext.h#L7
Ah cool. So to double-check, now I've cleaned the artifacts and just doing [...later...] Ok yeah now it fails with a lot of C errors instead. I guess it picked up some artifacts from non-Wasm build before? The docs were a bit unclear on the order of Wasm and non-Wasm builds. Anyway, at least this is not build config issue anymore - thanks - so will look into those C errors now. |
Nominally, it should not matter and the two builds should be completely independent (we are building artifacts for two very different platforms, after all). Theory != practice, of course. |
I'm not sure that it is picking up artifacts from the other build, as @SingleAccretion says, should be independent and in my experience they are. I just suspect (and never investigated to be fair), that something is not quite right with the dependencies and it skips the step that includes the generation of this file because some other artifact that did work is present. |
Out of curiosity I just tried again and I'm getting same error if I try to build If I'm only doing |
or maybe not "never"... 😅 |
Is there a reason why you have |
Sorry, this time it was my turn, I copied the wrong thing into the issue. Indeed, I'm not building |
...and now I'm consistently getting the I love build systems. |
I'll try this next. |
Ok at least |
Looking at wasmjit config: runtimelab/src/coreclr/jit/CMakeLists.txt Lines 719 to 720 in 9ca9fc8
Do I understand right from those lines that it's only built for the browser and not WASI? That probably doesn't make sense unless |
So, the |
Ah ok thanks. I'll try to get |
Right now I'm mostly struggling with all the missing headers in PAL. I admit I don't really understand this system or why it (in pal/inc/rt/cpp) duplicates STL headers but with dummy contents in some places and custom replacements in others. There also seems to be some |
And even if I add those dummy headers, then I'm getting errors like |
Neither do I, truth be told. I know there have been (a number of) conversations in the past about all these problems and what the ways to solve them are, but I do not recall where. @jkotas would you have advice on the direction here? |
#1797 is the old issue. feature/NativeAOT-LLVM...yowl:llvm-linux#diff-af66f6b851332d1e155eef9bf358246005bd77648b156261a74ef36ee90ea1e9R237 are a couple of the changes I made around STL. All a bit old now. |
@yowl Oh wow, the size of that changeset. I guess I was optimistic 😅 I have the shell script changes already which look similar and enabled me to build runtime packages; I don't have the |
CoreCLR PAL for non-Windows platforms emulates Windows SDK behaviors that are incompatible with standard headers on Linux. It means that a single .cpp file cannot include both PAL headers and Linux standard headers at the same time. @AaronRobinsonMSFT and others have been working towards cleaning this up and removing this limitation. |
I think I saw that mentioned about emulating Windows SDK and that makes sense for platform-specific APIs, but why would C++ STL itself be so different that it needs to replace/emulate those headers as well? Is this down to differences between MSVC and GCC/Clang headers? |
Yes. Also, CoreCLR PAL does not emulate everything. It only emulates parts needed by CoreCLR. C++ STL depends on much more. |
Right, and that mismatch seems to be what leads to complications. When you say it's being worked on you mean the code will be compatible with any STL or that more things will be emulated over time? |
The goal is to remove all PAL constructors that conflict with standard headers, so that it is possible to use both the PAL and standard headers at the same time. |
I got only couple more compilation errors fixed but I think I'm going to give up for now :( The interaction between PAL and STL in the build system is beyond my comprehension at the moment, too many weird errors. |
Yes, this is something that needs to be cleaned up upstream first. It does not make sense to do this in this repo/branch. |
Troubleshooting of recent issue uncover fact that .NET 8 SDK is not supported.
So my current proposal is advocate following way of consuming NativeAOT-LLVM
Now a bit about how that's working.
Detection of supported ILC package happens here by matching TFM with KnownILCompilerPack
https://github.com/dotnet/sdk/blob/d8b549b85299046654ba8e9bd0caff0eed507ae6/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs#L613-L618
and then added as implicit package references here
https://github.com/dotnet/sdk/blob/d8b549b85299046654ba8e9bd0caff0eed507ae6/src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs#L690-L697
I initially thought that first place can be extended to perform ILC package selection based on the TFM + RID, but second place insert additioal reference on ILCompiler which causing issues.
So this led me to following solution where I remove existing KnownILCompilerPack and create new one in suited for NativeAOT-LLVM.
If dotnet/sdk#31398 lands then removal of existing ILCompiler does not needed.
I did not dig deeper why we cannot use NativeAOT-LLVM without PublishAot, maybe that would be more viable solution with less divergence from main.
The text was updated successfully, but these errors were encountered: