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

Re: A flaw in dep generation with gcc -MMD?

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 18, 2011, 21:16 UTC
Message-ID
<20111118211645.GA27440@elie.hsd1.il.comcast.net>
In-Reply-To
<loom.20111118T191851-152@post.gmane.org>
Hi,
(restoring cc list.  Unfortunately gmane's web interface doesn't
 provide a built-in way to reply-to-all.  [1] has a hackish
 workaround.)
Samuel Bronson wrote:
> Nguyen Thai Ngoc Duy writes:
Show 5 quoted lines
>> "gcc -MF depfile -MMD -MP -c -o path/to/file.o" will produce "depfile"
>> with target given by "-o". When ccache runs, it executes "gcc -MF
>> depfile -MMD -MP -E" instead to get the final content for hashing.
>> Notice that "-c -o" combination is replaced by "-E". The latter
>> produces target without leading path.
[...]
> I'm pretty sure you should report this against ccache; GCC seems to be
> behaving as documented.
Seems to have been fixed by v3.0pre0~187:
 commit e8354384
 Author: Andrea Bittau <a.bittau@cs.ucl.ac.uk>
 Date:   Sun Nov 1 19:39:58 2009 +0100
     Fix handling of the -MD and -MDD options
     From <http://lists.samba.org/archive/ccache/2007q2/000272.html>:
     The -MD and -MDD options automatically determine where the dependency file
     should land and what the target should look like based on the -o option.
     However, ccache drops -o and things mess up. The original patch was posted by
     Kaz Kylheku but I reworked it to make it work properly. Here is his post:
     http://lists.samba.org/archive/ccache/2006q4/000249.html
Workaround incoming in a few moments.

Thanks, Jonathan

Previous: Samuel BronsonNext: Andreas Schwab
Message 8 of 19 in “A flaw in dep generation with gcc -MMD?”
  1. Nguyen Thai Ngoc DuyNov 18, 2011
  2. Jonathan NiederNov 18, 2011
  3. Nguyen Thai Ngoc DuyNov 18, 2011
  4. Miles BaderNov 18, 2011
  5. Nguyen Thai Ngoc DuyNov 18, 2011
  6. Nguyen Thai Ngoc DuyNov 18, 2011
  7. Samuel BronsonNov 18, 2011
  8. Jonathan NiederNov 18, 2011
  9. Andreas SchwabNov 18, 2011
  10. Nguyen Thai Ngoc DuyNov 19, 2011
  11. Makefile: add option to disable automatic dependency generationJonathan Nieder, Nov 18, 2011
  12. Jonathan NiederNov 18, 2011
  13. Junio C HamanoNov 18, 2011
  14. Jonathan NiederNov 18, 2011
  15. Makefile: add option to disable automatic dependency generationJonathan Nieder, Nov 18, 2011
  16. Makefile: add missing header file dependenciesJonathan Nieder, Nov 18, 2011
  17. Nguyen Thai Ngoc DuyNov 18, 2011
  18. Makefile: explicitly set target name for autogenerated dependenciesJonathan Nieder, Nov 18, 2011
  19. Nguyen Thai Ngoc DuyNov 19, 2011

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.