threads / discuss / 57819

git not compiling under MSYS2

Subject: git not compiling under MSYS2

## tl;dr

3 messages between Apr 29, 2022 and Jul 26, 2022.

replies: 2people: 3as markdown or json

Jack Adrian Zappa· Apr 29, 2022, 18:40 UTC · lore
Hi all,

I just installed MSYS2, cloned the git repo from https://github.com/git/git and then tried to build from the "MSYS2 MinGW Clang x64" prompt. Of course this was a clean MSYS2 install, so I had to first install for myself vim, git to download the repo and for the build: make and gcc. However, after running the make command, I'm still getting errors:

------------->8------------->8------------->8------------->8------------->8------------->8------------->8-------------
$ make
make: curl-config: No such file or directory
    CC fuzz-commit-graph.o
In file included from git-compat-util.h:219,
                 from commit-graph.h:4,
                 from fuzz-commit-graph.c:1:
compat/win32/dirent.h:13:21: error: ‘MAX_PATH’ undeclared here (not in
a function); did you mean ‘O_PATH’?
   13 |         char d_name[MAX_PATH * 3]; /* file name (* 3 for UTF-8
conversion) */
      |                     ^~~~~~~~
      |                     O_PATH
In file included from commit-graph.h:4,
                 from fuzz-commit-graph.c:1:
git-compat-util.h:329: warning: "basename" redefined
  329 | #define basename gitbasename
      |
In file included from git-compat-util.h:209,
                 from commit-graph.h:4,
                 from fuzz-commit-graph.c:1:
/usr/include/string.h:171: note: this is the location of the previous definition
  171 | # define basename basename
      |
In file included from commit-graph.h:4,
                 from fuzz-commit-graph.c:1:
git-compat-util.h:336:10: fatal error: iconv.h: No such file or directory
  336 | #include <iconv.h>
      |          ^~~~~~~~~
compilation terminated.
make: *** [Makefile:2569: fuzz-commit-graph.o] Error 1
-------------8<-------------8<-------------8<-------------8<-------------8<-------------8<-------------8<-------------
Anyone have any idea why it's not building?
Thanks,
A
Carlo Marcelo Arenas Belón· Apr 29, 2022, 20:31 UTC · re: Jack Adrian Zappa · lore

Re: git not compiling under MSYS2

On Fri, Apr 29, 2022 at 02:40:14PM -0400, Jack Adrian Zappa wrote:
> Anyone have any idea why it's not building?
because the codebase doesn't support that environment yet AFAIK.

I'd been successful building git in windows with MinGW64 gcc (both 64 and 32 bit), Visual Studio's cl and even the clang that comes as an option in that last one (which uses the clang-cl interface)

If you want to build it in an MSYS2 like environment the best option is to use the Git for Windows SDK[1] which AFAIK is based on one of the MSYS2 variants (most likely the one with gcc and the old crt)

Carlo
[1] https://github.com/git-for-windows/build-extra/releases/tag/git-sdk-1.0.8
Johannes Schindelin· Jul 26, 2022, 21:59 UTC · re: Jack Adrian Zappa · lore

Re: git not compiling under MSYS2

Hi Jack,
On Fri, 29 Apr 2022, Jack Adrian Zappa wrote:
Show 20 quoted lines
> I just installed MSYS2, cloned the git repo from
> https://github.com/git/git and then tried to build from the "MSYS2
> MinGW Clang x64" prompt.  Of course this was a clean MSYS2 install, so
> I had to first install for myself vim, git to download the repo and
> for the build: make and gcc.  However, after running the make command,
> I'm still getting errors:
>
> ------------->8------------->8------------->8------------->8------------->8------------->8------------->8-------------
> $ make
> make: curl-config: No such file or directory
>     CC fuzz-commit-graph.o
> In file included from git-compat-util.h:219,
>                  from commit-graph.h:4,
>                  from fuzz-commit-graph.c:1:
> compat/win32/dirent.h:13:21: error: ‘MAX_PATH’ undeclared here (not in
> a function); did you mean ‘O_PATH’?
>    13 |         char d_name[MAX_PATH * 3]; /* file name (* 3 for UTF-8
> conversion) */
>       |                     ^~~~~~~~
>       |                     O_PATH

You most likely installed the `gcc` package, but that would produce an MSYS version of Git, while you are clearly interested in the MINGW version. Therefore, you should probably install `mingw-w64-x86_64-gcc`.

To verify that you have the correct `gcc`, run `which gcc`. If it prints `/usr/bin/git`, you are still stuck with the MSYS variant, what you want is `/mingw64/bin/git` to be printed.

Ciao, Johannes

Show 27 quoted lines
> In file included from commit-graph.h:4,
>                  from fuzz-commit-graph.c:1:
> git-compat-util.h:329: warning: "basename" redefined
>   329 | #define basename gitbasename
>       |
> In file included from git-compat-util.h:209,
>                  from commit-graph.h:4,
>                  from fuzz-commit-graph.c:1:
> /usr/include/string.h:171: note: this is the location of the previous definition
>   171 | # define basename basename
>       |
> In file included from commit-graph.h:4,
>                  from fuzz-commit-graph.c:1:
> git-compat-util.h:336:10: fatal error: iconv.h: No such file or directory
>   336 | #include <iconv.h>
>       |          ^~~~~~~~~
> compilation terminated.
> make: *** [Makefile:2569: fuzz-commit-graph.o] Error 1
> -------------8<-------------8<-------------8<-------------8<-------------8<-------------8<-------------8<-------------
>
> Anyone have any idea why it's not building?
>
> Thanks,
>
>
> A
>

← back to recent threads