Are there any plans to support an ARM64-compatible release of Git for Windows?
My ignorance here, but is Windows on ARM64?
This maybe an 'upstream' question to see if the new Azure CI capability could build and test for ARM (and maybe the Rasp pi? he says with ulterior motives...)
Are there any plans to support an ARM64-compatible release of Git for Windows?
I looked into it, and the main issue is the lack of an ARM64 version of MSYS2. There does seem to exist an ARM64 version (at least a preliminary one) of Cygwin (on which MSYS2 is based), so there is hope.
However, I would like to encourage everybody who is interested in ARM64 support to chip in some work, as there is _plenty_ to do before we will have a working Git for Windows on ARM64. Like, _highly_ encourage.
I talk about MSYS2 because we need this for the parts of Git that are still implemented as Unix shell and Perl scripts (git bisect and git submodule are probably the two most prominent ones).
In the short run, if you should try to build Git for Windows yourself, in Visual Studio, by cloning this repository and checking out vs/master. Last time I checked, this failed to build the prerequisites, apparently vcpkg did not support building OpenSSL for ARM64 back then (this might have changed, see https://github.com/microsoft/vcpkg/releases for more details).
It's my understanding that you can only natively build ARM64 apps on Windows if they are based off of UWP. Otherwise, there is an x86 emulator for running Win32 applications, and Microsoft announced in November that they were working on an x64 emulator for Windows applications. I think we would need to wait until Microsoft makes x64 emulation generally available to approach this. If there's any preliminary work I can do in the mean time that would help out, please feel free to let me know and I will be happy to see what I can do.
@dscho I'm interested in helping with bringing Git for Windows to ARM64. Locally i was able to get the vckpg dependencies built for ARM64 with only a tiny bit of hacking. The result of my efforts is a an ARM64 git.exe binary that at least dumps the help message successfully on my ARM laptop (i haven't tried anything else yet). Would you like to chat either here or offline about what you see as the full list of work that might be required beyond this?
ian Bearman
Principal Software Engineering Manager
Microsoft Visual C++ Team: Optimization & Code Generation
/* Making your code faster, smaller, smarter! */
That sounds amazing! Let's chat here, okay?
One of the biggest obstacles to getting Git to work on ARM is the lack of a Bash. But many things already work without a Bash...
So we could aim first for building a slightly incomplete Git for Windows (ARM64 edition) using the Visual C build.
What was that hackery you needed? Patches to vcpkg?
I can create a PR for my changes, but i'm not sure the process for this. The changes are all in the 'git' source tree. Is there doc/contributors guide that covers this?
In the meantime, here's an outline of what i did based on SDK-64:
After these changes, building the git.sln for ARM64 "just works". I copied over to my ARM64 device and i have some very basic functionality working (i.e. the logo and help message). I dropped the binary into a folder layout matching an installed version and things got a bit better, but authentication for a fetch didn't work (missing DLLs i believe) and git checkout doesn't work if there are any new files (i didn't look further into this last week).
Is there a top-down view i can get of dependencies? That might be better than stabbing tin the dark looking for missing pieces. Additionally, i couldn't find documentation on building the installer, which i thought might give me a clue as to what binaries i need to look for.
The documentation for building an installer is at https://github.com/git-for-windows/git/wiki/Making-an-installer
Btw, i've tried to push my local changes to the git repo, but its not working for me...
C:\git-sdk-64\usr\src\git>"C:\Program Files\Git\cmd\git.exe" push --set-upstream origin initialArm64
remote: Permission to git-for-windows/git.git denied to manbearian.
fatal: unable to access 'https://github.com/git-for-windows/git/': The requested URL returned error: 403
Ideas?
You don't have push access to git-for-windows/git (very few people do). Click "Fork" near the top to create a copy on your github account, push there, then create a pull request.
I'm making steady progress by mixing x86 binaries (from x86 install of Git for Windows) and the ARM64 binaries i built. I'm blocked on a few things right now and any help on these is appreciated:
Cloning into 'c:\msvc1'...
fatal: Unsupported SSL backend 'openssl'. Supported SSL backends:
schannel
i'm not sure where to start to investigate this, so pointers to what the authentication process or where its located in source at lest might give me a push in the right direction.
I successfully built a setup (thank for the instruction), but its not quite what i need for a few reasons: first the setup doesn't seem to contain the ARM64 git.exe that i built locally, not sure from where/what it grabbed its binaries. second, the setup didn't ask the usual Qs that setup asks, not sure if that is something i did wrong or not.
finally, related to setup: one path, which i think is a good one, in the direction toward getting something viable on ARM64 Windows is to get a setup that mixes 32-bit x86 and ARM64. (e.g. mingw32). This is because the emulator on ARM64 Windows only supports 32-bit x86 binaries.
Please let me know your thoughts on these topics.
thanks,
ian
Spending time debugging fatal: Unsupported SSL backend 'openssl' has lead me to the conclusion that the libcurl i have is built without OPENSSL, (i see -DCMAKE_USE_OPENSSL=OFF in my build log) but that feature seems to be enabled in the version that i have installed. When i run git config --system -l i see http.sslbackend=openssl, and this setting seems to be sending git-remote-http.exe down the path that won't work.
The libcurl dependency is a vcpkg dependency... so i didn't run any configuration on it: is there possibly something strange here? Is this is a scenario that is not tested in VS build scenario?
Additional help is appreciated.
Have you seen microsoft/vcpkg#9683?
To get openssl support with vcpkg curl you apparently need to run vcpkg install curl[core,openssl]
@rimrul , thanks. that was my conclusion as well from reading the vckpg docs, but that still leaves open my second question: Is this is a scenario that is not tested in VS build scenario?
How far into uncharted territory am i right now?
How far into uncharted territory am i right now?
Far ;-)
Last time I tried to compile for ARM, vcpkg did _not_ support building OpenSSL for ARM. But you might be able to build cURL with "winssl" (also known as "Secure Channel") support, which is provided by Windows, so there is no need to compile that yourself. This backend is essentially an alternative to using OpenSSL, and also allows cURL to connect via HTTPS.
Cloning into 'c:msvc1'...
fatal: Unsupported SSL backend 'openssl'. Supported SSL backends:
schannel
Nevermind, I should have read back further: schannel is what you want to use. You can configure it via git config --global http.sslBackend schannel.
Thank you for the workaround, @dscho , My 'uncharted territory' was more about the VS build then ARM64. From what i cnan teThe x86 and x64 vcpkg builds of curl also do not have openSSL support as it not included in the default build. Is the VS build intended to be fully functional?
Is there a top-down view i can get of dependencies?
Not really. I'll try to give you a _very_ brief (and probably incomplete) overview:
Git for Windows consists of the parts that are implemented in C, and some Perl/shell scripts. The Perl/shell scripts are run via MSYS2's Perl and Bash. Unfortunately, Git _assumes_ that a shell interpreter is available (yay for Linux legacy), which shows when you try to execute a pager (less.exe, which is also provided by MSYS2) or a hook, or try to override which program is used to connect via SSH.
The _biggest_ problem with MSYS2 is that it is derived from Cygwin, and Cygwin started only recently looking into supporting ARM (I have not checked how far that effort went so far). Suffice to say, MSYS2 is _not_ provided for ARM.
Apart from that, Git for Windows is actually independent from MSYS2. The parts that are implemented in C (which are nowadays almost all commands, notable exceptions are the submodule support, git bisect and git svn, those are still all scrips) are compiled into pure Win32 executables.
We usually use GCC to build those executables, in particular the mingw-w64 port of GCC.
We also provide a way to build with Visual C. Regarding this question:
Is the VS build intended to be fully functional?
We _try_ our best to keep it as functional as possible, the CI/PR pipeline tries to verify that.
Note that the test suite itself is implemented in shell script, therefore you won't be able to run any of those regression tests if you don't have a shell interpreter (and we typically use MSYS2's Bash for that, more on that below).
So the "VS build" is actually a hodgepodge of executables compiled with Visual C, copied into the right place (I do not even think that we have an official MSBuild target for that), and Perl/shell scripts run via the parts from a MSYS2 system (which are compiled with _yet another_ fork of GCC).
Now, for the dependencies. I will restrict myself to the C part here. The minimal set of dependencies consists of zlib. There is no way to run Git without zlib.
Git for Windows also uses these dependencies in addition:
libintl for localization (although you can technically compile Git via the Makefile knob NO_GETTEXT),git grep -P)libiconv to convert between encodings (again, this can be turned off with a Makefile knob: NO_ICONV)Now back to the shell scripts. There is BusyBox, and there is a Win32 port of it. BusyBox is an all-in-one executable that provides the functionality of a POSIX shell, of all the Unix utilities frequently expected by scripts, e.g. sed, awk, etc. We do have an experimental, _non-interactive_ version of Git for Windows (the "MinGit edition" intended to be bundled and used by 3rd-party applications that do not want to depend on a full Git for Windows installation). The build process of BusyBox is derived from the Linux kernel's build system, i.e. it is pretty heavily tied into shell scripting and POSIX functionality. With a substantial amount of work, it _might_ be possible to compile BusyBox-w32 for ARM. That would be our best bet, I think, to have a more complete Git for Windows on ARM.
For Perl, I do not really have any hope (and no, using Strawberry Perl is not an option: Git's heaviest Perl user is git svn and it requires the perl-svn bindings, i.e. native Perl modules to access Subversion's APIs, and I doubt that Strawberry brings those).
Is this is a scenario that is not tested in VS build scenario?
As you probably guessed: indeed, the regression test suite does _not_ test HTTP/HTTPS functionality on Windows. The reason is that Git's regression tests covering that use case require Apache2 server executables to be available for starting up a transient HTTPS server.
I was able to get curl building with openSSL and cloning from Azure DevOps worked!
Cloning into 'c:\msvc1'...
remote: Azure Repos
remote: Found 827484 objects to send. (9621 ms)
Receiving objects: 100% (827484/827484), 2.03 GiB | 12.29 MiB/s, done.
Resolving deltas: 100% (381713/381713), done.
BTW, this is about 2.5x faster clone than the x86 emulated Git for Windows ๐ ๐จ
What do you think of my idea of building an ARM64 installer with x86 binaries? It seems like this could create a ramp to convert to native ARM64 step-by-step. Initially the package could contain ARM64 git compiled binaries and dependencies and then move to ARM64 mingw and other utilities once they are avaiable/supported?
Excellent news!
About the x86 binaries... Honestly, I'd like to avoid that, but it would make sense, wouldn't it? That way you have a fully functional Git for Windows, relatively fast in most commands...
x86 emulation on Windows on ARM is quite good; my option is that developers shouldn't shy away from taking advantage of it.
Okay, that makes sense. So to build an ARM64 version of Git for Windows, we would start with a 32-bit Git for Windows SDK, build the ARM64 binaries via MSBuild, install them into the SDK and then bundle the result.
The installer itself is already an x86 executable (so that we can use the same framework for both 32-bit/64-bit).
The only tricky thing for now would be the step where the binaries are copied into the SDK; the command make install should do it, but at the moment it would insist on re-building everything with GCC.
I'm hacking through the various pieces to put something together as proof-of-concept. After spending some time on it yesterday, i think some help understanding how the scripts and utilities in build-extra work might accelerate things. Is there any literature on the shell script methodology or installer tools that are used? Specifically i'm working on how the script is discovering what binaries to copy into the install package as i need to add some new ones, but generally in order to turn this into something more then just a hack, i think i need more details.
Update: i've hacked up several files in the installation to build an appropriate installer and i have things basically working now from what i can tell. I ran my installer on my ARM64 Windows laptop and was able to clone a repo using the ARM64 git. The changes i've made to the installer are a mess though. Current state:
make install invokes msbuild (this can easily be parameterized)make install installs more things (e.g. vcruntime140.dll and other libraries that have new names)release.sh scriptinstaller\release.sh script invokes the mingw installed git which won't work since its ARM64 now.make install is wrong and instead the script should grab binaries from another location?Pretty happy with where things are for a Friday afternoon!
@manbearian excellent progress!
FWIW I think the best way to address these things would be to hack something related to make-file-list.sh in build-extra: this is the script that determines what files to include in the installer/portable Git/MinGit.
There are already customizations in that script with regards to MinGit, and we can easily add more.
Having said that, my personal preference would be to build a mingw-w64-arm64-git. This package would, however, violate a couple rules: it would install into /mingw32/... even if ARM64 is everything but i686.
The way we build this package is via makepkg-mingw in /usr/src/MINGW-packages/mingw-w64-git (which is tracked here).
To build the -arm64- package, I would suggest adding an optional package (much like we allow skipping the -pdb package). It would probably make most sense to piggy-back that on top of the i686 build (i.e. make it dependent on an environment variable like TARGET_ARM64 _and_ on CARCH). When building the -arm64- package, we should probable not build _any_ other package, i.e. override pkgname.
Finally, it would be _really_ awesome if we could build the binaries via make MSVC=1 (with a further variable to specify to target the ARM64 architecture, of course). That would make it the easiest to build this package, as we would not require all kinds of dances to figure out where MSBuild happens to be on the current machine.
Btw, i reached out to mingw folks last week about ARM64 support and i haven't gotten any response yet. Do you have any contacts there?
Btw, i reached out to mingw folks last week about ARM64 support and i haven't gotten any response yet. Do you have any contacts there?
You mean, mingw-w64? (The MINGW project is pretty much dead in the water for all I know, and definitely stuck with i686-only.)
Sadly, I do not have any contacts there.
Having said that, I do see that there is ARM64-related activity: https://sourceforge.net/p/mingw-w64/mailman/search/?q=arm64&mail_list=mingw-w64-public
The next step would be to get an ARM64 version of MSYS2 ;-) (This is a _huge_ task...)
That search seems to be poorly implemented. The query "arm64" returns 17k results, most of them don't seem to mention "arm64". The query "arm" seems more useful with 730 results that actually seem to mention "arm" (and most even "arm64"). My guess is that they interpret "arm64" as "arm" or "64".
My guess is that they interpret "arm64" as "arm" or "64".
Hmm, I missed that. My first hit was on a patch that mentioned ARM64 if I remember correctly.
Hi,
Are there any updates on this? Would Clang natively running on Arm64 Windows help?
Since Visual Studio Code is now running natively on Arm64, Git for Windows on Arm would be a very welcome addition ๐
Would Clang natively running on Arm64 Windows help?
Not really. At the moment this is about compiling for arm64. Compiling on arm64 would be a step after that.
Now the PR is merged, can we expect it an ARM64 binary will be released with next version/build?
Unlikely. There's still a lot to do for the first arm64 release and the next release is probably in about 2 weeks.
Now the PR is merged, can we expect it an ARM64 binary will be released with next version/build?
@tommyvct I have to admit that the tone of this almost-demand rubs me in all the wrong ways. You may not have meant to sound like it, but it sure comes over as if you considered this a thing other people do for you and all you have to do exactly nothing but sit back. Comments like this make me want to stop spending _any_ time on that project. It is very demotivating.
Now the PR is merged, can we expect it an ARM64 binary will be released with next version/build?
@tommyvct I have to admit that the tone of this almost-demand rubs me in all the wrong ways. You may not have meant to sound like it, but it sure comes over as if you considered this a thing other people do for you and all you have to do exactly nothing but sit back. Comments like this make me want to stop spending _any_ time on that project. It is very demotivating.
I'm sorry if my tone was not appropriate.
You see that this issue has been inactive for 5 months, and I just want to have an update on the situation as an outsider, and potentially what I can do.
I feel sorry that your comments also sounds demotivating. You may not in a good mood, but Christmas is fast approaching, why not take a break?
Merry Christmas ๐
@dscho While I totally understand and also feel that the coronavirus situation is getting on all of us and hence there is a lot of frustration in the air, I'm pretty sure @tommyvct didn't mean anything wrong and is probably just not a native English speaker. Me too, btw, so please keep this in mind ๐
In any case, I believe we are all very supportive of you and this project. I personally am fully open to support your efforts as much as I can, whether by providing my Surface Pro X as a build/test ground, picking up some tasks (please let me know what exactly needs to be done there), or donating to the project.
Please stay safe and try to still have fun in these dark times! We're all in the same boat โ
@Alovchin91 thank you for providing a bit of motivation again. Much appreciated.
I'd very much appreciate an ARM64 native build of the git tools when working on my Surface Pro X. The emulation using the x86 binaries works for basic usage, but it fails with high-demand scenarios. For example, git lfs filtering fails when trying to fetch a 1 GB binary...
git clone https://github.com/walbourn/directxtexmedia.git
Can't wait for git to run natively on windows 10 on ARM, would love to help but I really have no clue :(
~@walbourn That's indeed a git-lfs bug. You may wanna create an issue over there.~
Issue created. Don't forget to subscribe.
~Meanwhile you can try build the thing to arm64 to see if that helps.~
~I tried. The official go compiler cannot make windows arm64 binaries.~
I tried again. The official go compiler CAN make windows arm binaries, but it still crashes for your case.
I tried 386 binary in a virtual machine and it still crashes. Strangely x64 binary didn't.
Let me try to summarize our progress here. The main goal currently is to create an arm64 package that has the mingw32 binaries in it (32-bit emulation, things like bash/curl/etc.), which significantly speeds up our progress for now. The only exception to this is git.exe (and related binaries) itself, which can be compiled for arm64 natively now. This already shows a ~2x speed improvement over the emulated 32-bit version ๐
Steps to get to a first arm64 release (again, mostly with mingw32 binaries) - please correct me if I'm missing something:
/etc/profile https://github.com/git-for-windows/git-sdk-32/pull/6/etc/profile in git-extra.install.in https://github.com/git-for-windows/build-extra/pull/321git-wrapper in mingw32 to use the native git.exe, set MSYSTEM=ARM64, etc. https://github.com/git-for-windows/MINGW-packages/pull/44Here's a rough first arm64 version for anyone who wants to try: https://github.com/dennisameling/git/releases/tag/2.30.0-beta2
- Add ARM64 to
/etc/profilegit-for-windows/git-sdk-32#6 and git-for-windows/git-sdk-64#32
Sounds good, we only have to do that in the post-install part of the git-extra package defined in build-extra, as I mentioned here.
- Modify
git-wrapperinmingw32to use the nativegit.exe, setMSYSTEM=ARM64, etc. git-for-windows/MINGW-packages#44
Right. I still hope that you can get an i686 version of git-wrapper.exe to determine whether it is really running in Windows/ARM64.
That should be possible to determine using IsWow64Process2().
That should be possible to determine using IsWow64Process2().
Heh, I just added this suggestion 15 minutes ago: https://github.com/git-for-windows/MINGW-packages/pull/44#discussion_r553960109
According to this blog post from 2017 it should work, but we might need to be careful on Windows 10 prior to 1709.
We might be able to get by with just using it via compat/win32/lazyload.h which we should do either way to avoid breaking the x86 build for Windows versions below 10.
Good idea, thanks for sharing! Will check it now
It works with IsWow64Process2()!! ๐ Just tested with my simple demo C++ project.
x86/i686 executable on ARM64 device:

