-
Notifications
You must be signed in to change notification settings - Fork 319
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
Build on Windows using MSYS2 #307
base: next
Are you sure you want to change the base?
Conversation
Similar to Unix, this allows running 'make install' from a MinGW shell on Windows, installed using MSYS2. Prerequisites: - Install MSYS2 from http://msys2.github.io and follow the instructions on that page - Install MinGW as explained here http://stackoverflow.com/a/30071634/1104534 - In addition to 'mingw-w64-x86_64-gcc', you'll also need the following: $ pacman -S make mingw-w64-x86_64-cmake mingw-w64-x86_64-pkg-config Build libgit2 and git2go: - Open the "MinGW-w64 Win64 Shell" (or 32-bit) and run 'make install' from the root of git2go. 'git2go.a' should install in 'GOPATH\pkg\windows_amd64\github.com\libgit2'. When building your app, you'll need gcc available in your PATH, so you might want to add 'C:\msys64\mingw64\bin' to the PATH.
I get the following error:
I think the reason is that go build does no escape spaces on Windows paths properly. |
You safe my day! I had to install MSYS2 from scratch to compile it. Otherwise catch different strange errors |
The only difference between these seems to be the generator. I'd rather see that part be part of common code and then add the different args in whichever conditional is appropriate. |
Indeed the only change is the generator, however it took me a while to figure out all the bits and pieces to be able to compile it on Windows. Also this PR includes the details on how to prepare the MSYS2 environment. I would suggest we either use this change, or at least add the instructions somewhere in the README so it's easier for anyone to find it, and maybe change the file to accept a generator given as arg in cli. |
Hoping this might help others. Took me a good amount of time to get this to work with the master branch. I'm pretty happy with the process. It is little kludgy for a Go build. I wasn't able to vendor git2go like other go packages. Take a look at the |
hmm, I get another error when trying to run
In short: It is successfully compiling a static libgit2.a binary and is not able to build the wrapper afterwards. The error code is 2. |
The windows build is working again for this project https://github.com/git-time-metric/gtm. Review the appveyor.yml, .travis.yml and scripts directory for how to. |
Similar to Unix, this allows running
make install
from a MinGW shellon Windows, installed using MSYS2.
Prerequisites:
on that page
pacman -S make mingw-w64-x86_64-cmake mingw-w64-x86_64-pkg-config
Build libgit2 and git2go:
make install
from the root of git2go. 'git2go.a' should install in
'GOPATH\pkg\windows_amd64\github.com\libgit2'.
When building your app, you'll need gcc available in your PATH,
so you might want to add 'C:\msys64\mingw64\bin' to the PATH.