Skip to content

Commit 2b71679

Browse files
committed
Enable hosted builds on arm64
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 whether to default to x64 or to switch to arm64 when TargetArchitecture is not specified - 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 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/###/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
1 parent 6f3ead3 commit 2b71679

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

Directory.Build.props

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@
9494
</PropertyGroup>
9595

9696
<PropertyGroup>
97-
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
97+
<HostArch>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</HostArch>
98+
<TargetArchitecture Condition="'$(TargetArchitecture)' == '' AND '$(HostArch)' == 'Arm64'">arm64</TargetArchitecture>
99+
<TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture>
98100
<Platform Condition="'$(Platform)'==''">$(TargetArchitecture)</Platform>
99101
</PropertyGroup>
100102
<!--
@@ -398,4 +400,4 @@
398400
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
399401
</PropertyGroup>
400402

401-
</Project>
403+
</Project>

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<MicrosoftTargetingPackPrivateWinRTPackageVersion>1.0.5</MicrosoftTargetingPackPrivateWinRTPackageVersion>
8888
<MicrosoftDiaSymReaderNativePackageVersion>1.7.0</MicrosoftDiaSymReaderNativePackageVersion>
8989
<!-- Infrastructure and test-only. -->
90-
<MicrosoftSourceLinkVersion>1.0.0-beta2-18618-05</MicrosoftSourceLinkVersion>
90+
<MicrosoftSourceLinkVersion>1.0.0-beta2-19367-01</MicrosoftSourceLinkVersion>
9191
</PropertyGroup>
9292
<!--Package names-->
9393
<PropertyGroup>

src/pkg/packaging-tools/framework.dependency.targets

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@
217217
<PropertyGroup>
218218
<_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' == 'Windows_NT'">/x86_arm</_crossDir>
219219
<_crossDir Condition="'$(TargetArchitecture)' == 'arm' AND '$(OS)' != 'Windows_NT'">/x64_arm</_crossDir>
220-
<_crossDir Condition="'$(TargetArchitecture)' == 'arm64'">/x64_arm64</_crossDir>
220+
<!-- Only use x64_arm64 when cross compiling. Use normal executible when compiling on arm64 itself. -->
221+
<_crossDir Condition="'$(TargetArchitecture)' == 'arm64' AND '$(HostArch)' != 'Arm64'">/x64_arm64</_crossDir>
221222
</PropertyGroup>
222223

223224
<ItemGroup>
@@ -251,10 +252,26 @@
251252
</PropertyGroup>
252253

253254
<PropertyGroup Condition="'@(_runtimeJIT)' != ''">
254-
<_jitPath>%(_runtimeJIT.FullPath)</_jitPath>
255+
<_runtimeJITFilterDir>/$(PackageRID)/</_runtimeJITFilterDir>
256+
</PropertyGroup>
257+
258+
<!-- It is possible for _runtimeJIT to pick up 2 jit files:
259+
one for cross compilation and one for native compilation. -->
260+
<ItemGroup Condition="'@(_runtimeJIT)' != '' AND '$(_crossDir)' == ''">
261+
<_filteredRuntimeJIT Include="%(_runtimeJIT.Identity)" Condition="'@(_runtimeJIT->Contains($(_runtimeJITFilterDir)))' == 'True'" />
262+
</ItemGroup>
263+
264+
<PropertyGroup Condition="'@(_runtimeJIT)' != ''">
265+
<_jitPath>%(_filteredRuntimeJIT.FullPath)</_jitPath>
255266
<_jitPath Condition="'$(_crossDir)' != ''">$(_jitPackageDir)runtimes$(_crossDir)/native/$(LibraryFilePrefix)clrjit$(LibraryFileExtension)</_jitPath>
256267
</PropertyGroup>
257268

269+
<Message Importance="high" Text="XXX ### *** === +++ This is PackageRID: $(PackageRID)"/>
270+
<Message Importance="high" Text="XXX ### *** === +++ This is _runtimeJIT: @(_runtimeJIT)"/>
271+
<Message Importance="high" Text="XXX ### *** === +++ This is _runtimeJITFilterDir: $(_runtimeJITFilterDir)"/>
272+
<Message Importance="high" Text="XXX ### *** === +++ This is _filteredRuntimeJIT: @(_filteredRuntimeJIT)"/>
273+
<Message Importance="high" Text="XXX ### *** === +++ This is _jitPath: $(_jitPath)"/>
274+
258275
<PropertyGroup Condition="'@(_fxSystemRuntime)' != ''">
259276
<_fxLibDirectory>%(_fxSystemRuntime.RootDir)%(_fxSystemRuntime.Directory)</_fxLibDirectory>
260277
</PropertyGroup>

0 commit comments

Comments
 (0)