Re: gmake and ccache conspiring together in creating gremlins
Sam Varshavchik via ccache <[email protected]> Sun, 7 Feb 2021 10:45:20 -0500
| Newsgroups | gmane.comp.compilers.ccache |
|---|---|
| Message-ID | <CAMO9iftVztLc+dvkB3unQoBqXLy2RQT+NbccK-pzC8E4fkr5yw@mail.gmail.com> |
On Sun, Feb 7, 2021 at 7:59 AM Joel Rosdahl <[email protected]> wrote: > From my perspective, I don't see anything wrong with ccache dup-ing stderr – I > guess the bug can be triggered by the user running something like > > exec 3>&2 > > in the shell as well. > > I can think of an easy workaround for the problem: only dup2 stderr when running > the preprocessor or compiler. Done in > <https://github.com/ccache/ccache/commit/c4284c78e9ff286ee5208f449af4c2aaba062d37>. In the interim I discovered a workaround that seems to work, for anyone who's also affected by this. Instead of setting CCACHE_PREFIX to distcc, I pointed CCACHE_PREFIX to this: #! /bin/sh unset MFLAGS ${!MAKE@} exec distcc "$@" This clears make variables from the environment and when the linker invokes make for ...whatever it needs to invoke it for, against a manufactured makefile it generates on the fly... it doesn't go look for the job server file descriptors, and go sideways.