From 76bc70e54481e95ac0481bb7af82ae4a44034d95 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Mon, 19 Aug 2019 15:51:36 -0400 Subject: [PATCH] Enable hosted builds on arm64 With this commit, I can build core-sdk on RHEL 8 on arm64 directly, without cross compilation. Bump the sourcelink version to pick up the ability to parse git info without depending on libgit2sharp. This allows sourcelink to work on arm64. The version is the same as the one recently added to core-setup: https://github.com/dotnet/core-setup/pull/7696 Introduce a new 'HostArch' msbuild property that contains the host architecture (arm64, x64, etc). This is the architecture of the currently running machine, and may be different from the architecture we are targetting in the case of cross compilation. There's a gotcha with HostArch: under Visual Studio (an x86) process, we generally want a x64 architecture. Use HostArch to determine whether _crossDir and LibCLRJitRid need to be special-cased for arm64 or or not. --- Directory.Build.props | 6 ++++++ eng/Versions.props | 2 +- src/redist/targets/Crossgen.targets | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index b65a724102f5..b708ec7233bc 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,6 +7,12 @@ MIT + + $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant()) + x64 + $(HostArch) + + True embedded diff --git a/eng/Versions.props b/eng/Versions.props index 344a325bf7ba..37e478e72da5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -87,7 +87,7 @@ $(BuildTasksFeedToolVersion) 2.0.0 15.8.0 - 1.0.0-beta2-18618-05 + 1.0.0-beta2-19367-01 diff --git a/src/redist/targets/Crossgen.targets b/src/redist/targets/Crossgen.targets index 8d3091307042..543a5ccc16e0 100644 --- a/src/redist/targets/Crossgen.targets +++ b/src/redist/targets/Crossgen.targets @@ -5,14 +5,14 @@ runtime.$(SharedFrameworkRid).microsoft.netcore.app - <_crossDir Condition="'$(Architecture)' == 'arm64'">/x64_arm64 + <_crossDir Condition="'$(Architecture)' == 'arm64' and '$(HostArch)' == 'x64'">/x64_arm64 <_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm <_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">/x64_arm $(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppPackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension) - $(SharedFrameworkRid) - x64_arm64 + x64_arm64 x86_arm x64_arm + $(SharedFrameworkRid) $(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppPackageVersion)/runtimes/$(LibCLRJitRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension) $(RedistLayoutPath)shared/$(SharedFrameworkName)/$(MicrosoftNETCoreAppPackageVersion) *