5

I am trying to build Git from this repository: git-for-windows, which is supposedly last version of git with windows-specific changes. I am working in MinGw32 environment on Windows.

I have run into the following problem: when I try to build git, I get:

compat/mingw.h:134:25: fatal error: openssl/ssl.h: 
No such file or directory  #include <openssl/ssl.h>

Why is that? I have openssl built an installed from source in the same environment, using make -> make install sequence.
In particular, ssl.h was installed into /usr/local/ssl/include/openssl/ssl.h and /local/ssl/include/openssl/ssl.h.

How can I resolve this problem?

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
Srv19
  • 3,238
  • 5
  • 42
  • 71

5 Answers5

5

Install MSYS2 with MinGW-w64.

Open Mingw64 shell, add the following packages:

$ pacman -Sy mingw64/mingw-w64-x86_64-openssl \
  mingw64/mingw-w64-x86_64-pcre2 \
  mingw64/mingw-w64-x86_64-zlib

Clone and build Git (if you don't have Git yet, you can download a .zip instead)

$ git clone https://github.com/git-for-windows/git.git
$ cd git
$ make
rustyx
  • 73,455
  • 21
  • 176
  • 240
  • This didn't work for me (multiple errors even after adding these packages and others), but the other hand the Git for Windows project now delivers *its own* (MinGW-w64-based) *SDK installer*, which works perfectly, without affecting your existing msys2/mingw-w64 install. – Tao Jun 22 '21 at 13:58
1

Since 2015, you can find a more complete example of Windows build through the new ci (continuous integration) folder and its ci/run-windows-build.sh script (March 2017).

It is used in a .travis.yml, meaning you can delegate the actual build to a remote build environment: travis-ci.org/git/git/builds.
That way, you don't have to worry about your own local workstation having or missing dependencies.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
  • The shell script just does `curl https://git-for-windows-ci.azurewebsites.net/api/TestNow` – rustyx Jul 21 '19 at 11:55
  • @rustyx Yes it does. With, as parameter passed to the URL: `?action=trigger&branch=$BRANCH&commit=$COMMIT&skipTests=false`: that is what trigger the *build*. https://github.com/git/git/blob/dcad9a4c87daa4c90d5504e87973d2d5a5d31ff4/ci/run-windows-build.sh#L55 – VonC Jul 21 '19 at 11:58
  • OP asks how to do that locally, not on azure CI. – rustyx Jul 21 '19 at 12:01
  • @rustyx I agree. That is why I proposed this answer as an *alternative*, and concluded with "That way, you don't have to worry about your own local workstation having or missing dependencies.". Hopefully, that might inspire other readers to consider this possibility. – VonC Jul 21 '19 at 12:05
1

The current answer, as of the project website https://gitforwindows.org/#contribute, is to download the "Git for Windows SDK" from that page.

When you execute the installer it clones the SDK, and opens a "Git for Windows SDK" prompt - something very close to an MINGW64 prompt, as far as I can tell.

then:

sdk cd git
sdk build

And you're set, you have a locally-built git.exe! The SDK installs to C:\git-sdk-64 by default, and the git project gets created in C:\git-sdk-64\usr\src\git.

Tao
  • 12,923
  • 7
  • 63
  • 75
0

Try installing openssl first and then try to build it. Also follow this to get an understanding of your issue(though it is linux specified).

Community
  • 1
  • 1
Abhay Pai
  • 316
  • 4
  • 17
0

Nowadays, it works best with Cygwin. You need to install all the packages it needs or else it will fail the build.

JoelFan
  • 36,115
  • 32
  • 128
  • 201