{"thread":{"id":"40609","subject":"[PATCH v4 1/1] Makefile: link libcurl before zlib","startedAt":"2015-10-21T17:01:13Z","lastAt":"2015-10-21T19:35:14Z","messageCount":2,"participants":["Remi Pommarel","Jonathan Nieder"],"isPatch":true,"patchVersion":4,"patchTotal":1},"messages":[{"id":"272042","messageId":"1445446873-21294-1-git-send-email-repk@triplefau.lt","threadId":"40609","inReplyTo":null,"subject":"[PATCH v4 1/1] Makefile: link libcurl before zlib","fromName":"Remi Pommarel","fromEmail":"repk@triplefau.lt","sentAt":"2015-10-21T17:01:13Z","receivedAt":"2015-10-21T17:01:13Z","isPatch":true,"sender":{"key":"repk@triplefau.lt","avatar":"https://avatars.githubusercontent.com/u/6833759?v=4"},"body":"For static linking especially library order while linking is important. For\nexample, libcurl wants symbols from zlib when building http-push, http-fetch\nand remote-curl. So for these programs libcurl has to be linked before zlib.\n\nSigned-off-by: Remi Pommarel <repk@triplefau.lt>\n---\nChanges to v3:\n\t- Initialize IMAP_SEND_LDFLAGS so that no environment leak could occur\n\t- Rephrase the description to use zlib example instead of libcurl\n\n Makefile | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 04c2231..8f1fa6c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1036,7 +1036,7 @@ ifdef HAVE_ALLOCA_H\n endif\n \n IMAP_SEND_BUILDDEPS =\n-IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n+IMAP_SEND_LDFLAGS =\n \n ifdef NO_CURL\n \tBASIC_CFLAGS += -DNO_CURL\n@@ -1093,6 +1093,7 @@ else\n \t\tendif\n \tendif\n endif\n+IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n \n ifdef ZLIB_PATH\n \tBASIC_CFLAGS += -I$(ZLIB_PATH)/include\n@@ -1978,10 +1979,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)\n \n git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(LIBS) $(CURL_LIBCURL)\n+\t\t$(CURL_LIBCURL) $(LIBS)\n git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n \n git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \\\n@@ -1995,7 +1996,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n \n $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n \n $(LIB_FILE): $(LIB_OBJS)\n \t$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^\n-- \n2.0.1\n"},{"id":"272051","messageId":"20151021193514.GB7881@google.com","threadId":"40609","inReplyTo":"1445446873-21294-1-git-send-email-repk@triplefau.lt","subject":"Re: [PATCH v4 1/1] Makefile: link libcurl before zlib","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2015-10-21T19:35:14Z","receivedAt":"2015-10-21T19:35:14Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Remi Pommarel wrote:\n\n> Signed-off-by: Remi Pommarel <repk@triplefau.lt>\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n"}]}