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

Commit

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

- Set the right TargetArchitecture

  When `TargetArchitecture` is not explicitly specified and when the currently
  running architecture is Arm64, use arm64 as the `TargetArchitecture`. Don't
  always use the currently running architecture as that doesn't play well with
  an x86 Visual Studio trying to create x64 builds.

- 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 machine, we need to filter the list of found
  libclrjit.so files to pick the normal-RID (eg, linux-arm64) libclrjit.so from
  the two:

  ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit/<version>/runtimes/linux-arm64/native/libclrjit.so
  ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit/<version>/runtimes/x64_arm64/native/libclrjit.so
  • Loading branch information
omajid authored and dagood committed Oct 8, 2019
1 parent 5f54f88 commit 57ba280
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
</PropertyGroup>

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

</Project>
</Project>
7 changes: 3 additions & 4 deletions src/pkg/packaging-tools/framework.dependency.targets
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
<PropertyGroup Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' != 'Windows_NT'">
<_crossHostArch>x64</_crossHostArch>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetArchitecture)' == 'arm64'">
<PropertyGroup Condition="'$(TargetArchitecture)' == 'arm64' AND '$(BuildArchitecture)' != 'arm64'">
<_crossHostArch>x64</_crossHostArch>
</PropertyGroup>
<PropertyGroup>
Expand All @@ -279,7 +279,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 @@ -294,8 +293,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 57ba280

Please sign in to comment.