Re: [PATCH] Makefile: put LIBS after LDFLAGS for imap-send

2 messages, 2 authors, 2017-01-09 · open the first message on its own page

Re: [PATCH] Makefile: put LIBS after LDFLAGS for imap-send

From: Junio C Hamano <hidden>
Date: 2017-01-09 03:08:02

Johannes Schindelin [off-list ref] writes:
Hi Steven,

On Sun, 8 Jan 2017, Steven Penny wrote:
quoted
On Sun, Jan 8, 2017 at 5:54 AM, Johannes Schindelin wrote:
quoted
I am curious: how do you build Git? I ask because I build Git on Windows
many times a day, and I did not encounter any link problems.
My end goal is to build static native Windows Git via Cygwin and the
mingw64-x86_64-gcc-core package.
That is certainly a worthy goal, and I would highly recommend to mention
that particular cross-compiling setup in the commit message. It's not like
this is the easiest way to build native Git on Windows...
In addition to the patch being explained well, I also care that it
does not break existing builds.  I do not think it is the case for
you, and I do think the patch does the right thing, but just double
checking to see if you have objections to the change itself.

Thanks.

Re: [PATCH] Makefile: put LIBS after LDFLAGS for imap-send

From: Johannes Schindelin <hidden>
Date: 2017-01-09 10:51:04

Hi Junio,

On Sun, 8 Jan 2017, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
On Sun, 8 Jan 2017, Steven Penny wrote:
quoted
On Sun, Jan 8, 2017 at 5:54 AM, Johannes Schindelin wrote:
quoted
I am curious: how do you build Git? I ask because I build Git on
Windows many times a day, and I did not encounter any link
problems.
My end goal is to build static native Windows Git via Cygwin and the
mingw64-x86_64-gcc-core package.
That is certainly a worthy goal, and I would highly recommend to
mention that particular cross-compiling setup in the commit message.
It's not like this is the easiest way to build native Git on
Windows...
In addition to the patch being explained well, I also care that it
does not break existing builds.  I do not think it is the case for
you, and I do think the patch does the right thing, but just double
checking to see if you have objections to the change itself.
I just double-checked and it still builds fine on Git for Windows (as
expected).

The reason it seems to have worked before, too, is that somehow -lcrypto
does not require gdi32.dll here. As a matter of fact, we do not link with
gdi32 at all:

$ printf 'include Makefile\nprint:\n\t@%s\n\t@%s\n\t@%s\n' \
	'echo all: $(ALL_LDFLAGS)' \
	'echo libs: $(LIBS)' \
	'echo imap: $(IMAP_SEND_LDFLAGS)' |
  make -f - print

all: -Wl,--nxcompat -Wl,--dynamicbase -Wl,--pic-executable,-e,mainCRTStartup
libs: libgit.a xdiff/lib.a git.res -lws2_32 -lntdll -lpcre -lz -liconv -lintl -lcrypto
imap: -lcurl -lssl -lcrypto -lcrypto

It is a bit curious that -lws2_32 *does* only show up in $(LIBS), but I
guess it is simply the fact that we use a newer GCC (gcc.exe (Rev2, Built
by MSYS2 project) 6.2.0) that allows Git for Windows to be built even
without this patch.

In any case, it does not break things, and it helps Cygwin, so: ACK

Ciao,
Dscho

P.S.: I pushed this to Git for Windows' `master`, too:
https://github.com/git-for-windows/git/commit/f05a26948b
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help