-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Support x86 for NativeAOT #86573
Comments
Anti-cheat... I assume you're asking x86 Windows specifically? |
Yes, I was thinking about Windows x86. |
I'll let @jkotas answer that. My estimate is that x86 Windows will be orders of magnitude more work than what was needed for ARM32 Linux (ARM32 Linux was already mostly there thanks to Samsung's work in the past). x86 in general is an unpleasant architecture to work with, possibly more so on Windows than Linux. A lot of legacy weird cruft was fixed with x86-64. |
x86 was done in the past for UWP. We have a lot of the x86 code there, so I would not say that fixing that code up and filling in the missing pieces would be a significant burden. I agree with @MichalStrehovsky that Windows x86 in general is an unpleasant architecture to work with and fixing it up is likely going to be much harder than fixing up ARM32. |
I immediately hit something not very pleasant. |
Another thing i remember that also needs to be enabled for x86 is exception handling which is vastly different between x86 and x64 (at least in CoreCLR). IIRC the x86 mechanism is not implemented in CoreRT but the x64 mechanism could be used on x86 but it requires building the JIT with |
It would be interesting to try to build Windows x86 on NativeAOT more like how CoreCLR's (unofficial, for Tizen only) x86 Linux support is built instead of how CoreCLR does Windows x86 support. x86 Linux is much more similar to the rest of the supported platforms than x86 Windows in terms of implementation. |
@jkoritzinsky Can you feed me with details of differences, and how I may pursue that direction? If making Linux x86 works would be faster and pave road to Win x86, I may start even with that. |
So there's a few differences I know off the top of my head. I'll include a little table below with my recommendations for what to do for CoreRT Windows x86 support (note these are my gut recommendations and might be wrong or unneeded for NativeAOT). Primarily, many of the Windows x86 differences aren't due to actual requirements, but due to the fact that the x86 models were the first designed in .NET Framework, and all the future architecture models learned from the mistakes of Windows x86.
Basically you should try just turning on the |
Thanks a lot, that clarify all your point, and make my life so much easier. At least I now understand about why bifurcation happens, and what I have option to make small decisions my self, like if I encounter some wierdness, then I may check that this is x86 weirdness, and just try to go with different path.
Will try it out, and see how it goes. |
A better option for developers maintaining old x86 projects? |
Support for x86 programs is expected |
Any estimation as to when? I am trying to build a DLL for an old Clarion project where I work, Clarion is all 32-bit (x86) and as far as I can tell I can only use x86 architecture based DLL's there - in all the guides I could find (https://medium.com/@jsmckee100/net-and-clarion-c65bc91d1718) they are using Unmanaged Exports, sadly it doesn't compile any longer so after a long winding search, from Unmanaged Exports to DLLExport etc I eventually found that .NET has native options for stuff like this these days, sadly x86 isn't available - would love to test drive it if there is a way for it now. Or if anyone can give a hint to what else to use so I can finish this off - maybe using something else to get DLL's which can be used in Clarion |
I cannot have enough time for this, so nobody working on the matter right now from what I know. I would suggest you try different route then NativeAOT for x86 |
Any suggestions @kant2002 ? |
i think you can refer to .net native x86 at uwp |
@ThaDaVos , if you're OK with loading .NET runtime libs into the target process, you could try the approach from the core hosting sample. I used it in my windbg extension template. |
I am currently using a modified version of DNNE (https://github.com/AaronRobinsonMSFT/DNNE) to get it to work, it compiles a Native library which loads the runtime and my library - still sad it's not included in NativeOAT, but it's understandable after the explanations I've found |
Initial support has landed with #99372. There are still bugs that need to be solved. I expect to setup some test infrastructure in the coming days and file issues for specific failures. |
Current list of known outstanding issues / tasks:
|
I guess that's in Dotnet 9? Or hasn't it be published yet? Would love to help by trying it out |
A public preview with the support hasn't shipped yet, but if you get the latest installer bits from https://github.com/dotnet/installer?tab=readme-ov-file#installers-and-binaries, you can try it out. In the linked page, make sure to choose "Zip" or "Installer" from the column marked "main (9.0.x Runtime)". Make sure to read the instructions about nuget.config. Without that, you'll get restore errors. |
@MichalStrehovsky
|
Is the project targeting net9.0? Also how did you end up with the ProjectReference to ILCompiler? You shouldn't need any. This should only require PublishAot=true in the project file. |
@MichalStrehovsky I updated my original comment,The code used refers to this link and link2, update |
There's something wrong with the new version, I'm using the old version so it's okay |
old version is ? I failed using 9.0.100-preview.3.24204.13 |
The latest version of dotnet, I can't run winform native aot though build successly, the build file is only 1 mb in size. |
Delete the PackageReference. It should not be needed and it will only make things worse. |
It doesn't repro with:
My steps:
The output is a 21 MB exe and works. |
Newest is dotnet 9 preview 5 |
I see the issue now, it is not x86 specific, not even native AOT specific. It is tracked at dotnet/winforms#11282. |
Any news? |
What's the error? Did you do the "Make sure to read the instructions about nuget.config. Without that, you'll get restore errors." part of my comment? |
Thank you, now it works like a charm. Is there planned a date of publishing preview-5 prerelease? |
Sometime in June based on past preview dates. I think Preview 4 will have this usable as well and that one should come out soon. |
Is this enabled in the latest previews? Would really like to test it (not a production app so it's no biggie if not): https://github.com/smoogipoo/osu-native-diffcalc/actions/runs/9474346123/job/26103751949
|
|
Thanks for bringing this up. This is actually a recent regression. We lost the following line when dotnet/installer repo got folded into dotnet/sdk repo: https://github.com/dotnet/installer/blob/main/src/redist/targets/GenerateBundledVersions.targets#L380 (I'm starting an email thread with the people involved in the repo migration to make sure they investigate if this was the only thing we lost in the migration.) Fix in dotnet/sdk#41537. It will be in Preview 6 :( |
I think we had a bad interaction between #103332 and #103273. Windows x86 with native AOT got broken in Preview 5 (#86573 (comment)).
I think we had a bad interaction between #103332 and #103273. Windows x86 with native AOT got broken in Preview 5 (#86573 (comment)).
This is done. |
I know that x86 is legacy right now, but come across person who what to write anti-cheat for x86 game using NativeAOT.
I know that's fringe case, and I prefer to have better case asking for support me on this journey.
So my question would be following: If I put some efforts into this, would this be a burden for core team?
The text was updated successfully, but these errors were encountered: