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

Add Windows compilation instructions #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Mikulas
Copy link

@Mikulas Mikulas commented May 1, 2016

Hi, I've successfully built both the most recent version and the latest stable tag with those minor updates to the Makefile.

If you are willing to merge this, should I also update the make install task?


Instructions:

- Download and install 32bit OpenSSL development binaries (the full ~16BM
Copy link
Contributor

Choose a reason for hiding this comment

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

BM? Maybe make this MB and --fixup before merge ;-)

@AGWA
Copy link
Owner

AGWA commented May 1, 2016

Thanks for working on this! I would definitely like to see better Windows support in git-crypt. However, I think we'd be better off targeting MinGW-w64/MSYS2, considering that it is more actively developed than MinGW/MSYS, and Git itself has switched to it. Also, MSYS2 has the Pacman package manager, so people could install OpenSSL from it instead of having to download a sketchy binary from a third party website.

Would you be able to update the instructions and Makefile for MinGW-w64?

@Mikulas
Copy link
Author

Mikulas commented May 4, 2016

Thank you! Turns out msys2 is the best thing ever, who knew :)

I've updated the instructions. No changes to the Makefile are needed now and even the make install step works, assuming git is installed through the msys2 layer.

This make the binary redistributable without additional dependencies.
@Mikulas
Copy link
Author

Mikulas commented May 4, 2016

The resulting binary was not executable on systems without the compilation requirements. Assuming most users will compile and redistribute, I've modified the makefile to link statically. This obviously produces slightly larger binary (from 350KB to 5MB), but is executable as-is on vanilla Windows.

@Mikulas Mikulas changed the title Add Windows support to make Add Windows compilation instructions May 4, 2016
@Mikulas
Copy link
Author

Mikulas commented May 30, 2016

Hi, any thoughts on this rewrite? :)

@tomkooij
Copy link

tomkooij commented Apr 3, 2017

This works on the current MSYS2.

I did have to link against zlib as well:

Install zlib-devel

pacman -S zlib-devel

Add -lz to LDFLAGS:

diff --git a/Makefile b/Makefile
index 1cb8e8c..be5a445 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ OBJFILES += crypto-openssl.o

 ifeq ($(OS),Windows_NT)
        CXXFLAGS += -static -static-libgcc
-       LDFLAGS += -lcrypto -lgdi32
+       LDFLAGS += -lcrypto -lgdi32 -ldl -lz
 else
        LDFLAGS += -lcrypto
 endif

@rmeharg
Copy link

rmeharg commented Oct 5, 2017

This pull request with documentation has been very useful for building the windows binary. We have successfully followed the instructions to compile a Windows release.

A note on the comment by @tomkooij :
Do not use the -ldl flag as the binary will have dynamic libraries, meaning it cannot be executed outside of MSYS. By removing this flag we were able to run the .exe within Terminal/PowerShell/Cygwin/MSYS etc.

@tehmaestro
Copy link

I was just looking into this and I would suggest using the Windows Subsystem for Linux, aka WSL aka bash for Windows. I've managed to successfully build and use git-crypt. Thank you!

@chanukov
Copy link

chanukov commented Nov 2, 2017

This is failing for me.

$ make && make install
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o git-crypt.o git-crypt.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o commands.o commands.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o crypto.o crypto.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o gpg.o gpg.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o key.o key.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o util.o util.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o parse_options.o parse_options.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o coprocess.o coprocess.cpp
g++ -Wall -pedantic -Wno-long-long -O2 -static -static-libgcc   -c -o fhstream.o fhstream.cpp
make: *** No rule to make target 'crypto-openssl.o', needed by 'git-crypt'.  Stop.

Any ideas?

@joost-de-vries
Copy link

joost-de-vries commented Jun 8, 2019

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.

8 participants