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

Re: How to build to debug with gdb?

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Aug 28, 2019, 10:32 UTC
Message-ID
<20190828103217.GA6400@szeder.dev>
In-Reply-To
<20190828081557.GA18785@instance-template-2.europe-west6-a.c.vaulted-journal-250706.internal>
On Wed, Aug 28, 2019 at 08:15:57AM +0000, Giuseppe Crino' wrote:
Show 13 quoted lines
> On Tue, Aug 27, 2019 at 08:36:40PM +0200, SZEDER Gábor wrote:
> > Try using the same build flags for the install, i.e.:
> > 
> >   make prefix=/usr/local DEVELOPER=1 CFLAGS="-O0 -g" install
> 
> Yes, now it works thanks!
> 
> On Tue, Aug 27, 2019 at 08:34:23PM +0200, Johannes Sixt wrote:
> > That is because the command sequence above does not do what you think it
> > does. Didn't you notice that everything was recompiled during `sudo make
> > install`?
> 
> Shouldn't be this documented somewhere?

Well, perhaps. But would users actually read it? Dunno.

Case in point: the first few lines of 'INSTALL' already tell you to build and install Git with the following commands:

  $ make prefix=/usr all doc info ;# as yourself
  # make prefix=/usr install install-doc install-html install-info ;# as root

Note the same 'prefix=...' in both commands, yet you omitted it when you ran 'make install' ;)

> To my knowledge `make install` is expected to copy artifacts of the
> build under prefix. It's unusual to me that `install` has the `all`
> target as prerequisite.

I don't think it's unusual at all that the 'install' target depends on 'all'. A quick and incomprehensive survey of Makefiles from a few open source projects that I happen to have lying around seems to confirm this.

What might be unusual (but is rather convenient for developers) is that Git's build process checks the build flags, and rebuilds the whole thing after the flags changed.

Previous: Giuseppe Crino'Next: Giuseppe Crino'
Message 6 of 9 in “How to build to debug with gdb?”
  1. Giuseppe Crino'Aug 27, 2019
  2. Matheus Tavares BernardinoAug 27, 2019
  3. Randall S. BeckerAug 27, 2019
  4. Johannes SixtAug 27, 2019
  5. Giuseppe Crino'Aug 28, 2019
  6. SZEDER GáborAug 28, 2019
  7. Giuseppe Crino'Aug 28, 2019
  8. Giuseppe Crino'Aug 28, 2019
  9. SZEDER GáborAug 27, 2019

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.