Skip to content
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 hosted builds on arm64 #4102

Merged
merged 1 commit into from
Nov 7, 2019
Merged

Conversation

omajid
Copy link
Member

@omajid omajid commented Aug 19, 2019

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 'BuildArchitecture` 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 BuildArchitecture to determine whether _crossDir and LibCLRJitRid need to be special-cased for arm64 or or not.

@omajid omajid force-pushed the build-arm64-hosted branch from c331c54 to 76bc70e Compare August 20, 2019 22:34
@omajid omajid closed this Aug 21, 2019
@omajid omajid reopened this Aug 21, 2019
@omajid omajid changed the title Enable hosted builds on arm64 WIP: Enable hosted builds on arm64 Aug 24, 2019
@omajid omajid force-pushed the build-arm64-hosted branch from 76bc70e to 83fbaa4 Compare October 9, 2019 17:29
@omajid omajid changed the title WIP: Enable hosted builds on arm64 Enable hosted builds on arm64 Oct 9, 2019
@@ -7,6 +7,12 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<PropertyGroup>
<BuildArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture.ToString().ToLowerInvariant())</BuildArchitecture>
<Architecture Condition="'$(BuildArchitecture)' == 'arm64'">$(BuildArchitecture)</Architecture>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first instinct was to default to $(BuildArchitecture) always, but that breaks VS (x86) on Windows. See dotnet/corefx#40424 for more information.

@@ -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>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just need a version that includes dotnet/sourcelink#288. I bumped it up to the version that was the latest when I started this patch.

@@ -5,14 +5,14 @@

<PropertyGroup>
<RuntimeNETCoreAppPackageName>runtime.$(SharedFrameworkRid).microsoft.netcore.app</RuntimeNETCoreAppPackageName>
<_crossDir Condition="'$(Architecture)' == 'arm64'">/x64_arm64</_crossDir>
<_crossDir Condition="'$(Architecture)' == 'arm64' and '$(BuildArchitecture)' != 'arm64'">/x64_arm64</_crossDir>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, this would be '$(BuildArchitecture)' == 'x64' but that wouldn't work (as far as I understand) for VS. Any suggestions?

@@ -25,11 +25,11 @@

<!-- Use the "x64" Rid when downloading Linux shared framework 'DEB' installer files. -->
<SharedFrameworkInstallerFileRid>$(CoreSetupRid)</SharedFrameworkInstallerFileRid>
<SharedFrameworkInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true' ">x64</SharedFrameworkInstallerFileRid>
<SharedFrameworkInstallerFileRid Condition=" '$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true' ">$(Architecture)</SharedFrameworkInstallerFileRid>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked through this file's history, but I can't understand why it was hardcoded to x64.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was to distinguish between linux-arm, which we didn't support before.

@omajid
Copy link
Member Author

omajid commented Oct 11, 2019

@nguerrera @livarcocc Do you know who might be able to review this?

@omajid
Copy link
Member Author

omajid commented Oct 17, 2019

Hey @leecow! Do you know who can help review this change? It's part of the larger arm64 enablement work in source-build (dotnet/source-build#1300).

@omajid omajid force-pushed the build-arm64-hosted branch from 83fbaa4 to 4330dfd Compare October 17, 2019 17:05
@livarcocc
Copy link

@wli3 @johnbeisner could review?

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 'BuildArchitecture' 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.

There's a gotcha with BuildArchitecture: under Visual Studio (an x86) process,
we generally want a x64 architecture. So try and restrict it to arm64 only.

Use BuildArchitecture to determine whether _crossDir and LibCLRJitRid need to
be special-cased for arm64 or or not.
@omajid omajid force-pushed the build-arm64-hosted branch from 4330dfd to 29921e2 Compare October 31, 2019 19:40
@omajid
Copy link
Member Author

omajid commented Oct 31, 2019

I have rebased the commit on top of master and resolved the merge conflicts. Also verified that ./build.sh works on RHEL 8 on arm64.

@dagood @johnbeisner @livarcocc @wli3 Anyone know what the next step here is?

@omajid
Copy link
Member Author

