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

Enable hosted builds on arm64 #7696

Merged
merged 1 commit into from
Aug 15, 2019
Merged

Conversation

omajid
Copy link
Member

@omajid omajid commented Aug 13, 2019

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/5.0.0-alpha1.19403.2/runtimes/linux-arm64/native/libclrjit.so
    ./.packages/transport.runtime.linux-arm64.microsoft.netcore.jit/5.0.0-alpha1.19403.2/runtimes/x64_arm64/native/libclrjit.so

  • Use a version of SourceLink that supports arm64

    We need to upgrade SourceLink to a version that contains Initial implementation of direct git repo data reading sourcelink#288. This commit just updates it to the latest version.

Fixes #7653

@omajid omajid force-pushed the hosted-arm64-build branch 2 times, most recently from 3dc5d66 to 2b71679 Compare August 13, 2019 16:59
@omajid omajid changed the title Partially enable hosted builds on arm64 WIP: Partially enable hosted builds on arm64 Aug 13, 2019
@omajid omajid force-pushed the hosted-arm64-build branch 2 times, most recently from 9b7c172 to b957d52 Compare August 13, 2019 18:46
@omajid omajid changed the title WIP: Partially enable hosted builds on arm64 Enable hosted builds on arm64 Aug 13, 2019
@omajid
Copy link
Member Author

omajid commented Aug 14, 2019

cc @dagood

Copy link
Member

@dagood dagood left a comment

Choose a reason for hiding this comment

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

Thanks for this! I have a suggestion on how the JIT picking code might be able to be cleaner, looks good though.

Directory.Build.props Outdated Show resolved Hide resolved
eng/Versions.props Show resolved Hide resolved
src/pkg/packaging-tools/framework.dependency.targets Outdated Show resolved Hide resolved
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
@dagood
Copy link
Member

dagood commented Aug 14, 2019

Even better. 😄 Thanks again.

@dagood dagood merged commit 4b82b1e into dotnet:master Aug 15, 2019
@omajid
Copy link
Member Author

omajid commented Aug 15, 2019

Thanks for the review and merging this!

omajid added a commit to omajid/dotnet-installer that referenced this pull request 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 'HostArch' 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 HostArch to determine whether _crossDir and LibCLRJitRid need to be
special-cased for arm64 or or not.
@omajid
Copy link
Member Author

omajid commented Aug 20, 2019

@dagood It looks like this broke tests via VS in corefx: dotnet/corefx#40427

Do we want to revert it here in core-setup as well?

@dagood
Copy link
Member

dagood commented Aug 20, 2019

That's a shame, I suppose we should. 😕 Thanks for pinging this thread about it.

FYI @vitek-karas, @elinor-fung if you've had problems building tests in VS recently.

omajid added a commit to omajid/dotnet-installer that referenced this pull request Aug 20, 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 'HostArch' 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 HostArch: under Visual Studio (an x86) process,
we generally want a x64 architecture.

Use HostArch to determine whether _crossDir and LibCLRJitRid need to be
special-cased for arm64 or or not.
@vitek-karas
Copy link
Member

Can we please revert this? Among other things this makes default command line build on Windows to produce x86 (unlike x64 which it did before) - this breaks all my links and so on, and it's not the default we want anyway.

omajid added a commit to omajid/dotnet-core-setup that referenced this pull request Aug 22, 2019
This reverts commit 4b82b1e.

The changes break VS and may even change the default on Windows to x86
instead of x64.
@omajid
Copy link
Member Author

omajid commented Aug 22, 2019

I opened #7806 to revert this change

dagood pushed a commit that referenced this pull request Aug 22, 2019
This reverts commit 4b82b1e.

The changes break VS and may even change the default on Windows to x86
instead of x64.
omajid added a commit to omajid/dotnet-installer that referenced this pull request Oct 9, 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.

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 added a commit to omajid/dotnet-installer that referenced this pull request Oct 17, 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.

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 added a commit to omajid/dotnet-installer that referenced this pull request Oct 31, 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.

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.
dagood pushed a commit to dotnet/installer that referenced this pull request Nov 7, 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.

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.
dagood pushed a commit to dagood/installer that referenced this pull request Feb 21, 2020
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.
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
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 dotnet/core-setup#7653

Commit migrated from dotnet/core-setup@4b82b1e
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…et/core-setup#7806)

This reverts commit dotnet/core-setup@4b82b1e.

The changes break VS and may even change the default on Windows to x86
instead of x64.

Commit migrated from dotnet/core-setup@a307f0d
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Working around LibGitSharp2 not working on arm64?
3 participants