Parallel make bug in busybox

Ralf Friedl Ralf.Friedl at online.de
Sun Aug 14 00:29:40 UTC 2016


Arnout Vandecappelle wrote:
> As an aside, there may be a second issue: applets/Kbuild.src specifies the same
> command for both include/applet_tables.h and include/NUM_APPLETS.h, but that
> command will always generate both files. So if the rules for the two files are
> launched in parallel, there is another problem. The easiest way to work around
> that is to (arbitrarily) let include/NUM_APPLETS.h depend on
> include/applet_tables.h with an empty command:
>
> include/NUM_APPLETS.h: include/applet_tables.h ;
>
> It's not entirely accurate, but in practice it works.
There is a perfectly valid syntax to express that one command generates 
more than one file:
diff --git a/applets/Kbuild.src b/applets/Kbuild.src
index b612399..5d4c53e 100644
--- a/applets/Kbuild.src
+++ b/applets/Kbuild.src
@@ -40,8 +40,5 @@ include/usage_compressed.h: applets/usage 
$(srctree_slash)applets/usage_compress
  quiet_cmd_gen_applet_tables = GEN     include/applet_tables.h
        cmd_gen_applet_tables = applets/applet_tables 
include/applet_tables.h include/NUM_APPLETS.h

-include/applet_tables.h: applets/applet_tables
-       $(call cmd,gen_applet_tables)
-
-include/NUM_APPLETS.h: applets/applet_tables
+include/applet_tables.h include/NUM_APPLETS.h: applets/applet_tables
         $(call cmd,gen_applet_tables)

This should also fix the problem with the parallel build. The original 
form would invoke the same command twice, maybe at the same time. The 
second form will invoke it only once.

The problem with include/NUM_APPLETS.h is that it is not rebuild by 
applets/Kbuild.src if include/NUM_APPLETS.h is removed, but 
include/applet_tables.h is not. This can be fixed by adding 
include/NUM_APPLETS.h to the dependencies of applets/usage_pod, although 
it is not really a dependency.


More information about the busybox mailing list