git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Does Git build things during 'make install"?

From
Johannes Sixt <j6t@kdbg.org>
Date
Oct 16, 2017, 17:13 UTC
Message-ID
<446559c7-364a-fb33-905a-74b487900d3b@kdbg.org>
In-Reply-To
<xmqq60bfsdpj.fsf@gitster.mtv.corp.google.com>
Am 16.10.2017 um 10:23 schrieb Junio C Hamano:
Show 18 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> 
>> Yes, running "sudo make install" is a nightmare. sudo clears the path,
>> and the git command is not found by the make invoked with root
>> permissions. This changes the version string that gets compiled into
>> the executable, which finally triggers a complete rebuild under
>> root. Sad...
> 
> In the meantime, would it help to intall as yourself under DESTDIR
> set to where you can write into, and then limit the potential
> damange done while pretending to be a privileged user to "cp -R" (or
> "tar cf" in $DESTDIR piped to "tar xf" in /)?
> 
> It appears that some dependencies are screwed up around "perl"
> related things, which may want to get fixed.  I agree that "make &&
> make install" that runs two 'make' under the same environment and
> user shouldn't (re)build anything during the latter 'make', but we
> somehow seem to do so.

We do so only, if 'make install' does not run in the same environment and if there is no version file.

I use the patch below. It works for me, but I could imagine that it suffers from the original problem if there is no git in PATH and there is no version file, i.e., when the source is not a release tarball.

----- 8< -----
Subject: [PATCH] version-gen: Use just built git if no other git is in PATH
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 GIT-VERSION-GEN | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 0e88e23653..b610aa3249 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -3,6 +3,9 @@
 GVF=GIT-VERSION-FILE
 DEF_VER=v2.15.0-rc1
 
+# use git that was just compiled if there is no git elsewhere in PATH
+PATH=$PATH:.
+
 LF='
 '
 
-- 
2.14.2.808.g3bc32f2729
Previous: Junio C Hamano
Message 4 of 4 in “Does Git build things during 'make install"?”
  1. Jeffrey WaltonOct 16, 2017
  2. Johannes SixtOct 16, 2017
  3. Junio C HamanoOct 16, 2017
  4. Johannes SixtOct 16, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.