-
Notifications
You must be signed in to change notification settings - Fork 138
Enable building on arm64 #1300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable building on arm64 #1300
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ | |
| <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <Configuration Condition="$(Configuration) == ''">Release</Configuration> | ||
|
|
||
| <BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture> | ||
| <Platform Condition="'$(Platform)' == '' AND '$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Platform> | ||
| <Platform Condition="'$(Platform)' == ''">x64</Platform> | ||
|
|
||
| <!-- true if we have bootstrapped buildtools (usually on an unsupported platform --> | ||
|
|
@@ -201,7 +204,7 @@ | |
| <ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimePackageVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" /> | ||
| <ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimeVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" /> | ||
| <ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppHostPackageVersion" Version="%24(MicrosoftNETCoreDotNetAppHostPackageVersion)" /> | ||
| <ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimeLinuxX64PackageVersion)" /> | ||
| <ExtraPackageVersionPropsPackageInfo Include="MicrosoftAspNetCoreAppRuntimePackageVersion" Version="%24(MicrosoftAspNetCoreAppRuntimeLinux$(Platform)PackageVersion)" /> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a change in capitalization here. It goes from |
||
| <!-- core-sdk uses this property for ASP.NET blob directory --> | ||
| <ExtraPackageVersionPropsPackageInfo Include="VSRedistCommonAspNetCoreTargetingPackx6430PackageVersion" Version="$(aspnetcoreOutputPackageVersion)" /> | ||
| <!-- OSX needs the OSX version instead of Linux. We don't have a lot of flexibility in how we output these properties so we're relying on the previous one being blank if the Linux version of the package is missing. --> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| From 84d274a8f3d416b0a5bd999e3d1c43ae1535e38f Mon Sep 17 00:00:00 2001 | ||
| From: Omair Majid <[email protected]> | ||
| Date: Wed, 23 Oct 2019 15:43:57 -0400 | ||
| Subject: [PATCH] Support global.json on arm64 as well | ||
|
||
|
|
||
| arcade uses the runtime section of global.json to decide which | ||
| architecture + runtime combination needs to be installed. | ||
|
|
||
| With https://github.com/dotnet/arcade/pull/4132 arcade can install | ||
| foreign SDKs in separate locations correctly. | ||
|
|
||
| This change, suggested by @dougbu, makes arcade always install the | ||
| runtime for the local architecture (which means it should work on arm64 | ||
| and x64) as well as the x86 architecture (skipped on Linux). | ||
|
|
||
| This gets us a working SDK/Runtime combo on arm64. | ||
| --- | ||
| global.json | 2 +- | ||
| 1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
|
||
| diff --git a/global.json b/global.json | ||
| index 602f4f44e17..40dec559cc9 100644 | ||
| --- a/global.json | ||
| +++ b/global.json | ||
| @@ -5,7 +5,7 @@ | ||
| "tools": { | ||
| "dotnet": "3.1.100-preview1-014400", | ||
| "runtimes": { | ||
| - "dotnet/x64": [ | ||
| + "dotnet": [ | ||
| "$(MicrosoftNETCoreAppRuntimeVersion)" | ||
| ], | ||
| "dotnet/x86": [ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| From e2946a26c11be7f7f0c223721a5b14f58f2ea240 Mon Sep 17 00:00:00 2001 | ||
| From: Omair Majid <[email protected]> | ||
| Date: Mon, 11 Nov 2019 13:37:40 -0500 | ||
| Subject: [PATCH] Support building for arm64 on arm64 (*nix) | ||
|
||
|
|
||
| This commit allows ASP.NET Core to be built on arm64 machines directly, | ||
| without relying on cross-compilation. | ||
|
|
||
| There's a few changes in here: | ||
|
|
||
| 1. Ask msbuild to look into the BuildArchitecture | ||
|
|
||
| By default, our build systems assums the machine is x64. This | ||
| modifies the build configuration to check the architecture of the | ||
| currently running build machine, and set BuildArchitecture to that. | ||
|
|
||
| 2. Fix crossgen in Microsoft.AspNetCore.App.Runtime | ||
|
|
||
| We run crossgen for supported architectures (including x64 and | ||
| arm64). For that, we need a jit that we can point crossgen to. | ||
| Generally, we can rely on the build scripts to find the right | ||
| `libclrjit.so`. However, arm64 has multiple `libclirjit.so`, for | ||
| different use-cases. There's one for arm64 (for running on arm64) and | ||
| there's another one for cross-compiling for arm64 on x64. We need to | ||
| figure out and use the right one explicitly rather than assuming the | ||
| right one gets picked up. | ||
|
|
||
| See https://github.com/dotnet/core-setup/pull/8468 for similar | ||
| changes made in core-setup. | ||
|
|
||
| This also needs https://github.com/aspnet/AspNetCore/pull/14790 to fully | ||
| work on arm64. | ||
| --- | ||
| Directory.Build.props | 1 + | ||
| .../src/Microsoft.AspNetCore.App.Runtime.csproj | 12 ++++++++---- | ||
| 2 files changed, 9 insertions(+), 4 deletions(-) | ||
|
|
||
| diff --git a/Directory.Build.props b/Directory.Build.props | ||
| index b3dc903387f..1bd59d73121 100644 | ||
| --- a/Directory.Build.props | ||
| +++ b/Directory.Build.props | ||
| @@ -108,6 +108,7 @@ | ||
| <TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('Windows'))">win</TargetOsName> | ||
| <TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('OSX'))">osx</TargetOsName> | ||
| <TargetOsName Condition=" '$(TargetOsName)' == '' AND $([MSBuild]::IsOSPlatform('Linux'))">linux</TargetOsName> | ||
| + <BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture> | ||
| <TargetArchitecture Condition="'$(TargetArchitecture)' == ''">x64</TargetArchitecture> | ||
| <TargetRuntimeIdentifier>$(TargetOsName)-$(TargetArchitecture)</TargetRuntimeIdentifier> | ||
|
|
||
| diff --git a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj | ||
| index 4c4298a92da..f843ded1241 100644 | ||
| --- a/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj | ||
| +++ b/src/Framework/src/Microsoft.AspNetCore.App.Runtime.csproj | ||
| @@ -90,15 +90,17 @@ This package is an internal implementation of the .NET Core SDK and is not meant | ||
| <PathSeparator Condition="'$(PathSeparator)' == ''">:</PathSeparator> | ||
| <PathSeparator Condition=" '$(TargetOsName)' == 'win' ">%3B</PathSeparator> | ||
|
|
||
| + <CrossCompileDirectory Condition=" '$(TargetRuntimeIdentifier)' == 'linux-arm' ">x64_arm</CrossCompileDirectory> | ||
| + <CrossCompileDirectory Condition=" '$(TargetArchitecture)' == 'arm64' AND '$(BuildArchitecture)' != 'arm64' ">x64_arm64</CrossCompileDirectory> | ||
| + <CrossCompileDirectory Condition=" '$(TargetRuntimeIdentifier)' == 'win-arm' ">x86_arm</CrossCompileDirectory> | ||
| + | ||
| <!-- Crossgen executable name --> | ||
| <CrossgenToolFileName>crossgen</CrossgenToolFileName> | ||
| <CrossgenToolFileName Condition=" '$(TargetOsName)' == 'win' ">$(CrossgenToolFileName).exe</CrossgenToolFileName> | ||
| <!-- Default crossgen executable relative path --> | ||
| <CrossgenToolPackagePath>$(CrossgenToolFileName)</CrossgenToolPackagePath> | ||
| <!-- Disambiguated RID-specific crossgen executable relative path --> | ||
| - <CrossgenToolPackagePath Condition=" '$(TargetRuntimeIdentifier)' == 'linux-arm' ">x64_arm\$(CrossgenToolPackagePath)</CrossgenToolPackagePath> | ||
| - <CrossgenToolPackagePath Condition=" '$(TargetRuntimeIdentifier)' == 'linux-arm64' OR '$(TargetRuntimeIdentifier)' == 'linux-musl-arm64' ">x64_arm64\$(CrossgenToolPackagePath)</CrossgenToolPackagePath> | ||
| - <CrossgenToolPackagePath Condition=" '$(TargetRuntimeIdentifier)' == 'win-arm' ">x86_arm\$(CrossgenToolPackagePath)</CrossgenToolPackagePath> | ||
| + <CrossgenToolPackagePath Condition=" '$(CrossCompileDirectory)' != '' ">$(CrossCompileDirectory)\$(CrossgenToolPackagePath)</CrossgenToolPackagePath> | ||
|
|
||
| <MicrosoftNETCoreAppRuntimeIdentifier>$(RuntimeIdentifier)</MicrosoftNETCoreAppRuntimeIdentifier> | ||
| <MicrosoftNETCoreAppRuntimeIdentifier Condition="'$(TargetOsName)' != 'osx'">$(SourceBuildRuntimeIdentifier)</MicrosoftNETCoreAppRuntimeIdentifier> | ||
| @@ -293,7 +295,9 @@ This package is an internal implementation of the .NET Core SDK and is not meant | ||
| --> | ||
| <PropertyGroup> | ||
| <CrossgenToolDir>$(IntermediateOutputPath)crossgen\</CrossgenToolDir> | ||
| - <CoreCLRJitPath>$(CrossgenToolDir)$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath> | ||
| + <!-- Pick the right coreclr jit based on whether we are cross-compiling or not --> | ||
| + <CoreCLRJitPath Condition="'$(CrossCompileDirectory)' == ''">$(RuntimePackageRoot)runtimes\$(RuntimeIdentifier)\native\$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath> | ||
| + <CoreCLRJitPath Condition="'$(CrossCompileDirectory)' != ''">$(RuntimepackageRoot)runtimes\$(CrossCompileDirectory)\native\$(LibPrefix)clrjit$(LibExtension)</CoreCLRJitPath> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this chunk from here: dotnet/arcade#4132