-
Notifications
You must be signed in to change notification settings - Fork 446
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
[release/6.0.1xx] Arm support #13378
Conversation
In addition, there's the following patch for runtime: From 91988b0241a77f1f6524c19e2ce55dda06de7242 Mon Sep 17 00:00:00 2001
Patch-Source: https://src.fedoraproject.org/rpms/dotnet6.0/blob/rawhide/f/runtime-arm64-lld-fix.patch
From: Omair Majid <omajid@redhat.com>
Date: Wed, 16 Feb 2022 18:08:22 +0000
Subject: [PATCH 1/1] arm64 lld fix
---
eng/native/init-compiler.sh | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/eng/native/init-compiler.sh b/eng/native/init-compiler.sh
index 567d18da474..05245c7b9f8 100755
--- a/eng/native/init-compiler.sh
+++ b/eng/native/init-compiler.sh
@@ -108,11 +108,8 @@ if [[ -z "$CC" ]]; then
fi
if [[ "$compiler" == "clang" ]]; then
- if command -v "lld$desired_version" > /dev/null; then
- # Only lld version >= 9 can be considered stable
- if [[ "$majorVersion" -ge 9 ]]; then
- LDFLAGS="-fuse-ld=lld"
- fi
+ if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
+ LDFLAGS="-fuse-ld=lld"
fi
fi
--
2.34.1 @omajid Could you share why this is needed / why it hasn't been upstreamed to upstream? |
This change does a couple of things:
|
@@ -117,7 +117,7 @@ | |||
</Target> | |||
|
|||
<Target Name="GenerateRootFs" Condition="'$(OS)' != 'Windows_NT'"> | |||
<Exec Condition="$(Platform.Contains('arm')) AND '$(Platform)' != 'armel' AND '$(BuildArchitecture)' != 'arm64'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/build-rootfs.sh" /> | |||
<Exec Condition="$(Platform.Contains('arm')) AND '$(Platform)' != 'armel' AND '$(BuildArchitecture)' != 'arm64' AND '$(BuildArchitecture)' != 'arm'" Command="$(ArmEnvironmentVariables) $(ProjectDir)cross/build-rootfs.sh" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really ought to have some other way of setting up cross compilation rather than inferring it based on architecture :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! Also, now that Plaform.Contains('arm') excludes armel
, arm64
and arm
, I'm wondering what other possible value of Platform would contain arm
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried exploring this suggestion - but as I don't know enough about cross compilation, I'm not comfortable proposing a solution. Would you think it better to open an issue to keep track of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's totally unsuitable for fixing as part of this PR. Filed https://github.com/dotnet/installer/issues/13441
@@ -9,7 +9,7 @@ | |||
|
|||
<PropertyGroup> | |||
<BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture> | |||
<Architecture Condition="'$(Architecture)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Architecture> | |||
<Architecture Condition="'$(Architecture)' == '' AND ( '$(BuildArchitecture)' == 'arm64' OR '$(BuildArchitecture)' == 'arm') ">$(BuildArchitecture)</Architecture> | |||
<Architecture Condition="'$(Architecture)' == '' AND '$(BuildArchitecture)' == 's390x'">$(BuildArchitecture)</Architecture> | |||
<Architecture Condition="'$(Architecture)' == ''">x64</Architecture> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This suggestion is out of scope for this PR)
We use this idiom in a few repos and I think we got it from runtime? IIRC, this was done so we could still be able to use Visual Studio (an x86) application and have it correctly target x64
. But that little bit of default behaviour means every other architecture needs to be hard-coded here separately. Perhaps we should consider handling Visual Studio and/or Windows here specifically and let everything else default to $(BuildArchitecture)
?
Theoretically, through mono, we also support sparc, ppc and mips.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does one detect visual studio use? I'm playing with $([MSBuild]::IsOSPlatform('WINDOWS')) for that specific case, but idk if that covers every case where Visual Studio / Windows is used.
Looks like current # Only lld version >= 9 can be considered stable
if [[ "$compiler" == "clang" && "$majorVersion" -ge 9 ]]; then
if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
LDFLAGS="-fuse-ld=lld"
fi
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor fixes. I'll re-run the build so I can get a look at the Windows ARM error as well.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Failing early in the build:
I think |
@ayakael - Is this something you are still able to contribute to? |
Thanks for the bump, the PR fell through the cracks. Pushed the suggested changes. :) |
Any idea what could cause this? |
514cb77
to
5ed1f59
Compare
Check passes in pull request for main here #14470 |
5ed1f59
to
f3c15d9
Compare
f3c15d9
to
f3f144d
Compare
@crummel Now that this is merged in |
@omajid - Can you take another look and signoff if you approve? TIA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for getting this working!
@MichaelSimons Who can I ping to merge this as to get it in 6.0.115? |
Merged |
Expected behavior
As prebuilt SDKs are provided for arm by Microsoft, source-build should support ARM build.
Actual behavior
Per dotnet/source-build#2781, source-build does not support arm.
Proposed modifications
This pull request modifies existing
Platform
andArchitecture
logics to parse arch information correctly whenBuildArchitecture=arm
Varia
Parallel merge request on Alpine's side
Virtualized 32-bit support: dotnet/runtime#66438
Made as part of Alpine Linux dotnet6 packaging project, see dotnet/source-build#2782