problem building git for windows from sdk

190 views
Skip to first unread message

Stepan Kasal

unread,
Apr 25, 2017, 3:13:17 PM4/25/17
to git-for...@googlegroups.com
Hello,
I have installed git for windows sdk from the web and tried to build it.

The build ended with a link bug; see below.

Could you please help me with debugging that?

I have tried various pacman -S libiconv; pacman -Su; pacman -S libiconv-devel
but I still do not understand pacman and its dependencies, I'm afraid.

Hints or pointers to doc welcome.

Stepan Kasal

$ make
LINK git-credential-store
libgit.a(utf8.o): In function `reencode_string_iconv':
/usr/src/git/utf8.c:463: undefined reference to `libiconv'
/usr/src/git/utf8.c:463:(.text+0xf77): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `libiconv'
libgit.a(utf8.o): In function `reencode_string_len':
/usr/src/git/utf8.c:524: undefined reference to `libiconv_open'
/usr/src/git/utf8.c:524:(.text+0xff1): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `libiconv_open'
/usr/src/git/utf8.c:535: undefined reference to `libiconv_close'
/usr/src/git/utf8.c:535:(.text+0x1018): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `libiconv_close'
/usr/src/git/utf8.c:529: undefined reference to `libiconv_open'
/usr/src/git/utf8.c:529:(.text+0x104a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `libiconv_open'
collect2: error: ld returned 1 exit status
make: *** [Makefile:2061: git-credential-store] Error 1

Johannes Schindelin

unread,
Apr 25, 2017, 5:12:55 PM4/25/17
to Stepan Kasal, git-for...@googlegroups.com
Hi Stepan,

On Mon, 24 Apr 2017, Stepan Kasal wrote:

> I have installed git for windows sdk from the web and tried to build it.

Nobody found the time yet to update the home page, but we do have a more
convenient way to install the SDK now:

git clone https://github.com/git-for-windows/git-sdk-64

> $ make
> LINK git-credential-store
> libgit.a(utf8.o): In function `reencode_string_iconv':
> /usr/src/git/utf8.c:463: undefined reference to `libiconv'
> /usr/src/git/utf8.c:463:(.text+0xf77): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `libiconv'

I think you need to call `pacman -Sy mingw-w64-x86_64-libiconv` to fix
this. Git itself is a MINGW program, hence it requires mingw-w64-*
dependencies (the libiconv you installed is an MSYS2 one, i.e. linking to
the MSYS2 runtime for transparent POSIX emulation).

Ciao,
Johannes

Stepan Kasal

unread,
Apr 26, 2017, 5:07:16 AM4/26/17
to git-for...@googlegroups.com
Hello Johannes,
thank you for your reply.

[Sorry that I repeated my question on the main Git list; it looked like
google groups list manager have not received my message for 24 hours.]

On Tuesday, 25 April 2017 23:12:55 UTC+2, Johannes Schindelin wrote:
> I think you need to call `pacman -Sy mingw-w64-x86_64-libiconv` to fix
> this. Git itself is a MINGW program, hence it requires mingw-w64-*
> dependencies (the libiconv you installed is an MSYS2 one, i.e. linking to
> the MSYS2 runtime for transparent POSIX emulation).

That package was ok, so the pacman command did not help.

But the rest of the explanation has inspired me to guess the solution:
I used "msys2.exe" to get my shell window.
It is important to start "git-bash.exe" instead.

Within git-bash.exe, "make build" and "make install" works ok.

> Nobody found the time yet to update the home page, but we do have a more
> convenient way to install the SDK now:
>
> git clone https://github.com/git-for-windows/git-sdk-64

Actually, my instance of git-sdk-64 was created very conveniently:
IIRC, I just ran the SDK installer linked from the bottom of the home page.

Yet I decided to try this new method, but I'm lost.
In my previous git-sdk, the installer created 4 git clones under /usr/src.
How shall I get them?
And is that all that is needed to get the SDK to a state equivalent to
the full setup provided by the installer?

Cheers,
Stepan Kasal

Stepan Kasal

unread,
Apr 26, 2017, 5:22:41 AM4/26/17
to git-for...@googlegroups.com
Hello,
sorry to adding to my own msg:

On Wed, Apr 26, 2017 at 11:07:14AM +0200, Stepan Kasal wrote:
> But the rest of the explanation has inspired me to guess the solution:
> I used "msys2.exe" to get my shell window.
> It is important to start "git-bash.exe" instead.

just if anyone is interested:
I tried to build git using the SDK, and use it instad of the relesed
"Git for Windows"

Instead, I ended up using MSYS2 git, experiencing various problems
(the recent bug about push to a share, core.eol defaulting to lf).

Realizing that, I have run "pacman -R git-flow git".
Hope things will be ok.

Stepan Kasal

Johannes Schindelin

unread,
Apr 26, 2017, 7:14:49 AM4/26/17
to Stepan Kasal, git-for...@googlegroups.com
Hi Stepan,


On Wed, 26 Apr 2017, Stepan Kasal wrote:

> [Sorry that I repeated my question on the main Git list; it looked like
> google groups list manager have not received my message for 24 hours.]

Yes, that list manager is also me. These days, I frequently get to read
new emails only toward the end of the day, addressing older mails before
that.

> On Tuesday, 25 April 2017 23:12:55 UTC+2, Johannes Schindelin wrote:
> > I think you need to call `pacman -Sy mingw-w64-x86_64-libiconv` to fix
> > this. Git itself is a MINGW program, hence it requires mingw-w64-*
> > dependencies (the libiconv you installed is an MSYS2 one, i.e. linking
> > to the MSYS2 runtime for transparent POSIX emulation).
>
> That package was ok, so the pacman command did not help.
>
> But the rest of the explanation has inspired me to guess the solution:
> I used "msys2.exe" to get my shell window.
> It is important to start "git-bash.exe" instead.

Yes, msys2.exe is the wrong thing to start. If anything, you would want to
start mingw64.exe.

> > Nobody found the time yet to update the home page, but we do have a more
> > convenient way to install the SDK now:
> >
> > git clone https://github.com/git-for-windows/git-sdk-64
>
> Actually, my instance of git-sdk-64 was created very conveniently:
> IIRC, I just ran the SDK installer linked from the bottom of the home page.

Yes, but it takes ages to initialize, and it hammers MSYS2's repository,
which is sometimes down.

> Yet I decided to try this new method, but I'm lost.
> In my previous git-sdk, the installer created 4 git clones under /usr/src.
> How shall I get them?

Manually :-P

Seriously again, this is part of the problems that need to be addressed
before the home page can be changed. Help would be very welcome.

> And is that all that is needed to get the SDK to a state equivalent to
> the full setup provided by the installer?

I guess it would make sense to have some code in /etc/profile.d/git-sdk.sh
to test whether any of the
/usr/src/{MINGW-packages,MSYS2-packages,build-extra,git} directories needs
to be initialized.

The code to be patched lives here:

https://github.com/git-for-windows/build-extra/blob/master/git-extra/git-sdk.sh

A Pull Request to fix this would be really nice.

Ciao,
Johannes
Reply all
Reply to author
Forward
0 new messages