Skip to contentSkip to conversation

Makefile: put LIBS after LDFLAGS for imap-send

PATCH In review Steven Penny 3 participants 9 messages Jan 8, 2017 – Jan 9, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: put LIBS after LDFLAGS for imap-send

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

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index d861bd9..f0f65ea 100644
@@ -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,$^) \
Signature · 1 line
2.8.3
#1 lore raw

Hi Steven,

Quoted 3 lines · Steven Penny

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

#2 lore raw
Quoted 2 lines · Johannes Schindelin

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.

#3 lore raw

Hi Steven,

Quoted 6 lines · Steven Penny
Quoted 2 lines · Johannes Schindelin

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

#4 lore raw
Quoted 8 lines · Johannes Schindelin

Hi Steven,

Quoted 4 lines · Steven Penny
Quoted 2 lines · Johannes Schindelin

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.

Quoted 6 lines
Quoted 2 lines

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.

#5 lore raw

Hi Junio,

Quoted 17 lines · Junio C Hamano
Quoted 7 lines · Johannes Schindelin
Quoted 5 lines · Steven Penny
Quoted 3 lines · Johannes Schindelin

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.

Quoted 7 lines
Quoted 2 lines

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...

Quoted 4 lines

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

#6 lore raw
Quoted 7 lines · Johannes Schindelin

...
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.

#7 lore raw
In reply to Johannes Schindelin
Quoted 7 lines · Johannes Schindelin

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?

#8 lore raw
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Johannes Schindelin

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

Ciao,
Dscho

Quoted 7 lines
Quoted 2 lines

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.