{"thread":{"id":"4828","subject":"[PATCH] Fix linking for not-so-clever linkers.","startedAt":"2006-07-10T11:40:44Z","lastAt":"2006-07-10T23:01:07Z","messageCount":5,"participants":["Johannes Schindelin","Junio C Hamano","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23537","messageId":"Pine.LNX.4.63.0607101340080.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4828","inReplyTo":null,"subject":"[PATCH] Fix linking for not-so-clever linkers.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-10T11:40:44Z","receivedAt":"2006-07-10T11:40:44Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nOn one of my systems, the linker is not intelligent enough to link with\npager.o (in libgit.a) when only the variable pager_in_use is needed. The\nconsequence is that the linker complains about an undefined variable. So,\nput the variable into environment.o, where it is linked always.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n environment.c |    1 +\n pager.c       |    2 --\n 2 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/environment.c b/environment.c\nindex 43823ff..97d42b1 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -21,6 +21,7 @@ char git_commit_encoding[MAX_ENCODING_LE\n int shared_repository = PERM_UMASK;\n const char *apply_default_whitespace = NULL;\n int zlib_compression_level = Z_DEFAULT_COMPRESSION;\n+int pager_in_use;\n \n static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,\n \t*git_graft_file;\ndiff --git a/pager.c b/pager.c\nindex bb14e99..280f57f 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -5,8 +5,6 @@ #include \"cache.h\"\n  * something different on Windows, for example.\n  */\n \n-int pager_in_use;\n-\n static void run_pager(const char *pager)\n {\n \texeclp(pager, pager, NULL);\n-- \n1.4.1.g6e33b-dirty\n"},{"id":"23582","messageId":"7v64i5b1am.fsf@assigned-by-dhcp.cox.net","threadId":"4828","inReplyTo":"Pine.LNX.4.63.0607101340080.29667@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Fix linking for not-so-clever linkers.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-10T21:25:05Z","receivedAt":"2006-07-10T21:25:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On one of my systems, the linker is not intelligent enough to link with\n> pager.o (in libgit.a) when only the variable pager_in_use is needed. The\n> consequence is that the linker complains about an undefined\n> variable.\n\nI do not understand this quite yet -- which executable is your\nlinker building when it does this?\n\nMaybe we need ranlib?\n"},{"id":"23584","messageId":"Pine.LNX.4.64.0607101429460.5623@g5.osdl.org","threadId":"4828","inReplyTo":"7v64i5b1am.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix linking for not-so-clever linkers.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-07-10T21:34:42Z","receivedAt":"2006-07-10T21:34:42Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 10 Jul 2006, Junio C Hamano wrote:\n>\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On one of my systems, the linker is not intelligent enough to link with\n> > pager.o (in libgit.a) when only the variable pager_in_use is needed. The\n> > consequence is that the linker complains about an undefined\n> > variable.\n> \n> I do not understand this quite yet -- which executable is your\n> linker building when it does this?\n> \n> Maybe we need ranlib?\n\nShouldn't be needed, since we use \"$(AR) rcs\", where that \"s\" should do \nthe equivalent of the old-fashioned \"ranlib\" call.\n\nHowever, that said, I think Johannes' patch is worth applying regardless, \nsince it's kind of sad to link in pager.o just because of a variable that \nends up never mattering (ie any program that uses \"diff.c\" but isn't \nbuilt-in).\n\nOf course, once/if everything is built-in, this doesn't matter, but in the \nmeantime this isn't the first time we've re-organized things so that you \ndon't have to link in files that you don't need. After all, that was the \nwhole reason environment.c ended up existing in the first place..\n\n\t\t\tLinus\n"},{"id":"23588","messageId":"7vlkr19lmr.fsf@assigned-by-dhcp.cox.net","threadId":"4828","inReplyTo":"Pine.LNX.4.64.0607101429460.5623@g5.osdl.org","subject":"Re: [PATCH] Fix linking for not-so-clever linkers.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-10T21:48:44Z","receivedAt":"2006-07-10T21:48:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> On Mon, 10 Jul 2006, Junio C Hamano wrote:\n>>\n>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> \n>> > On one of my systems, the linker is not intelligent enough to link with\n>> > pager.o (in libgit.a) when only the variable pager_in_use is needed. The\n>> > consequence is that the linker complains about an undefined\n>> > variable.\n>> \n>> I do not understand this quite yet -- which executable is your\n>> linker building when it does this?\n\n>> Maybe we need ranlib?\n>\n> Shouldn't be needed, since we use \"$(AR) rcs\",...\n> ... After all, that was the \n> whole reason environment.c ended up existing in the first place..\n\nUnderstood and agreed to everything you said.\n\nBut I still wonder why/how it happens in Johannes's\nenvironment...\n"},{"id":"23592","messageId":"Pine.LNX.4.63.0607110059020.29667@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4828","inReplyTo":"7v64i5b1am.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Fix linking for not-so-clever linkers.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-07-10T23:01:07Z","receivedAt":"2006-07-10T23:01:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 10 Jul 2006, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On one of my systems, the linker is not intelligent enough to link with\n> > pager.o (in libgit.a) when only the variable pager_in_use is needed. The\n> > consequence is that the linker complains about an undefined\n> > variable.\n> \n> I do not understand this quite yet -- which executable is your\n> linker building when it does this?\n\nThe problem arises for the first time with git-blame. (Have not checked \nwhich other executables might be affected.)\n\n> Maybe we need ranlib?\n\nDoes not help. pager.o is in libgit.a. Still, Darwin's linker does not \nwant to link to pager.o (probably because no function from pager.o is \ncalled, so this is a real bug in the Darwin linker -- but being easy to \nfix, I think it is worthwhile to fix it).\n\nCiao,\nDscho\n"}]}