omajid commented Nov 5, 2019

Ping. Anyone?

@dagood
Copy link
Member

dagood commented Nov 5, 2019

@wli3, @johnbeisner, can you please review this PR?

(I hit the retry button for the PR validation timeouts. I believe there's general infra trouble in this repo right now and those wouldn't be caused by this PR.)

@dagood dagood merged commit 17b5d95 into dotnet:master Nov 7, 2019
@omajid
Copy link
Member Author

omajid commented Nov 7, 2019

Thanks for reviewing and merging, @johnbeisner @dagood !

omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 12, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 12, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 12, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 12, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 15, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 15, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 15, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 15, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 15, 2019
This chnage allows source-build to be cloned and built on arm64
 machines. I have tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests
 which have been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 16, 2019
This chnage allows source-build to be cloned and built on arm64
machines. It shouldn't affect cross compilation at all, however. I have
tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests which have
been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453

To support using darc on arm64, this commit removes the customizations
of LD_LIBRARY_PATH and instead forces darc to run again a .NET Core 3.0
runtime. This in-turn makes darc pick up the right libgit2sharp
automatically for the right set of platforms and architectures.

There's a number of existing build configuration that are
conditionalized on arm64, such as setting up a root file system. Those
they are actually only meant to be invoked when cross-compiling for
arm64 (on x86_64). This commit modifies those conditions to not apply
when building on an arm64 machine.
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 20, 2019
This change allows source-build to be cloned and built on arm64
machines. It shouldn't affect cross compilation at all, however. I have
tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests which have
been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453

There's a number of existing build configuration that are
conditionalized on arm64, such as setting up a root file system. Those
they are actually only meant to be invoked when cross-compiling for
arm64 (on x86_64). This commit modifies those conditions to not apply
when building on an arm64 machine.
omajid added a commit to omajid/dotnet-source-build that referenced this pull request Nov 21, 2019
This change allows source-build to be cloned and built on arm64
machines. It shouldn't affect cross compilation at all, however. I have
tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests which have
been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453

There's a number of existing build configuration that are
conditionalized on arm64, such as setting up a root file system. Those
they are actually only meant to be invoked when cross-compiling for
arm64 (on x86_64). This commit modifies those conditions to not apply
when building on an arm64 machine.
crummel pushed a commit to omajid/dotnet-source-build that referenced this pull request Nov 22, 2019
This change allows source-build to be cloned and built on arm64
machines. It shouldn't affect cross compilation at all, however. I have
tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests which have
been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453

There's a number of existing build configuration that are
conditionalized on arm64, such as setting up a root file system. Those
they are actually only meant to be invoked when cross-compiling for
arm64 (on x86_64). This commit modifies those conditions to not apply
when building on an arm64 machine.
crummel pushed a commit to dotnet/source-build that referenced this pull request Nov 24, 2019
* Enable building on arm64

This change allows source-build to be cloned and built on arm64
machines. It shouldn't affect cross compilation at all, however. I have
tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests which have
been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453

There's a number of existing build configuration that are
conditionalized on arm64, such as setting up a root file system. Those
they are actually only meant to be invoked when cross-compiling for
arm64 (on x86_64). This commit modifies those conditions to not apply
when building on an arm64 machine.

* Patch fixup.
MichaelSimons pushed a commit to dotnet/source-build-externals that referenced this pull request Feb 8, 2022
* Enable building on arm64

This change allows source-build to be cloned and built on arm64
machines. It shouldn't affect cross compilation at all, however. I have
tested this on RHEL 8 aarch64.

This change includes backports of the following pull-requests which have
been merged into their respective master branches:

- dotnet/aspnetcore#14790
- dotnet/aspnetcore#15354
- dotnet/installer#4102
- dotnet/core-setup#8468
- dotnet/corefx#40453

There's a number of existing build configuration that are
conditionalized on arm64, such as setting up a root file system. Those
they are actually only meant to be invoked when cross-compiling for
arm64 (on x86_64). This commit modifies those conditions to not apply
when building on an arm64 machine.

* Patch fixup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants