Skip to content

Commit

Permalink
Enable hosted builds on arm64
Browse files Browse the repository at this point in the history
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:
dotnet/core-setup#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.

Use HostArch to determine whether _crossDir and LibCLRJitRid need to be
special-cased for arm64 or or not.
  • Loading branch information
omajid committed Aug 19, 2019
1 parent 9df6ca6 commit c331c54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<PropertyGroup>
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</HostArch>
<Architecture Condition="'$(Architecture)' == ''">$(HostArch)</Architecture>
</PropertyGroup>

<PropertyGroup>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<DebugType>embedded</DebugType>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<VersionToolsVersion>$(BuildTasksFeedToolVersion)</VersionToolsVersion>
<DotnetDebToolVersion>2.0.0</DotnetDebToolVersion>
<MicrosoftNETTestSdkVersion>15.8.0</MicrosoftNETTestSdkVersion>
<MicrosoftSourceLinkVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkVersion>
<MicrosoftSourceLinkVersion>1.0.0-beta2-19367-01</MicrosoftSourceLinkVersion>
</PropertyGroup>
<PropertyGroup>
<!-- pinned dependency. This package is not being produced outside of the 2.0 branch of corefx and should not change. -->
Expand Down
6 changes: 3 additions & 3 deletions src/redist/targets/Crossgen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

<PropertyGroup>
<RuntimeNETCoreAppPackageName>runtime.$(SharedFrameworkRid).microsoft.netcore.app</RuntimeNETCoreAppPackageName>
<_crossDir Condition="'$(Architecture)' == 'arm64'">/x64_arm64</_crossDir>
<_crossDir Condition="'$(Architecture)' == 'arm64' and '$(HostArch)' == 'x64'">/x64_arm64</_crossDir>
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">/x86_arm</_crossDir>
<_crossDir Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">/x64_arm</_crossDir>
<CrossgenPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppPackageVersion)/tools$(_crossDir)/crossgen$(ExeExtension)</CrossgenPath>
<LibCLRJitRid Condition="!$(Architecture.StartsWith('arm'))">$(SharedFrameworkRid)</LibCLRJitRid>
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64'">x64_arm64</LibCLRJitRid>
<LibCLRJitRid Condition="'$(Architecture)' == 'arm64' and '$(HostArch)' == 'x64'">x64_arm64</LibCLRJitRid>
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'win'">x86_arm</LibCLRJitRid>
<LibCLRJitRid Condition="'$(Architecture)' == 'arm' And '$(OSName)' == 'linux'">x64_arm</LibCLRJitRid>
<LibCLRJitRid Condition="'$(LibCLRJitRid)' == ''">$(SharedFrameworkRid)</LibCLRJitRid>
<LibCLRJitPath>$(NuGetPackageRoot)/$(RuntimeNETCoreAppPackageName)/$(MicrosoftNETCoreAppPackageVersion)/runtimes/$(LibCLRJitRid)/native/$(DynamicLibPrefix)clrjit$(DynamicLibExtension)</LibCLRJitPath>
<SharedFrameworkNameVersionPath>$(RedistLayoutPath)shared/$(SharedFrameworkName)/$(MicrosoftNETCoreAppPackageVersion)</SharedFrameworkNameVersionPath>
<DIASymReaderCrossgenFilter>*</DIASymReaderCrossgenFilter>
Expand Down

0 comments on commit c331c54

Please sign in to comment.