tools: Have flex and bison mandatory
PATCH 1/1 tools: Have flex and bison mandatory
Both are already mandatory to build the hypervisor.
This will help avoid cases where the *.y or *.l files are been updated but flex and bison aren't available.
This also remove the way the missing binaries are been handled, with double-column-rules, which might be an issue sometime.
Adding ".SECONDARY:" to avoid "libxlu_cfg_y.c" been deleted by make when building the library, and regenerating the file on the first incremental build.
--- tools/configure | 142 +- tools/configure.ac | 8 +- tools/libs/util/.gitignore | 1 + tools/libs/util/Makefile | 21 +- tools/libs/util/libxlu_cfg_l.c | 2375 ------------------------ tools/libs/util/libxlu_cfg_l.h | 734 -------- tools/libs/util/libxlu_cfg_y.c | 1705 ------------------ tools/libs/util/libxlu_cfg_y.h | 96 - tools/libs/util/libxlu_disk_l.c | 2975 ------------------------------- tools/libs/util/libxlu_disk_l.h | 701 -------- 10 files changed, 60 insertions(+), 8698 deletions(-) create mode 100644 tools/libs/util/.gitignore delete mode 100644 tools/libs/util/libxlu_cfg_l.c delete mode 100644 tools/libs/util/libxlu_cfg_l.h delete mode 100644 tools/libs/util/libxlu_cfg_y.c delete mode 100644 tools/libs/util/libxlu_cfg_y.h delete mode 100644 tools/libs/util/libxlu_disk_l.c delete mode 100644 tools/libs/util/libxlu_disk_l.h
tools/configure +50 -92
@@ -5448,6 +5448,51 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +# Extract the first word of "bison", so it can be a program name with args. +set dummy bison; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_BISON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $BISON in + [\\/]* | ?:[\\/]*) + ac_cv_path_BISON="$BISON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="no" + ;; +esac +fi +BISON=$ac_cv_path_BISON +if test -n "$BISON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5 +$as_echo "$BISON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test x"${BISON}" = x"no" +then + as_fn_error $? "Unable to find bison, please install bison" "$LINENO" 5 +fi # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -5475,6 +5520,7 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX="no" ;; esac fi
@@ -5488,6 +5534,10 @@ $as_echo "no" >&6; } fi +if test x"${FLEX}" = x"no" +then + as_fn_error $? "Unable to find flex, please install flex" "$LINENO" 5 +fi # Extract the first word of "abi-dumper", so it can be a program name with args. set dummy abi-dumper; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -10117,98 +10167,6 @@ else fi -if test "x$pvshim" = "xy"; then : - - # Extract the first word of "bison", so it can be a program name with args. -set dummy bison; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_BISON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $BISON in - [\\/]* | ?:[\\/]*) - ac_cv_path_BISON="$BISON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_BISON" && ac_cv_path_BISON="no" - ;; -esac -fi -BISON=$ac_cv_path_BISON -if test -n "$BISON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5 -$as_echo "$BISON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -if test x"${BISON}" = x"no" -then - as_fn_error $? "Unable to find bison, please install bison" "$LINENO" 5 -fi - -else - - # Extract the first word of "bison", so it can be a program name with args. -set dummy bison; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_BISON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $BISON in - [\\/]* | ?:[\\/]*) - ac_cv_path_BISON="$BISON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_BISON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -BISON=$ac_cv_path_BISON -if test -n "$BISON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5 -$as_echo "$BISON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -fi ax_found=0
tools/configure.ac +2 -6
@@ -298,7 +298,8 @@ AC_ARG_VAR([AWK], [Path to awk tool]) AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL -AC_PATH_PROG([FLEX], [flex]) +AX_PATH_PROG_OR_FAIL([BISON], [bison]) +AX_PATH_PROG_OR_FAIL([FLEX], [flex]) AC_PATH_PROG([ABI_DUMPER], [abi-dumper]) AX_PATH_PROG_OR_FAIL([PERL], [perl]) AX_PATH_PROG_OR_FAIL([AWK], [awk])
@@ -512,11 +513,6 @@ AC_ARG_ENABLE([pvshim], esac ]) AC_SUBST(pvshim) -AS_IF([test "x$pvshim" = "xy"], [ - AX_PATH_PROG_OR_FAIL([BISON], [bison]) -], [ - AC_PATH_PROG([BISON], [bison]) -]) AX_FIND_HEADER([INCLUDE_ENDIAN_H], [endian.h sys/endian.h])
tools/libs/util/.gitignore new file +1 -0
@@ -0,0 +1 @@ +/libxlu_*_[ly].[ch]
tools/libs/util/Makefile +7 -14
@@ -16,18 +16,6 @@ CFLAGS += $(CFLAGS_libxenctrl) CFLAGS += $(PTHREAD_CFLAGS) LDFLAGS += $(PTHREAD_LDFLAGS) -ifeq ($(FLEX),) -%.c %.h:: %.l - $(warning Flex is needed to rebuild some libxl parsers and \ - scanners, please install it and rerun configure) -endif - -ifeq ($(BISON),) -%.c %.h:: %.y - $(warning Bison is needed to rebuild some libxl parsers and \ - scanners, please install it and rerun configure) -endif - AUTOINCS = libxlu_cfg_y.h libxlu_cfg_l.h libxlu_disk_l.h LIBHEADER := libxlutil.h
@@ -40,10 +28,15 @@ include $(XEN_ROOT)/tools/libs/libs.mk $(OBJS-y) $(PIC_OBJS): $(AUTOINCS) -%.c %.h:: %.y +%.c %.h: %.y @rm -f $*.[ch] $(BISON) --output=$*.c $< -%.c %.h:: %.l +%.c %.h: %.l @rm -f $*.[ch] $(FLEX) --header-file=$*.h --outfile=$*.c $< + +clean:: + $(RM) libxlu_*_[ly].[ch] + +.SECONDARY:
tools/libs/util/libxlu_cfg_l.c deleted +0 -2375
2,375 lines not on this page · raw message
tools/libs/util/libxlu_cfg_l.h deleted +0 -734
403 lines not on this page · raw message
tools/libs/util/libxlu_cfg_y.c deleted +0 -1705
1,705 lines not on this page · raw message
tools/libs/util/libxlu_cfg_y.h deleted +0 -96
96 lines not on this page · raw message
tools/libs/util/libxlu_disk_l.c deleted +0 -2975
2,975 lines not on this page · raw message
tools/libs/util/libxlu_disk_l.h deleted +0 -701
701 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
Anthony PERARD
Part of the diff is not shown here. View the raw message.
Quoted 1 line · Anthony PERARD
Both are already mandatory to build the hypervisor.
I'm not sure this is sufficient as a justification. From all we can tell even pretty old tool versions are okay for kconfig's purposes. However, pretty recently I've learned that some linker script language construct used for GNU ld runs into a bug in certain (old) versions of flex. Use of that construct will then cause an (almost?) infinite loop in ld. Therefore the question is whether libxlu's uses are immune to such issues (along the lines of kconfig apparently being).
That said - I'm happy about the change in principle; if so desired we could simply see if anyone ever runs into an issue, and revert if need be. Nevertheless I'm not convinced it'll address the problem Andrew had noticed in CI (and where the consideration to remove the generated files originated). It is likely to mask the issue in CI (simply because, aiui, there are no incremental builds done there), but that won't prevent people running into it on other occasions.
Quoted 2 lines
This will help avoid cases where the *.y or *.l files are been updated but flex and bison aren't available.
This is odd: How will this "help"? Right now the build ought to fail (it doesn't, there's merely a warning, which might be easily missed). With your change configure will fail when the tools aren't there.
Quoted 2 lines
This also remove the way the missing binaries are been handled, with double-column-rules, which might be an issue sometime.
These double-colon rules should never have been introduced. Double colons have a different meaning ("terminal rule") for pattern rules. In fact they were my initial suspects when looking into that odd build failure in CI.
Quoted 3 lines
Adding ".SECONDARY:" to avoid "
libxlu_cfg_y.c" been deleted by make when building the library, and regenerating the file on the first incremental build.
While probably okay here, I'd still like to ask: Are you sure you don't want to specify the files we care about, rather than applying it to everything (by leaving blank the right side of the colon)?
Jan
Quoted 11 lines · Jan Beulich
Quoted 1 line · Anthony PERARD
Both are already mandatory to build the hypervisor.
I'm not sure this is sufficient as a justification. From all we can tell even pretty old tool versions are okay for kconfig's purposes. However, pretty recently I've learned that some linker script language construct used for GNU ld runs into a bug in certain (old) versions of flex. Use of that construct will then cause an (almost?) infinite loop in ld. Therefore the question is whether libxlu's uses are immune to such issues (along the lines of kconfig apparently being).
Quoted 4 lines
That said - I'm happy about the change in principle; if so desired we could simply see if anyone ever runs into an issue, and revert if need be. Nevertheless I'm not convinced it'll address the problem Andrew had noticed in CI (and where the consideration to remove the generated
Indeed, it won't fix the issue.
Quoted 11 lines
files originated). It is likely to mask the issue in CI (simply because, aiui, there are no incremental builds done there), but that won't prevent people running into it on other occasions.
Quoted 2 lines
This will help avoid cases where the *.y or *.l files are been updated but flex and bison aren't available.
This is odd: How will this "help"? Right now the build ought to fail (it doesn't, there's merely a warning, which might be easily missed). With your change configure will fail when the tools aren't there.
The scenario I was thinking about is when someone edit the *.l source file, and try to rebuild without flex been installed. It might take sometime to find-out that the reason change aren't taken into account is because flex is missing. At least there's a warning, but it is buried within the rest of the build log.
Quoted 7 lines
Quoted 2 lines
This also remove the way the missing binaries are been handled, with double-column-rules, which might be an issue sometime.
These double-colon rules should never have been introduced. Double colons have a different meaning ("terminal rule") for pattern rules. In fact they were my initial suspects when looking into that odd build failure in CI.
After some more investigation, I don't think anymore the double-colon rules here is an issue.
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.h newer than libxlu_cfg_l.l newer than libxlu_cfg_l.c
Then make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.h is newer than libxlu_cfg_l.l
-> libxlu_cfg_l.h is up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.c is older than libxlu_cfg_l.l
-> we need to generate libxlu_cfg_l.c first
Then, libxlu_cfg_y.o fails to build because libxlu_cfg_l.h is been updated do to the parallel build of libxlu_cfg_l.o.
I can easily reproduce the issue with:
touch libxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touch libxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, between rm and flex.
I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.
Quoted 7 lines
Quoted 3 lines
Adding ".SECONDARY:" to avoid "
libxlu_cfg_y.c" been deleted by make when building the library, and regenerating the file on the first incremental build.While probably okay here, I'd still like to ask: Are you sure you don't want to specify the files we care about, rather than applying it to everything (by leaving blank the right side of the colon)?
I guess it would be better to specify each targets.
Thanks,
Signature · 1 line
Anthony PERARD
Quoted 31 lines · Anthony PERARD
Quoted 8 lines · Jan Beulich
Quoted 2 lines · Anthony PERARD
This also remove the way the missing binaries are been handled, with double-column-rules, which might be an issue sometime.
These double-colon rules should never have been introduced. Double colons have a different meaning ("terminal rule") for pattern rules. In fact they were my initial suspects when looking into that odd build failure in CI.
After some more investigation, I don't think anymore the double-colon rules here is an issue.
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.hnewer than libxlu_cfg_l.l newer thanlibxlu_cfg_l.cThen make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.his newer than libxlu_cfg_l.l
->libxlu_cfg_l.his up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.cis older than libxlu_cfg_l.l
-> we need to generatelibxlu_cfg_l.cfirst
Then, libxlu_cfg_y.o fails to build becauselibxlu_cfg_l.his been updated do to the parallel build of libxlu_cfg_l.o.
Quoted 8 lines
I can easily reproduce the issue with:
touchlibxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touchlibxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, betweenrmandflex.I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.
Might this be solved with:
%.c: %.l | %.h
I'm unsure whether order-only dependencies are GNU-make only (there is a good chance). There is also the option of using .PRECIOUS
Signature · 4 lines
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | [email protected] PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
Quoted 41 lines · Elliott Mitchell
Quoted 31 lines · Anthony PERARD
Quoted 8 lines · Jan Beulich
Quoted 2 lines · Anthony PERARD
This also remove the way the missing binaries are been handled, with double-column-rules, which might be an issue sometime.
These double-colon rules should never have been introduced. Double colons have a different meaning ("terminal rule") for pattern rules. In fact they were my initial suspects when looking into that odd build failure in CI.
After some more investigation, I don't think anymore the double-colon rules here is an issue.
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.hnewer than libxlu_cfg_l.l newer thanlibxlu_cfg_l.cThen make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.his newer than libxlu_cfg_l.l
->libxlu_cfg_l.his up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.cis older than libxlu_cfg_l.l
-> we need to generatelibxlu_cfg_l.cfirst
Then, libxlu_cfg_y.o fails to build becauselibxlu_cfg_l.his been updated do to the parallel build of libxlu_cfg_l.o.Quoted 8 lines
I can easily reproduce the issue with:
touchlibxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touchlibxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, betweenrmandflex.I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.
Quoted 6 lines
Might this be solved with:
%.c: %.l | %.h
I'm unsure whether order-only dependencies are GNU-make only (there is a good chance). There is also the option of using .PRECIOUS
Then upon more reading wouldn't:
%_y.c: | %_l.c
Accomplish the job? (assuming GNU-make or everyone has copied that feature)
Signature · 4 lines
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | [email protected] PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
Quoted 31 lines · Anthony PERARD
Quoted 11 lines · Jan Beulich
Quoted 1 line · Anthony PERARD
Both are already mandatory to build the hypervisor.
I'm not sure this is sufficient as a justification. From all we can tell even pretty old tool versions are okay for kconfig's purposes. However, pretty recently I've learned that some linker script language construct used for GNU ld runs into a bug in certain (old) versions of flex. Use of that construct will then cause an (almost?) infinite loop in ld. Therefore the question is whether libxlu's uses are immune to such issues (along the lines of kconfig apparently being).
Quoted 4 lines
That said - I'm happy about the change in principle; if so desired we could simply see if anyone ever runs into an issue, and revert if need be. Nevertheless I'm not convinced it'll address the problem Andrew had noticed in CI (and where the consideration to remove the generated
Indeed, it won't fix the issue.
Quoted 11 lines
files originated). It is likely to mask the issue in CI (simply because, aiui, there are no incremental builds done there), but that won't prevent people running into it on other occasions.
Quoted 2 lines
This will help avoid cases where the *.y or *.l files are been updated but flex and bison aren't available.
This is odd: How will this "help"? Right now the build ought to fail (it doesn't, there's merely a warning, which might be easily missed). With your change configure will fail when the tools aren't there.
Quoted 5 lines
The scenario I was thinking about is when someone edit the *.l source file, and try to rebuild without flex been installed. It might take sometime to find-out that the reason change aren't taken into account is because flex is missing. At least there's a warning, but it is buried within the rest of the build log.
Right, as said - imo this should be (have been) an error. In that sense your change of course helps because it makes the issue more apparent.
Quoted 29 lines
Quoted 7 lines
Quoted 2 lines
This also remove the way the missing binaries are been handled, with double-column-rules, which might be an issue sometime.
These double-colon rules should never have been introduced. Double colons have a different meaning ("terminal rule") for pattern rules. In fact they were my initial suspects when looking into that odd build failure in CI.
After some more investigation, I don't think anymore the double-colon rules here is an issue.
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.hnewer than libxlu_cfg_l.l newer thanlibxlu_cfg_l.cThen make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.his newer than libxlu_cfg_l.l
->libxlu_cfg_l.his up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.cis older than libxlu_cfg_l.l
-> we need to generatelibxlu_cfg_l.cfirst
Then, libxlu_cfg_y.o fails to build becauselibxlu_cfg_l.his been updated do to the parallel build of libxlu_cfg_l.o.
Quoted 4 lines
I can easily reproduce the issue with:
touchlibxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touchlibxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, betweenrmandflex.
Interesting. In my somewhat similar experiments I found that an issue exists only when one of the .c files is missing. Things looked to work properly when both were there, but one was outdated. Clearly that's yet more surprising behavior than, as you appear to observe, the issue simply being tied too "needs updating".
Quoted 3 lines
I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.
Well, in my tests while 4.4 has fixed one issue with intermediate files affecting the behavior here, the issue we're possibly running into is still there. I've sent an inquiry to [email protected].
Jan
Quoted 25 lines · Jan Beulich
Quoted 19 lines · Anthony PERARD
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.hnewer than libxlu_cfg_l.l newer thanlibxlu_cfg_l.cThen make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.his newer than libxlu_cfg_l.l
->libxlu_cfg_l.his up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.cis older than libxlu_cfg_l.l
-> we need to generatelibxlu_cfg_l.cfirst
Then, libxlu_cfg_y.o fails to build becauselibxlu_cfg_l.his been updated do to the parallel build of libxlu_cfg_l.o.Quoted 4 lines
I can easily reproduce the issue with:
touchlibxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touchlibxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, betweenrmandflex.
Quoted 5 lines
Interesting. In my somewhat similar experiments I found that an issue exists only when one of the .c files is missing. Things looked to work properly when both were there, but one was outdated. Clearly that's yet more surprising behavior than, as you appear to observe, the issue simply being tied too "needs updating".
The actual problem is flex and bison output both files at the same time. One process sees all of its prerequisites are up to do and therefore proceeds to the next step. A second process sees an out of date prerequisite, and starts to run flex which wipes out the prerequisite of the first process.
Crucially libxlu_cfg_y.o does NOT depend on libxlu_cfg_l.c, therefore GNU Make is allowed to proceed with building libxlu_cfg_y.o even if libxlu_cfg_l.c is out of date.
The problem is the rule to update libxlu_cfg_l.c ALSO updates libxlu_cfg_l.h as a side-effect.
As such libxlu_cfg_y.o needs an order-only dependency (assuming GNU Make syntax is allowed) on libxlu_cfg_l.c, so the two rules DON'T run in parallel and cause havoc.
Quoted 7 lines
Quoted 3 lines
I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.Well, in my tests while 4.4 has fixed one issue with intermediate files affecting the behavior here, the issue we're possibly running into is still there. I've sent an inquiry to [email protected].
I do not believe this is a bug in GNU Make. Merely double-output rules cause precisely this sort of trouble in Make when run in parallel.
Signature · 4 lines
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | [email protected] PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
Quoted 43 lines · Elliott Mitchell
Quoted 25 lines · Jan Beulich
Quoted 19 lines · Anthony PERARD
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.hnewer than libxlu_cfg_l.l newer thanlibxlu_cfg_l.cThen make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.his newer than libxlu_cfg_l.l
->libxlu_cfg_l.his up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.cis older than libxlu_cfg_l.l
-> we need to generatelibxlu_cfg_l.cfirst
Then, libxlu_cfg_y.o fails to build becauselibxlu_cfg_l.his been updated do to the parallel build of libxlu_cfg_l.o.Quoted 4 lines
I can easily reproduce the issue with:
touchlibxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touchlibxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, betweenrmandflex.Quoted 5 lines
Interesting. In my somewhat similar experiments I found that an issue exists only when one of the .c files is missing. Things looked to work properly when both were there, but one was outdated. Clearly that's yet more surprising behavior than, as you appear to observe, the issue simply being tied too "needs updating".
The actual problem is flex and bison output both files at the same time. One process sees all of its prerequisites are up to do and therefore proceeds to the next step. A second process sees an out of date prerequisite, and starts to run flex which wipes out the prerequisite of the first process.
Crucially libxlu_cfg_y.o does NOT depend on
libxlu_cfg_l.c, therefore GNU Make is allowed to proceed with building libxlu_cfg_y.o even iflibxlu_cfg_l.cis out of date.
Quoted 7 lines
The problem is the rule to update
libxlu_cfg_l.cALSO updateslibxlu_cfg_l.has a side-effect.As such libxlu_cfg_y.o needs an order-only dependency (assuming GNU Make syntax is allowed) on
libxlu_cfg_l.c, so the two rules DON'T run in parallel and cause havoc.
Since you keep referring to this: Yes, GNU make syntax is allowed. We use pattern rules, which themselves are an extension of the original suffix rules. The issue is that we can't (unconditionally) use stuff which was added only in newer versions of GNU make. (See ./README both for a statement on us requiring GNU make as well as one on the minimum version we expect to be in use.)
According to my reading, an order-only prereq isn't what would help us here: "Occasionally you may want to ensure that a prerequisite is built before a target, but without forcing the target to be updated if the prerequisite is updated." This isn't the situation we're dealing with, I would say. We want the prereq updating to occur and the building of the dependent target to be deferred until all the prereqs were updated.
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.Well, in my tests while 4.4 has fixed one issue with intermediate files affecting the behavior here, the issue we're possibly running into is still there. I've sent an inquiry to [email protected].
I do not believe this is a bug in GNU Make. Merely double-output rules cause precisely this sort of trouble in Make when run in parallel.
I suppose it can be viewed both ways: Make has all information to know that the file _is_ going to be touched, so it _could_ order operations accordingly.
Jan
Quoted 48 lines · Jan Beulich
Quoted 39 lines · Elliott Mitchell
Quoted 25 lines · Jan Beulich
Quoted 19 lines · Anthony PERARD
I think the issue that Andrew saw in the CI with "libxlu_cfg_y.o" failing to build while "libxlu_cfg_l.[ch]" are been regenerated is probably because make doesn't consider "libxlu_cfg_l.[ch]" as a group of targets.
If for some reason we have:
libxlu_cfg_l.hnewer than libxlu_cfg_l.l newer thanlibxlu_cfg_l.cThen make seems to take two parallel decision:
When building libxlu_cfg_y.o:
libxlu_cfg_l.his newer than libxlu_cfg_l.l
->libxlu_cfg_l.his up-to-date, start building libxlu_cfg_y.o
When building libxlu_cfg_l.o:
libxlu_cfg_l.cis older than libxlu_cfg_l.l
-> we need to generatelibxlu_cfg_l.cfirst
Then, libxlu_cfg_y.o fails to build becauselibxlu_cfg_l.his been updated do to the parallel build of libxlu_cfg_l.o.Quoted 4 lines
I can easily reproduce the issue with:
touchlibxlu_cfg_l.c; sleep .1; touch libxlu_cfg_l.l; sleep .1; touchlibxlu_cfg_l.h; sleep .1; make -j
And having "sleep 1" in "%.c %.h: %.l" recipe, betweenrmandflex.Quoted 5 lines
Interesting. In my somewhat similar experiments I found that an issue exists only when one of the .c files is missing. Things looked to work properly when both were there, but one was outdated. Clearly that's yet more surprising behavior than, as you appear to observe, the issue simply being tied too "needs updating".
The actual problem is flex and bison output both files at the same time. One process sees all of its prerequisites are up to do and therefore proceeds to the next step. A second process sees an out of date prerequisite, and starts to run flex which wipes out the prerequisite of the first process.
Quoted 6 lines
Crucially libxlu_cfg_y.o does NOT depend on
libxlu_cfg_l.c, therefore GNU Make is allowed to proceed with building libxlu_cfg_y.o even iflibxlu_cfg_l.cis out of date.The problem is the rule to update
libxlu_cfg_l.cALSO updateslibxlu_cfg_l.has a side-effect.
Quoted 7 lines
According to my reading, an order-only prereq isn't what would help us here: "Occasionally you may want to ensure that a prerequisite is built before a target, but without forcing the target to be updated if the prerequisite is updated." This isn't the situation we're dealing with, I would say. We want the prereq updating to occur and the building of the dependent target to be deferred until all the prereqs were updated.
You could create a parser which handled all the tokenization itself and only needed the constants for the tokens. The result would need the Lexer header (for the token constants), but not the Lexer itself. In such case case foo_y.o wouldn't need foo_l.c to be rebuilt if foo_l.h was up to date.
"libxlu_cfg_y.o" does NOT require "libxlu_cfg_l.c". What "libxlu_cfg_y.o" requires is that IF "libxlu_cfg_l.c" (and thereby "libxlu_cfg_l.h") is rebuilt, it must be rebuilt BEFORE "libxlu_cfg_y.o" is built.
"libxlu_cfg_y.o" needs "libxlu_cfg_l.c" to be built before it, but does not itself require "libxlu_cfg_l.c" to be rebuilt.
Hopefully this is sounding rather more similar to what GNU Make's manual says?
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
I don't know how to properly fix this yet.
Event writing "%.c %.h &: %.l" doesn't work, with make 4.3, which is supposed to be grouped targets. But that's is maybe fixed in 4.4.Well, in my tests while 4.4 has fixed one issue with intermediate files affecting the behavior here, the issue we're possibly running into is still there. I've sent an inquiry to [email protected].
Quoted 6 lines
Quoted 2 lines
I do not believe this is a bug in GNU Make. Merely double-output rules cause precisely this sort of trouble in Make when run in parallel.
I suppose it can be viewed both ways: Make has all information to know that the file _is_ going to be touched, so it _could_ order operations accordingly.
Indeed, the syntax of the Makefile implies this, but the parser isn't intelligent enough to add this extra constraint. This makes it harder for humans to write correct Makefiles, but it meets the requirements of the specifications. (may also yield faster builds in some situations)
Signature · 4 lines
(\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | [email protected] PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445