threads / patch / 44835

patchMakefile: put LIBS after LDFLAGS for imap-send

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

## tl;dr

9 messages between Jan 8, 2017 and Jan 9, 2017. Diffs are folded; open one to read it.

replies: 8people: 3as markdown or json

Steven Penny· Jan 8, 2017, 06:12 UTC · lore

This matches up with the targets git-%, git-http-fetch, git-http-push and git-remote-testsvn. It must be done this way on Windows else lcrypto cannot find lgdi32 and lws2_32

Signed-off-by: Steven Penny <svnpenn@gmail.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to Makefile +1 −1
diff --git a/Makefile b/Makefile
index d861bd9..f0f65ea 100644
--- a/Makefile
+++ b/Makefile
@@ -2046,7 +2046,7 @@ git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
 
 git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
-		$(LIBS) $(IMAP_SEND_LDFLAGS)
+		$(IMAP_SEND_LDFLAGS) $(LIBS)
 
 git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
-- 
2.8.3
Johannes Schindelin· Jan 8, 2017, 11:54 UTC · re: Steven Penny · lore

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

Hi Steven,
On Sun, 8 Jan 2017, Steven Penny wrote:
> This matches up with the targets git-%, git-http-fetch, git-http-push
> and git-remote-testsvn. It must be done this way on Windows else lcrypto
> cannot find lgdi32 and lws2_32

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. This hints at a difference of build environment (I use the Git for Windows SDK) that needs to be mentioned in the commit message.

Ciao, Johannes

Steven Penny· Jan 8, 2017, 15:12 UTC · re: Johannes Schindelin · lore

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

On Sun, Jan 8, 2017 at 5:54 AM, Johannes Schindelin wrote:
> 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. This is certainly possible but definitely not considered in the current Git codebase. I have a patch to config.mak.uname coming as well.

Johannes Schindelin· Jan 8, 2017, 18:54 UTC · re: Steven Penny · lore

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

Hi Steven,
On Sun, 8 Jan 2017, Steven Penny wrote:
Show 6 quoted lines
> On Sun, Jan 8, 2017 at 5:54 AM, Johannes Schindelin wrote:
> > 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...

Ciao, Johannes

Junio C Hamano· Jan 9, 2017, 03:07 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 14 quoted lines
> Hi Steven,
>
> On Sun, 8 Jan 2017, Steven Penny wrote:
>
>> On Sun, Jan 8, 2017 at 5:54 AM, Johannes Schindelin wrote:
>> > 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.
Johannes Schindelin· Jan 9, 2017, 10:49 UTC · re: Junio C Hamano · lore

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

Hi Junio,
On Sun, 8 Jan 2017, Junio C Hamano wrote:
Show 21 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Sun, 8 Jan 2017, Steven Penny wrote:
> >
> >> On Sun, Jan 8, 2017 at 5:54 AM, Johannes Schindelin wrote:
> >> > 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

Junio C Hamano· Jan 9, 2017, 14:23 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 7 quoted lines
> ...
> 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
Thanks, will queue on my side, too.
Junio C Hamano· Jan 9, 2017, 14:27 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 7 quoted lines
> 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

Hmm, I peeked it hoping that you corrected the log message along the lines of your <alpine.DEB.2.20.1701081953330.3469@virtualbox>, but it appears that what you queued does not have any extra mention of cygwin or specifics of the buildchain on top of what Steven posted?

Junio C Hamano· Jan 9, 2017, 14:31 UTC · re: Junio C Hamano · lore

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

Junio C Hamano <gitster@pobox.com> writes:
Show 14 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> 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
>
> Hmm, I peeked it hoping that you corrected the log message along the
> lines of your <alpine.DEB.2.20.1701081953330.3469@virtualbox>, but
> it appears that what you queued does not have any extra mention of
> cygwin or specifics of the buildchain on top of what Steven posted?

Ah, false alarm. It does have s/Windows/Cygwin/; I trust your judgement that that change makes the context clear enough for those involved in Git for Windows, msysGit and Cygwin port.

Will queue it together with the other one from Steven.
Thanks.

← back to recent threads