-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
gcc fails to arch-cross-compile on GNU/Linux in NativeAOT .NET 7 #78559
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsDescriptionGetting an error
When trying to compile my app for ARM64 while being on x86 64bit laptop Reproduction Steps
Expected behaviorCompiles Actual behaviorDoesn't compile:
Regression?No response Known WorkaroundsNo response Configuration
Other informationNo response
|
We haven't tested cross-compilation with gcc, so this is unsupported. We can add support for it. However, there are few things to consider:
You can install clang (or use a docker image) for the cross-compilation in the meantime. |
Cross-compilation instructions are at https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/compiling.md#cross-architecture-compilation . Cross-compilation on Linux requires rootfs and target architecture native toolchain to be present. |
Yup, those instructions apply only to clang, because this argument is not supported on gcc: runtime/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets Line 91 in 0eabf7f
|
I see. |
macOS is not supported in .NET 7. It is only available in the daily builds of .NET 8. We can update the document. Basically only cross-architecture is supported on OSX (not linux to osx). For example on M1 machine (osx-arm64), we can use: $ dotnet8 publish -p:PublishAot=true --arch x64 to cross-compile x64 binary. |
Without cross-compilation it works though 🤔 |
Yes, for osx-x64 but osx-arm64 is only supported in .NET 8. |
Got it. Any reason why btw? It requires additional work or something else? |
Also, is arch-cross-compilation only available in .NET 8? |
osx-arm64 support was implemented in #75264 (merged three days before the 7.0 RC1 release), and number of fixes went in main branch after that. Normally new platform support PRs are not backported, when there was no time spent on testing during the development cycle.
Yes, because for OSX we only support cross-architecture compilation (and not cross-OS compilation), so it was not necessary when only one architecture was supported. |
I mean, what about other OS? Is there arch-cross-compilation for linux on .NET 7? |
Yes. On linux, cross-compilation is supported with clang only. Normal compilation is supported with both clang and gcc. |
Thanks, is there any specific instruction or should work out of the box? (trying to get through an issue issue right now with it) |
Instructions are here https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/docs/compiling.md#cross-architecture-compilation. They do require a "sysroot" that contains the arm64 toolchain, esp. glibc. I did have some success getting this to work on Ubuntu by pulling in arm64 packages, but I haven't written anything up yet. |
Closing as answered |
Description
Getting an error
When trying to compile my app for ARM64 while being on x86 64bit laptop
Reproduction Steps
dotnet new console -n frog && cd frog
dotnet publish -p:PublishAot=true -p:SelfContained=true -r linux-arm64
Expected behavior
Compiles
Actual behavior
Doesn't compile:
Regression?
No response
Known Workarounds
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: