Skip to content

Add ARM64/aarch64 support #397

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

Merged
merged 2 commits into from
Oct 4, 2022
Merged

Conversation

dennisameling
Copy link
Contributor

@dennisameling dennisameling commented Jun 24, 2022

Leverages the x64 Git for Windows SDK but sets MSYSTEM to CLANGARM64 which is needed to use the native ARM64 clang compiler.

Used in git-for-windows/git#3916 - successful CI run: https://github.com/dennisameling/git/actions/runs/3073573453/jobs/4965793895

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

Looks good, but should we not ask pacman to install clang in that aarch64 case, too, at least as long as msys=false?

@dennisameling dennisameling changed the title Add basic ARM64/aarch64 support Add basic ARM64/aarch64 support and cleanup logic Sep 17, 2022
@dennisameling dennisameling force-pushed the windows-arm64 branch 3 times, most recently from bce7786 to 2737d10 Compare September 17, 2022 13:20
@dennisameling dennisameling changed the title Add basic ARM64/aarch64 support and cleanup logic Add ARM64/aarch64 support and cleanup logic Sep 17, 2022
@dennisameling
Copy link
Contributor Author

dennisameling commented Sep 17, 2022

Looks good, but should we not ask pacman to install clang in that aarch64 case, too, at least as long as msys=false?

I previously did that part in my git-for-windows/git PR, but I agree it makes sense to do it in this GH Action instead. Have just set that up, as well as some cleanup logic to fix #398.

@dscho
Copy link
Member

dscho commented Sep 17, 2022

It is really nice that these VMs are decently fast. Do you have an ARM (pun intended?) template to set up a new Azure VM that acts as a GitHub Actions build agent?

@dennisameling dennisameling force-pushed the windows-arm64 branch 2 times, most recently from 6478010 to 88fd47f Compare September 18, 2022 09:47
@dennisameling
Copy link
Contributor Author

dennisameling commented Sep 18, 2022

It is really nice that these VMs are decently fast. Do you have an ARM (pun intended?) template to set up a new Azure VM that acts as a GitHub Actions build agent?

Haha, that abbreviation is very confusing indeed. I used a VM with 8 cores, but there's VMs with up to 64 cores if you need even more performance. I installed the x64 version of Git for Windows on the machine, so once we have a first native ARM64 version in place, the clone/preparation step will most likely be quite a bit faster.

Good call regarding the ARM template. I just created one. Took some effort to get it right, but it works now! It comes with a post-deployment script that:

  • Enables Windows Developer Mode (for symlinks)
  • Adds a Windows Defender exclusion for the entire C:\ drive
  • Installs Git for Windows (x64)
  • Installs and configures the GitHub Actions runner as a Windows service

Here's a fresh run (8m25s) with the latest changes from this PR, ran on a VM that I deployed using the ARM template above 🚀 https://github.com/dennisameling/git/actions/runs/3077779847/jobs/4972879838

Think we're good to go now with this PR, right?

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

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

One last concern, as the test run shows that the post action does add a full minute...

@dennisameling dennisameling changed the title Add ARM64/aarch64 support and cleanup logic Add ARM64/aarch64 support Sep 24, 2022
@dennisameling
Copy link
Contributor Author

I just went ahead and moved the cleanup logic into a completely separate PR to make things easier to review.

Another successful run of just the ARM64 logic: https://github.com/dennisameling/git/actions/runs/3117529361/jobs/5056244750

main.ts Outdated
Comment on lines 92 to 94
// Some binaries aren't available yet in the /clangarm64/bin folder, but Windows 11 ARM64
// has support for x64 emulation, so let's add /mingw64/bin as a fallback.
...(msystem === 'CLANGARM64' ? ['/mingw64/bin'] : []),
Copy link
Contributor Author

@dennisameling dennisameling Sep 25, 2022

Choose a reason for hiding this comment

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

I was specifically missing git.exe and friends. This fallback will no longer be needed once a first version of Git for Windows ARM64 has been released and this binary becomes available in the /clangarm64 folder (assuming that ARM64 will get its own SDK at some point)

@dscho
Copy link
Member

dscho commented Sep 27, 2022

@dennisameling I adjusted this PR branch a bit, could you have a look (and verify that it still works as intended)?

Copy link
Contributor Author

@dennisameling dennisameling 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 the updates and for adding the commit description! Just left one minor comment/question. This basic test is working fine, thank you 👍🏼

main.ts Outdated
if (architecture === 'aarch64') {
// Some binaries aren't available yet in the /clangarm64/bin folder, but Windows 11 ARM64
// has support for x64 emulation, so let's add /mingw64/bin as a fallback.
binPaths.splice(binPaths.length - 2, 0, '/mingw64/bin')
Copy link
Contributor Author

@dennisameling dennisameling Sep 28, 2022

Choose a reason for hiding this comment

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

This results in the following array:

[ '/usr/bin/core_perl', '/mingw64/bin', '/usr/bin', '/clangarm64/bin' ]

... which will eventually end up in the path as follows:

/clangarm64/bin:/usr/bin:/mingw64/bin:/usr/bin/core_perl:${PATH}

Is it intended to put /usr/bin before /mingw64/bin in this case? I always thought it's preferred to put /mingw64/bin first and fallback to /usr/bin only if really needed, but I lack any clear background info/reasoning on that. No strong preference on my side for this one - just curious!

Copy link
Member

Choose a reason for hiding this comment

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

Oh no, this is an off-by-one... 😱

Copy link
Member

Choose a reason for hiding this comment

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

@dennisameling could I bother you to test again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dscho thanks! I also tested with makepkg-git instead of full this time, and with cleanup: true. Everything is working as expected 🎉 https://github.com/dennisameling/git/actions/runs/3159629157/jobs/5143099298

dscho added 2 commits October 4, 2022 09:23
This does not install the Git for Windows/ARM64 SDK, of course, because
such a thing does not exist.

However, it _does_ install the Git for Windows SDK targeting x86_64
(which Windows/ARM64 11 can use) and then adds MINGW versions of `clang`
targeting aarch64.

Signed-off-by: Dennis Ameling <dennis@dennisameling.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho merged commit 9980f36 into git-for-windows:main Oct 4, 2022
@dscho
Copy link
Member

dscho commented Oct 4, 2022

@dennisameling thank you so much for your tireless work. This is now live, as v1.5.0.

@dennisameling dennisameling deleted the windows-arm64 branch October 4, 2022 08:10
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.

2 participants