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

Support for ARM32 in NativeAOT #833

Closed
bjornen77 opened this issue Mar 18, 2021 · 20 comments
Closed

Support for ARM32 in NativeAOT #833

bjornen77 opened this issue Mar 18, 2021 · 20 comments
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation help wanted Extra attention is needed

Comments

@bjornen77
Copy link

Is there any plans to support ARM32? Basically so that you from a PC running Linux(amd64) could do:
dotnet publish -r linux-arm -c release

Or could you already today compile applications for ARM32 using NativeAOT?

@jkotas
Copy link
Member

jkotas commented Mar 18, 2021

The core team working on the NativeAOT experiment in this repo does not have plans for it, but we are happy to accept contributions to make it work.

@jkotas jkotas added area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation help wanted Extra attention is needed labels Mar 18, 2021
@josephmoresena
Copy link

I recall CoreRT had support on ARM but I never used it. I was actually looking for that cause I want to experiment with JNI libs but using Native NOT.

@jkotas
Copy link
Member

jkotas commented Mar 23, 2021

Yes, we have received some contributions for ARM support in the past but it did not get pushed far enough to get official builds enabled, etc.

@michaldobrodenka
Copy link

Would be great if at least this could be the way for NET to support ARMv6. Compile to llvm -> ARMv6 or ARMv7 native.

@trampster
Copy link

Arm is potentially a better use case for NativeAOT than x86. Arm devices tend to be used in resource constrained environments like IOT devices, raspberry pi's, etc. And can benefit more from the advantages of NativeAOT.

The team I work on has an embedded linux device using OpenEmbedded as the operating system on an arm32 chip. We had to reject .NET as an option because we simply do not have the space for it, and we need fast startup time.

NativeAOT seems like the perfect solution but we can't use it because it doesn't support arm32.

@kant2002
Copy link
Contributor

kant2002 commented Jul 3, 2021

Right now building of NativeAOT on Raspberry 3 (I assume that this is ARM32) fails with following error

  CMake Error at nativeaot/Runtime/Full/CMakeLists.txt:25 (add_library):
    Cannot find source file:

      /home/pi/runtimelab/src/coreclr/nativeaot/Runtime/arm/GcProbe.S

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
    .hpp .hxx .in .txx


  CMake Error at nativeaot/Runtime/Full/CMakeLists.txt:25 (add_library):
    No SOURCES given to target: Runtime.ServerGC


  CMake Error at nativeaot/Runtime/Full/CMakeLists.txt:23 (add_library):
    No SOURCES given to target: Runtime


  CMake Generate step failed.  Build files cannot be regenerated correctly.
  ~/runtimelab/src/coreclr

kant2002 added a commit to kant2002/runtimelab that referenced this issue Jul 3, 2021
This is what I do to make it compile on Raspbian on my Raspberry Pi 3B+
- GcProbe.S is just copy from ARM64
- __cdecl is not defined on ARM, so I suppress that
- I resurrect RareFlags from CoreRT in hopes that this is make it works, but no luck
I try to resurrect dotnet/corert@d9847af in changes to regdisp.h but seems to be I do wrong thing here, and I should resurrect definitions from there.

I would like to understand is RareFlags are still valid way, and if not what's the proper way.

See dotnet#833
@ChrML
Copy link

ChrML commented Sep 4, 2021

Anyone got an overview of what's left to get NativeAOT running on ARM32?

@kant2002
Copy link
Contributor

kant2002 commented Sep 5, 2021

Depending on you ability to take risks.

NativeAOT in basic form runs on ARM32 now. I mean Hello World running. Downside is that you need build it yourself. That's not compilcated just time consuming.

If you want do not think too much about building NativeAOT, then following items left:

@jkotas
Copy link
Member

jkotas commented Sep 5, 2021

Add ARM to CI build. Need general approval from @jkotas

I would be fine with adding Linux ARM to the CI build.

@pver
Copy link

pver commented Jan 24, 2022

#1509 seems to be (partially) undone by 562aea2 ?

@kant2002
Copy link
Contributor

@pver you can still build ARM32 packages. Support is still somewhat limited and do not tested enough. Can you tell more about your case? Curious why do you need ARM32

