Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Enable hosted builds on arm64 (#7696)
Browse files Browse the repository at this point in the history
To enable building core-setup on arm64 (hosted, not cross compiled), we
need to do a few things:

- Set the right TargetArchitecture

  Use the currently running architecture to decide the HostArch. Use that
  as the default value of TargetArchitecture, unless another value was
  provided by the build configuration.

- Use the right coreclr JIT

  If we are cross-compiling, we need to use the x86_arm64 libclrjit.so.
  But if we are building on an arm64 host, we need to pick the normal-RID
  (eg, linux-arm64) libclrjit.so from the two:

    ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit/###/runtimes/linux-arm64/native/libclrjit.so
    ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit/###/runtimes/x64_arm64/native/libclrjit.so

- Use a version of SourceLink that supports arm64

  We need to upgrade SourceLink to a version that contains
  dotnet/sourcelink#288. This commit just
  updates it to the latest version.

Fixes #7653
  • Loading branch information
omajid authored and dagood committed Aug 15, 2019
1 parent aae3e31 commit 4b82b1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
</PropertyGroup>

<PropertyGroup>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</HostArch>
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">$(HostArch)</TargetArchitecture>
<Platform Condition="'$(Platform)'==''">$(TargetArchitecture)</Platform>
</PropertyGroup>
<!--
Expand Down Expand Up @@ -398,4 +399,4 @@
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

</Project>
</Project>
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 @@
<MicrosoftTargetingPackPrivateWinRTPackageVersion>1.0.5</MicrosoftTargetingPackPrivateWinRTPackageVersion>
<MicrosoftDiaSymReaderNativePackageVersion>1.7.0</MicrosoftDiaSymReaderNativePackageVersion>
<!-- Infrastructure and test-only. -->
<MicrosoftSourceLinkVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkVersion>
<MicrosoftSourceLinkVersion>1.0.0-beta2-19367-01</MicrosoftSourceLinkVersion>
</PropertyGroup>
<!--Package names-->
<PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/pkg/packaging-tools/framework.dependency.targets
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@
<PropertyGroup>
<_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' == 'Windows_NT'">/x86_arm</_crossDir>
<_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' != 'Windows_NT'">/x64_arm</_crossDir>
<_crossDir Condition="'$(TargetArchitecture)' == 'arm64'">/x64_arm64</_crossDir>
<!-- Only use x64_arm64 when cross compiling. Use normal executible when compiling on arm64 itself. -->
<_crossDir Condition="'$(TargetArchitecture)' == 'arm64' AND '$(HostArch)' != 'arm64'">/x64_arm64</_crossDir>
</PropertyGroup>

<ItemGroup>
Expand All @@ -235,7 +236,6 @@
<!-- Find crossgen tool assets in package cache to allow ExcludeAssets=All. -->
<_runtimeCLR Include="$(_runtimePackageDir)**/$(LibraryFilePrefix)coreclr$(LibraryFileExtension)" />
<_runtimeCoreLib Include="$(_runtimePackageDir)**/native/System.Private.CoreLib.dll" />
<_runtimeJIT Include="$(_jitPackageDir)**/$(LibraryFilePrefix)clrjit$(LibraryFileExtension)" />
<_fxSystemRuntime Include="$(_corefxPackageDir)**/System.Runtime.dll" />
<_windowsWinMD Include="$(_winmdPackageDir)**/Windows.winmd" />
<_diaSymReaderAssembly Include="$(_diaSymReaderPackageDir)**\Microsoft.DiaSymReader.Native.*.dll" />
Expand All @@ -250,8 +250,8 @@
<_coreLibDirectory>%(_runtimeCoreLib.RootDir)%(_runtimeCoreLib.Directory)</_coreLibDirectory>
</PropertyGroup>

<PropertyGroup Condition="'@(_runtimeJIT)' != ''">
<_jitPath>%(_runtimeJIT.FullPath)</_jitPath>
<PropertyGroup>
<_jitPath Condition="'$(_crossDir)' == ''">$(_jitPackageDir)runtimes/$(PackageRID)/native/$(LibraryFilePrefix)clrjit$(LibraryFileExtension)</_jitPath>
<_jitPath Condition="'$(_crossDir)' != ''">$(_jitPackageDir)runtimes$(_crossDir)/native/$(LibraryFilePrefix)clrjit$(LibraryFileExtension)</_jitPath>
</PropertyGroup>

Expand Down

0 comments on commit 4b82b1e

Please sign in to comment.