Re: gmake and ccache conspiring together in creating gremlins

Dmitry Goncharov via Bug reports and discussion for GNU make <[email protected]> Mon, 8 Feb 2021 12:59:07 -0500
Newsgroups gmane.comp.gnu.make.bugs,gmane.comp.compilers.ccache
Message-ID <CAG+Z0CsDPosfFpCHCr8k0OuXmp=J7Bd6YFRFD87_TrqNBVNadQ@mail.gmail.com>
On Mon, Feb 8, 2021 at 12:51 PM Dmitry Goncharov
<[email protected]> wrote:
>
> On Mon, Feb 8, 2021 at 12:36 PM Edward Welbourne <[email protected]> wrote:
> > Sounds to me like that's a bug: when the descriptors are closed, the
> > part of MAKEFLAGS that claims they're make's jobserver file descriptors
> > should be removed, since that's when the claim stops being true.
>
> make uses posix_spawn by default to create children.
> posix_spawn makes it difficult to modify env per child.
> As a workaround the user can have the recipe remove (or modify) MAKEFLAGS
> E.g.
>
> %.o: %.c ; unset MAKEFLAGS && $(CC)  $(CFLAGS) -o $@ -c $<

Oops. Forgot that posix_spawn takes an envp parameter.
Yes, worth fixing.

regards, Dmitry