On Wed, 2007-04-11 at 22:49 +0200, Jim Meyering wrote:
> Alan Conway <[EMAIL PROTECTED]> wrote:
> > make -j<N> fails building the c++ tests with an "invalid Foo.lo" error.
> > Anyone have an idea what might be causing it?
> 
> Hi Alan,
> 
> The symptoms look suspiciously like those of the problem I fixed
> back in December:
[snip]
> Since this is rather subtle, I think it's more maintainable
> simply to turn off parallelism in the src/tests/ directory.

I think I've found a better fix. The problem I was seeing involved
double-building of check_LTLIBRARIES. This can be avoided simply by
removing the dependency check: $(check_LTLIBRARIES) in Makefile.am
With that change (just comitted) parallel builds work fine.

The real key to this problem is that Automake generates the following
very strange rule:

check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_LTLIBRARIES)
        $(MAKE) $(AM_MAKEFLAGS) check-TESTS

With the result that there are *two* instances of make running
simultaneously when you make check with -j. As long as they are building
disjoint sets of targets it works, but I can't figure out why on earth
automake would do that instead of:

check-am: check-TESTS
check-TESTS: $(TESTS) $(check_LTLIBRARIES)

This way the problem would not have arisen because make would have full
knowledge of the dependency tree and would resolve multiple declarations
of the same dependencies correctly.

Is there some reason for starting sub-makes like this that I'm missing?
If not can we fix automake to do it right?

In any case we can do parallel builds :) 

Cheers,
Alan.

Reply via email to