@pver
Copy link

pver commented Jan 24, 2022

@kant2002 currently have a .net application with mono on an armv7l platform, but running on some memory/performance issues/constraints. So I was test driving NativeAOT to see if that could improve things in the future :)
Tried running with the arm docker image and publish for linux-arm, but kept running against
/root/.nuget/packages/microsoft.dotnet.ilcompiler/7.0.0-alpha.1.21455.2/build/Microsoft.NETCore.Native.Publish.targets(71,5): error : Add a PackageReference for 'runtime.linux-x64.Microsoft.DotNet.ILCompiler' to allow cross-compilation for arm [/test/HelloCoreRTWorld.csproj] Done executing task "Error" -- FAILED
even though targetting linux-arm and including runtime.linux-arm.Microsoft.DotNet.ILCompiler (latest available for that package is 7.0.0-alpha.1.21455.2)

But I'll do some further tests with it, building the packages myself as you suggested and see how far I can get with those

@michaldobrodenka
Copy link

michaldobrodenka commented Jan 24, 2022

@kant2002 I'm also using dotnet mainly on ARM devices, for IoT. Currently publishing using self-contained, since I don't have much space left on the device for full framework. If NativeAOT would give me smaller package or or faster startup time, it would be great. X86/64 devices have most of the times more storage, RAM or CPU power so there it's not so important I think.

@kant2002
Copy link
Contributor

Tried running with the arm docker image and publish for linux-arm

@pver are you run docker on ARM hardware? It seems to be you are running Docker image on Linux x64, and as such you may have to follow instructions for cross-compilation. https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/compiling.md#cross-architecture-compilation

@pver and @michaldobrodenka if you discover any specific issues, would be good to post it in this repo, so they can be tracked. My experience with this repo, is that all issues taken seriously, it maybe just take a bit of time to solve all of them.

@pver
Copy link

pver commented Jan 24, 2022

@kant2002 thanks for the hint! I'm indeed running Docker from a Linux x64. I tried to build with the mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-cross-20200413125008-09ec757 (and the newer ubuntu-16.04-cross-20210719121212-8a8d3be) docker image for arm32, but maybe that's not enough to fully cross compile. I'll try with the manual steps to see if that runs better and create a new ticket if I keep running into issues.

@TheGuy920
Copy link

Has this still not been resolved? It's been nearly 2 years 😢
Unable to find package runtime.linux-arm.Microsoft.DotNet.ILCompiler. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages, nuget.org * *.csproj 1

@pver
Copy link

pver commented Apr 14, 2023

Very strange indeed, it seems to be supported based on this:
https://github.com/dotnet/runtime/blob/main/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props

But it's just not published? (only published for x64 platform packages at the moment). Or is this approach already in the spirit of dotnet/runtime#71042 ?

@kant2002
Copy link
Contributor

As probably the last person who touch code for ARM32 I can say following.
ARM32 is community maintained. I was the community, and I lost interest in this. During the time when I work, I receive full support from core .NET contributors. I suppose that if somebody else would improve ARM32 in dotnet/runtime nobody would object too much. So far, there interest in consuming .NET on Arm32, but not contibute back. Technically ARM32 was somewhat working, but after two years I expect it bitrot. If somebody serious about Arm32 I think it should build dotnet/runtime locally, and try to compile application using NativeAOT using locally build bits.

Instructions to get started with NativeAOT contribution can be found here https://github.com/dotnet/runtime/blob/main/docs/workflow/building/coreclr/nativeaot.md

@jkotas
Copy link
Member

jkotas commented Apr 14, 2023

it seems to be supported based on this:
https://github.com/dotnet/runtime/blob/main/src/installer/pkg/projects/Microsoft.DotNet.ILCompiler/ILCompilerRIDs.props

This comment is misleading. I am going to delete it. This is list of RIDs that Microsoft.DotNet.ILCompiler may be pontetially built for, but it does not imply any kind of support.

@kant2002 summary is accurate. We will be happy to accept contributions for native AOT Arm32 port.

@filipnavara
Copy link
Member

Let's close this in favor of dotnet/runtime#97729.

@jkotas jkotas closed this as completed Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr .NET runtime optimized for ahead of time compilation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

10 participants