[Olsr-dev] [PATCH] fix infinite recursion problem when running make
Sun Nov 4 00:05:36 CET 2007
Bernd Petrovitsch wrote:
> On Sat, 2007-11-03 at 23:00 +0100, Felix Fietkau wrote:
>> Bernd Petrovitsch wrote:
>>> On Sat, 2007-11-03 at 18:00 +0100, Felix Fietkau wrote:
>>>> with certain make versions, running make in the olsr directory loops
>>> Which version(s)? On which OS/systems/...?
>> OpenWrt, Linux, Make 3.81
> Any special options etc. for make there?
Yes, I override CC, AS, and all that stuff for cross compiling and change
the installation directories.
>>>> forever rebuilding a dependency file. This is caused by a bogus .PHONY
>>> That sounds quite strange. Rebuilding it 2 times (or so) may be possible
>>> (due to multiple dependency resolutions) but I doubt that it will last
>>> Any log file?
>> It prints
>> Entering directory <build dir>...
>> Leaving directory <build dir>...
>> in an endless loop.
> Extremely strange, I never saw that anywhere AFAIR (not only for olsrd
> but in my whole life).
> Hmm, `make -d` output is probably enormous (even if you stop quite
Yeah, it is.
> And while I'm at it (and have another `make` guru here;-): There is
> another dependency problem which I couldn't solve yesterday evening.
> How to reproduce:
> - `make clean_all; make build_all` just to build everything.
> - edit oparse.y and `make build_all`
> You will get a compile error afterwards. And you will see that a/the
> default rule is used to create the .c file out of the .y file for the .d
> file generation (and not the one in olsrd-current/src/cfgparser/Makefile).
> Hmmm, I have to add a .SUFFIXES line to reduce the output on `make
> -d` ....
I can't reproduce this.
>> seems to come from the interaction between a build-always rule and the
>> automatic dependency generation. It jumps back and forth between generating
>> the .c and the .d file.
> Well, the .d files are checked and possibly build or rebuild if and only
> if `make` encounters the "include *.d" statement.
> That may trigger the rebuild of every included file once and shouldn't
> do a "make -C " or something.
> Then the contents is include'd.
> And then the "normal" dependency check is done and targets rebuild.
> And if `make` encounters recursive dependencies, they are detected and
> cut (possibly not giving a correct or working solution - PEBKAC, write
> better, unambiguous rules! - but at least avoiding infinite loops).
> So actually while I'm believing you, I have absolutely no idea why this
> could loop forever.
> Yes, in a perfect world, we wouldn't use recursive make but ....
I've had similar issues with make when writing code for the OpenWrt build
system, which also uses GNU make. Most of the time, make is smart enough to
figure this out, but recursive make can very easily confuse it, since
dependencies are re-checked after the $(MAKE) command has run.
What do you think about my patch at http://nbd.name/110-build_fix.patch?
More information about the Olsr-dev