Home My Page Projects MPFR
Summary Activity Forums Tracker Lists Tasks Docs News SCM Files

[#10810] dependency rule of mparam.h is broken

2010-08-01 18:22
Submitted by:
Vincent Lefèvre (vlefevre)
Assigned to:
Nobody (None)
Target Version:
dependency rule of mparam.h is broken

Detailed description
mparam.h depends on mparam_h.in, but under some occasions, after modifying mparam_h.in, mparam.h is not rebuilt or it is rebuilt at the same time of the compilation of some file depending on it (instead of strictly before).

A way to reproduce the first problem: Just after unarchiving the tarball, run:

$ ./configure
$ touch mparam_h.in
$ make

From the timestamps, one can see that mparam.h hasn't been regenerated. However if one runs "make clean", then "make" again, mparam.h is regenerated.

On another machine with 2 processors and where "make" is a shell function that runs "make -j2", after adding "foo" to mparam_h.in, running make, removing "foo" (thus correcting mparam_h.in), then running make again fails:

ble:...ftware/mpfr-trunk> make
Making all in tests
make[1]: Entering directory `/home/vlefevre/software/mpfr-trunk/tests'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/vlefevre/software/mpfr-trunk/tests'
make[1]: Entering directory `/home/vlefevre/software/mpfr-trunk'
cd . && /bin/sh ./config.status mparam.h
/bin/sh ./libtool --tag=CC --mode=compile gcc-4.1 -std=gnu99 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_STDINT_H=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_DENORMS=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DLT_OBJDIR=\".libs/\" -DHAVE_ATTRIBUTE_MODE=1 -I. -Wall -Wmissing-prototypes -Wpointer-arith -m32 -O2 -pedantic -fomit-frame-pointer -mtune=pentium4 -march=pentium4 -ffloat-store -MT get_str.lo -MD -MP -MF .deps/get_str.Tpo -c -o get_str.lo get_str.c
libtool: compile: gcc-4.1 -std=gnu99 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_STDINT_H=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_DENORMS=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DLT_OBJDIR=\".libs/\" -DHAVE_ATTRIBUTE_MODE=1 -I. -Wall -Wmissing-prototypes -Wpointer-arith -m32 -O2 -pedantic -fomit-frame-pointer -mtune=pentium4 -march=pentium4 -ffloat-store -MT get_str.lo -MD -MP -MF .deps/get_str.Tpo -c get_str.c -fPIC -DPIC -o .libs/get_str.o
In file included from /usr/include/locale.h:30,
from mpfr-impl.h:1065,
from get_str.c:25:
/usr/include/bits/locale.h:27: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'enum'
make[1]: *** [get_str.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
config.status: creating mparam.h
make[1]: Leaving directory `/home/vlefevre/software/mpfr-trunk'
make: *** [all-recursive] Error 1
zsh: exit 2

Look at the position of
cd . && /bin/sh ./config.status mparam.h
config.status: creating mparam.h
in the output. This shows a problem with a parallel make.
Message  ↓
Date: 2010-08-01 19:29
Sender: Vincent Lefèvre

Fixed in r7033 for the trunk and in r7034 for the 3.0 branch by adding

BUILT_SOURCES = mparam.h

to Makefile.am.

Date: 2010-08-01 19:11
Sender: Vincent Lefèvre

Actually the second problem seems to be a consequence of the first one: I did the test before a "make" was complete. So, after unarchiving the tarball, if one does configure, make, but interrupts make with a Ctrl-C, modifies mparam_h.in, then runs make again, then mparam.h is rebuilt, but at the same time as C files that haven't been compiled yet.

I've looked at the .deps directory: just after configure, all the .Plo files just contain a line "# dummy". After a complete make, the .Plo files get filled in with dependencies, and they remain correct after "make clean". So, the fact that everything works after a complete "make" is just an indirect consequence of these .Plo files as they contain "mparam.h:". But in any case, one shouldn't rely on that.

Field Old Value Date By
status_idOpen2010-08-01 19:29vlefevre
close_date2010-08-01 19:292010-08-01 19:29vlefevre
ResolutionNone2010-08-01 19:29vlefevre