Alan Conway <[EMAIL PROTECTED]> wrote:
> 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.
Right. That's what triggers the ltmain misbehavior I mentioned.
That script really should be immune to such abuse.
> This can be avoided simply by
> removing the dependency check: $(check_LTLIBRARIES) in Makefile.am
> With that change (just comitted) parallel builds work fine.
Great!
If more people build regularly with -j2 or more, (or even an autobuilder),
then any future regression will be exposed right away.
> 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:
Automake's rule ensures that the following are built in order:
all-am
check_LTLIBRARIES
check-TESTS
> check-am: check-TESTS
> check-TESTS: $(TESTS) $(check_LTLIBRARIES)
Doing it this way would mistakenly let some of the latter rules
run before the all-am ones, when run via make -jN.