All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Juergen Gross <jgross@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: Automatic dependencies are out of sync
Date: Thu, 06 Sep 2018 02:10:06 -0600	[thread overview]
Message-ID: <5B90E0DE02000078001E5D5A@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <1d0308da-86e8-46bc-d201-1a5f104075bb@suse.com>

>>> On 06.09.18 at 09:34, <jgross@suse.com> wrote:
> On 05/09/18 16:05, Juergen Gross wrote:
>> I think we have a major problem in our build system regarding
>> automatic dependencies.
>> 
>> Starting with a new tree (after git clone or make clean) I have
>> no dependency files (*.d2) anywhere:
>> 
>> $ make clean
>> $ find . -name '*.d2' | wc -l
>> 0
>> 
>> Doing "make" will produce only some of them in a very limited number of
>> directories:
>> 
>> $ make
>> $ find . -name '*.d2' | wc -l
>> 279
>> $ find . -name '*.d2' | xargs -n 1 dirname | sort -u
>> ./tools/firmware/xen-dir/xen-root/xen/arch/x86
>> ./tools/firmware/xen-dir/xen-root/xen/arch/x86/x86_64
>> ./tools/firmware/xen-dir/xen-root/xen/common
>> ./tools/firmware/xen-dir/xen-root/xen/common/compat
>> ./xen/arch/x86
>> ./xen/arch/x86/x86_64
>> ./xen/common
>> ./xen/common/compat
>> 
>> And only after the next "make" we have all of the *.d2 files available:
>> 
>> $ make
>> $ find . -name '*.d2' | wc -l
>> 969
>> 
>> I guess the reason for that is that the *.d2 files only depend on the
>> *.d files which are built together with the *.o files. They are not
>> needed for building the product files, so they seem to be always one
>> make step behind.
>> 
>> Now comes the weird part (that's why I started to look into this):
>> When I now do:
>> 
>> $ touch tools/libxc/include/xenctrl.h
>> $ make
>> 
>> I get build failures in tools/tests/depriv (lots of unknown types like
>> uint64_t). The .d file in the depriv directory suddenly contains only
>> 7 instead of 44 entries, while the .d2 file is still okay (it is one
>> make "older", do you remember?):
>> 
>> $ wc .*.d*
>>    7   14  546 .depriv-fd-checker.d
>>   44   88 1923 .depriv-fd-checker.d2
>> 
>> And doing another make will succeed again, but now both dependency files
>> are cut down to 7 entries (sure they are: .d2 is rebuilt from .d, while
>> .d would only be rebuilt if .o is being built, which isn't happening as
>> no file it depends on has changed):
>> 
>> $ make
>> $ wc .*.d*
>>   7  14 546 .depriv-fd-checker.d
>>   7  14 336 .depriv-fd-checker.d2
>> 
>> I have no immediate idea how to solve that.
> 
> I've setup a little example Makefile solving the problem (just to show
> the correct dependencies, needs to be adapted for naming the .d and .d2
> files and how to build the .d2):
> 
> -->8 snip here 8<--
> 
> DEPS := tst.d2
> 
> all: tst $(DEPS)

-include $(DEPS) already ought to have the effect of such a dependency,
since all makefiles are checked for rules of how to re-make them.

> %.d2: %.d
>         cp $< $@

Such a rule already exists in ./Config.mk.

> %.o %.d: %.c
>         gcc -MMD -o $(patsubst %.c,%.o,$<) -c $<

Doesn't this result in gcc to be invoked twice, perhaps resulting in
corrupt .o and/or .d? I think %.d wants to depend on %.o, without
a command.

> %: %.o
>         gcc $< -o $@
> 
> -include $(DEPS)
> 
> -->8 snip here 8<--
> 
> So the basic ideas are:
> 
> - add a rule for constructing the .d files
> - let the build depend on the .d2 files

IOW I wonder whether this really is any different from what we
do now (minus bugs/quirks in make itself, of course). And from this
as well as your original mail I still don't understand what's actually
broken with the current approach.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-09-06  8:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05 14:05 Automatic dependencies are out of sync Juergen Gross
2018-09-06  7:34 ` Juergen Gross
2018-09-06  8:10   ` Jan Beulich [this message]
     [not found]   ` <5B90E0DE02000078001E5D5A@suse.com>
2018-09-06  8:27     ` Juergen Gross
2018-09-06 10:26       ` Jan Beulich
     [not found]     ` <02463da8-eeff-f254-b8c2-5c1e?= =?UTF-8?Q?5b96ab53@suse.com>
2018-09-06  8:39       ` Andrew Cooper
     [not found]     ` <02463da8-eeff-f?= =?UTF-8?Q?254-b8c2-5c1e5b96ab53@suse.com>
     [not found]       ` <5B9100F302000078001E5E17@suse.co?= =?UTF-8?Q?m>
2018-09-06 12:21         ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B90E0DE02000078001E5D5A@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.