x86/i686 executable on x64 device:

I'll spend some time this weekend to see how I can incorporate this in the git-wrapper.c together with lazy loading, to prevent issues with Windows versions lower than Windows 10 1709. To be continued ๐
According to this blog post from 2017 it should work, but we might need to be careful on Windows 10 prior to 1709.
We might be able to get by with just using it viacompat/win32/lazyload.hwhich we should do either way to avoid breaking the x86 build for Windows versions below 10.
Well, we're talking about the Git wrapper here, so it would need to do its own LoadLibraryExW() thing instead of using the niceties of lazyload.h.
git-wrapper.c is part of mingw-w64-git and the PKGBUILD file lists git-for-windows/git as part of its sources, so shouldn't we be able to just do #include "compat/win32/lazyload.h" in git-wrapper.c?
Got it to work (including on Windows 8.1, haven't tested Win7) in https://github.com/git-for-windows/MINGW-packages/pull/44 ๐
git-wrapper.cis part ofmingw-w64-gitand thePKGBUILDfile lists git-for-windows/git as part of its sources, so shouldn't we be able to just do#include "compat/win32/lazyload.h"ingit-wrapper.c?
So far, git-wrapper.c does not include _anything_ from Git's source code, to avoid having to link libgit.a.
I suppose that lazyload.h does not require libgit.a to be linked in, but it sure muddies the water if we allow _that_ header to be #included but no other of Git's header files.
I would've liked the internal consistency of doing this kind of dynamic function loading the same way throughout the Git for Windows code base, but I see your point.
Seems like Dennis already picked the loading implementation from the blog post anyways.
Update: we're making great progress. I was able to create a PortableGit installer for ARM64, you can try it out here: https://github.com/dennisameling/git/releases/tag/2.30.0-beta2 ๐
To see an overview of open PRs for the ARM64 work please see this comment.
Here's how it works:
This is basically a mingw32 build, but with some logic to recognize if the user is running on an ARM64 device. If they are, it will look first in an additional directory called arm64, which has some native binaries in it like git.exe. This is what will give you the ~2x speed boost in commands like git clone. Other binaries like curl aren't available natively for ARM64 yet, so Git Bash will fallback to mingw32 for those binaries.
So it first looks in /arm64 (1) and if the binary is not available there, falls back to /mingw32 (2):

Here you can see that it indeed uses Git from /arm64/bin/git:

We're getting very close everyone! Exciting times ๐
@dennisameling seems like that release was removed, any word on it?
@KritantaDev sorry, I had to re-fork this repo. Just uploaded the beta release again on the same URL, could you please try again now? ๐
Most helpful comment
Update: we're making great progress. I was able to create a
PortableGitinstaller for ARM64, you can try it out here: https://github.com/dennisameling/git/releases/tag/2.30.0-beta2 ๐To see an overview of open PRs for the ARM64 work please see this comment.
Here's how it works:
This is basically a
mingw32build, but with some logic to recognize if the user is running on an ARM64 device. If they are, it will look first in an additional directory calledarm64, which has some native binaries in it likegit.exe. This is what will give you the ~2x speed boost in commands likegit clone. Other binaries likecurlaren't available natively for ARM64 yet, so Git Bash will fallback tomingw32for those binaries.So it first looks in
/arm64(1) and if the binary is not available there, falls back to/mingw32(2):Here you can see that it indeed uses Git from
/arm64/bin/git:We're getting very close everyone! Exciting times ๐