Message ID | a5cb242853434b99a016d430dc3030ba10602d09.1511779719.git.yann.morin.1998@free.fr |
---|---|
State | Accepted |
Headers | show |
Series | [1/3] package/dvb-apps: fix build with some perl version | expand |
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes: > This is invisible because the timings make it excessively difficult to > hit, but the Makefile is inherently flawed for parallel build, as it > contains: > $(objects): atsc_psip_section.c atsc_psip_section.h > atsc_psip_section.c atsc_psip_section.h: > perl section_generate.pl atsc_psip_section.pl > and the perl script section_generate.pl will create both the .c and .h > files in one go, but given the construct above, there can be two such > script that run in parallel, which can clobber the generated .c and/or > .h files. > So, make dvb-apps a MAKE1 package. > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > --- > The time to build increased by one third, from ~7.5s to ~10s, on a > core-i7 quad-core, which is not much in the end, and totally acceptable. Committed to 2017.02.x and 2017.08.x, thanks.
On Mon, 2017-11-27 at 23:52 +0100, Peter Korsgaard wrote: > > > > > > "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes: > > > This is invisible because the timings make it excessively difficult to > > hit, but the Makefile is inherently flawed for parallel build, as it > > contains: > > > $(objects): atsc_psip_section.c atsc_psip_section.h > > > atsc_psip_section.c atsc_psip_section.h: > > perl section_generate.pl atsc_psip_section.pl > > > and the perl script section_generate.pl will create both the .c and .h > > files in one go, but given the construct above, there can be two such > > script that run in parallel, which can clobber the generated .c and/or > > .h files. I gather this is the common parallel build issue with a recipe that produces two outputs. This can be fixed by using a pattern rule for the recipe that produces multiple outputs. %section.c %section.h: %section.pl perl section_generate.pl $< GNU make understands a pattern rule that produces multiple outputs to produce all of them via a single running of the rule. Seems like a simple patch.
diff --git a/package/dvb-apps/dvb-apps.mk b/package/dvb-apps/dvb-apps.mk index 8aa4a29307..ffab0db682 100644 --- a/package/dvb-apps/dvb-apps.mk +++ b/package/dvb-apps/dvb-apps.mk @@ -27,7 +27,7 @@ DVB_APPS_INSTALL_STAGING = YES define DVB_APPS_BUILD_CMDS $(TARGET_CONFIGURE_OPTS) LDLIBS="$(DVB_APPS_LDLIBS)" \ - $(MAKE) -C $(@D) CROSS_ROOT=$(STAGING_DIR) \ + $(MAKE1) -C $(@D) CROSS_ROOT=$(STAGING_DIR) \ $(DVB_APPS_MAKE_OPTS) endef
This is invisible because the timings make it excessively difficult to hit, but the Makefile is inherently flawed for parallel build, as it contains: $(objects): atsc_psip_section.c atsc_psip_section.h atsc_psip_section.c atsc_psip_section.h: perl section_generate.pl atsc_psip_section.pl and the perl script section_generate.pl will create both the .c and .h files in one go, but given the construct above, there can be two such script that run in parallel, which can clobber the generated .c and/or .h files. So, make dvb-apps a MAKE1 package. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> --- The time to build increased by one third, from ~7.5s to ~10s, on a core-i7 quad-core, which is not much in the end, and totally acceptable. --- package/dvb-apps/dvb-apps.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)