nbench-byte: Fix sysinfo generation in parallel build
PATCH 1/1 nbench-byte: Fix sysinfo generation in parallel build
The project Makefile uses a script (sysinfo.sh) to non-atomically generate two .c files (sysinfo.c, sysinfoc.c) which are then included in the build. Since the script always overwrites both .c files, the Makefile should only invoke it once, not twice in parallel. Otherwise the .c files may be corrupted and cause random build failures in parallel builds.
Requires at least GNU make 4.3, for Grouped Targets support [1].
[1] https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html
--- ...sysinfo-generation-in-parallel-build.patch | 69 +++++++++++++++++++ .../sysinfo.sh-Fix-typo-in-rm-command.patch | 27 ++++++++ .../nbench-byte/nbench-byte_2.2.3.bb | 4 +- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-benchmark/nbench-byte/nbench-byte/Makefile-Fix-sysinfo-generation-in-parallel-build.patch create mode 100644 meta-oe/recipes-benchmark/nbench-byte/nbench-byte/sysinfo.sh-Fix-typo-in-rm-command.patch
meta-oe/recipes-benchmark/nbench-byte/nbench-byte/Makefile-Fix-sysinfo-generation-in-parallel-build.patch new file +69 -0
@@ -0,0 +1,69 @@ +From 26e13ce45ffeb2f233d1dd7e4321cb65ab10b0fb Mon Sep 17 00:00:00 2001 +From: Daniel Klauer <[email protected]> +Date: Fri, 6 Feb 2026 17:13:49 +0100 +Subject: [PATCH] Makefile: Fix sysinfo generation in parallel build + +sysinfo.sh non-atomically overwrites both sysinfo.c and sysinfoc.c, +so it should only be invoked once, not twice in parallel. + +Requires at least GNU make 4.3, for Grouped Targets support [1]. + +Should fix random build failures like this one: + +| NOTE: make -j 20 -e MAKEFLAGS= +[...] +| ./sysinfo.sh x86_64-gin-linux-gcc [...] +| ./sysinfo.sh x86_64-gin-linux-gcc [...] +[...] +| x86_64-gin-linux-gcc [...] \ +| -c nbench0.c +| In file included from nbench0.c:219: +| sysinfo.c: In function 'main': +| sysinfo.c:11:1: error: 'fer' undeclared (first use in this function) +| 11 | fer); +| | ^~~ +| sysinfo.c:11:1: note: each undeclared identifier is reported only once for each function it appears in +| sysinfo.c:11:4: error: expected ';' before ')' token +| 11 | fer); +| | ^ +| | ; +| sysinfo.c:11:4: error: expected statement before ')' token +| In file included from nbench0.c:317: +| sysinfoc.c:5:4: error: expected ';' before ')' token +| 5 | fer); +| | ^ +| | ; +| sysinfoc.c:5:4: error: expected statement before ')' token +| make: *** [Makefile:115: nbench0.o] Error 1 +| make: *** Waiting for unfinished jobs.... +| ERROR: oe_runmake failed +| WARNING: exit code 1 from a shell command. +NOTE: recipe nbench-byte-2.2.3-r0: task do_compile: Failed + +[1] https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html +Upstream-Status: Inactive-Upstream [lastrelease 2003, no vcs] +Signed-off-by: Daniel Klauer <[email protected]> +--- + Makefile | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index edd9ea2..66b2ddc 100644 +--- a/Makefile ++++ b/Makefile +@@ -95,10 +95,8 @@ DEFINES= -DLINUX $(NO_UNAME) + + ########################################################################## + # For LINUX-like systems with gcc +-sysinfoc.c: Makefile +- ./sysinfo.sh $(CC) $(MACHINE) $(DEFINES) $(CFLAGS) +- +-sysinfo.c: Makefile ++# sysinfo.sh generates both sysinfo.c and sysinfoc.c ++sysinfo.c sysinfoc.c &: Makefile + ./sysinfo.sh $(CC) $(MACHINE) $(DEFINES) $(CFLAGS) + + ########################################################################## +-- +2.43.0 +
meta-oe/recipes-benchmark/nbench-byte/nbench-byte/sysinfo.sh-Fix-typo-in-rm-command.patch new file +27 -0
@@ -0,0 +1,27 @@ +From 0019af6eb5188f5111a0f2008c0002b545382b67 Mon Sep 17 00:00:00 2001 +From: Daniel Klauer <[email protected]> +Date: Fri, 6 Feb 2026 17:14:53 +0100 +Subject: [PATCH] sysinfo.sh: Fix typo in rm command + +Upstream-Status: Inactive-Upstream [lastrelease 2003, no vcs] +Signed-off-by: Daniel Klauer <[email protected]> +--- + sysinfo.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysinfo.sh b/sysinfo.sh +index 57754fe..1373699 100755 +--- a/sysinfo.sh ++++ b/sysinfo.sh +@@ -61,7 +61,7 @@ if ($* hello.c -o hello) >/dev/null 2>&1; then + fi + fi + +-rm -f sysinfo.crm sysinfoc.c hello ++rm -f sysinfo.c sysinfoc.c hello + + # this bombs out on Ultrix which expect "cut -d" + +-- +2.43.0 +
meta-oe/recipes-benchmark/nbench-byte/nbench-byte_2.2.3.bb +3 -1
@@ -9,7 +9,9 @@ SECTION = "console/utils" SRC_URI = "https://fossies.org/linux/misc/old/${BP}.tar.gz \ file://nbench_32bits.patch \ - file://Makefile-add-more-dependencies-to-pointer.h.patch" + file://Makefile-add-more-dependencies-to-pointer.h.patch \ + file://Makefile-Fix-sysinfo-generation-in-parallel-build.patch \ + file://sysinfo.sh-Fix-typo-in-rm-command.patch" SRC_URI[md5sum] = "285dfab361080759d477ea1fe7d3093a" SRC_URI[sha256sum] = "723dd073f80e9969639eb577d2af4b540fc29716b6eafdac488d8f5aed9101ac"
Signature · 1 line
2.43.0
Thank you, I've cherry-picked this from master. Would you please send a cherry-pick for whinlatter as well so it's not missed there?
Quoted 156 lines · Daniel Klauer via lists.openembedded.org
The project
Makefileuses a script (sysinfo.sh) to non-atomically generate two .c files (sysinfo.c,sysinfoc.c) which are then included in the build. Since the script always overwrites both .c files, theMakefileshould only invoke it once, not twice in parallel. Otherwise the .c files may be corrupted and cause random build failures in parallel builds.Requires at least GNU make 4.3, for Grouped Targets support [1].
[1] https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html
Reviewed-by Silvio Fricke <[email protected]>Signed-off-by Daniel Klauer <[email protected]>--- ...sysinfo-generation-in-parallel-build.patch | 69 +++++++++++++++++++ .../sysinfo.sh-Fix-typo-in-rm-command.patch | 27 ++++++++ .../nbench-byte/nbench-byte_2.2.3.bb | 4 +- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-benchmark/nbench-byte/nbench-byte/Makefile-Fix-sysinfo-generation-in-parallel-build.patch create mode 100644 meta-oe/recipes-benchmark/nbench-byte/nbench-byte/sysinfo.sh-Fix-typo-in-rm-command.patchmeta-oe/recipes-benchmark/nbench-byte/nbench-byte/Makefile-Fix-sysinfo-generation-in-parallel-build.patch new file +69
-0@@ -0,0 +1,69 @@ +From 26e13ce45ffeb2f233d1dd7e4321cb65ab10b0fb Mon Sep 17 00:00:00 2001 +From: Daniel Klauer <[email protected]> +Date: Fri, 6 Feb 2026 17:13:49 +0100 +Subject: [PATCH] Makefile: Fix sysinfo generation in parallel build + +sysinfo.sh non-atomically overwrites both sysinfo.c and sysinfoc.c, +so it should only be invoked once, not twice in parallel. + +Requires at least GNU make 4.3, for Grouped Targets support [1]. + +Should fix random build failures like this one: + +| NOTE: make -j 20 -e MAKEFLAGS= +[...] +| ./sysinfo.sh x86_64-gin-linux-gcc [...] +| ./sysinfo.sh x86_64-gin-linux-gcc [...] +[...] +| x86_64-gin-linux-gcc [...] \ +| -c nbench0.c +| In file included from nbench0.c:219: +| sysinfo.c: In function 'main': +| sysinfo.c:11:1: error: 'fer' undeclared (first use in this function) +| 11 | fer); +| | ^~~ +| sysinfo.c:11:1: note: each undeclared identifier is reported only once for each function it appears in +| sysinfo.c:11:4: error: expected ';' before ')' token +| 11 | fer); +| | ^ +| | ; +| sysinfo.c:11:4: error: expected statement before ')' token +| In file included from nbench0.c:317: +| sysinfoc.c:5:4: error: expected ';' before ')' token +| 5 | fer); +| | ^ +| | ; +| sysinfoc.c:5:4: error: expected statement before ')' token +| make: *** [Makefile:115: nbench0.o] Error 1 +| make: *** Waiting for unfinished jobs.... +| ERROR: oe_runmake failed +| WARNING: exit code 1 from a shell command. +NOTE: recipe nbench-byte-2.2.3-r0: task do_compile: Failed + +[1] https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html +Upstream-Status: Inactive-Upstream [lastrelease 2003, no vcs] +Signed-off-by: Daniel Klauer <[email protected]> +--- + Makefile | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/Makefile b/Makefile +index edd9ea2..66b2ddc 100644 +--- a/Makefile ++++ b/Makefile +@@ -95,10 +95,8 @@ DEFINES= -DLINUX $(NO_UNAME) + + ########################################################################## + # For LINUX-like systems with gcc +-sysinfoc.c: Makefile +- ./sysinfo.sh $(CC) $(MACHINE) $(DEFINES) $(CFLAGS) +- +-sysinfo.c: Makefile ++# sysinfo.sh generates both sysinfo.c and sysinfoc.c ++sysinfo.c sysinfoc.c &: Makefile + ./sysinfo.sh $(CC) $(MACHINE) $(DEFINES) $(CFLAGS) + + ########################################################################## +-- +2.43.0 +meta-oe/recipes-benchmark/nbench-byte/nbench-byte/sysinfo.sh-Fix-typo-in-rm-command.patch new file +27
-0@@ -0,0 +1,27 @@ +From 0019af6eb5188f5111a0f2008c0002b545382b67 Mon Sep 17 00:00:00 2001 +From: Daniel Klauer <[email protected]> +Date: Fri, 6 Feb 2026 17:14:53 +0100 +Subject: [PATCH] sysinfo.sh: Fix typo in rm command + +Upstream-Status: Inactive-Upstream [lastrelease 2003, no vcs] +Signed-off-by: Daniel Klauer <[email protected]> +--- + sysinfo.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sysinfo.sh b/sysinfo.sh +index 57754fe..1373699 100755 +--- a/sysinfo.sh ++++ b/sysinfo.sh +@@ -61,7 +61,7 @@ if ($* hello.c -o hello) >/dev/null 2>&1; then + fi + fi + +-rm -f sysinfo.crm sysinfoc.c hello ++rm -f sysinfo.c sysinfoc.c hello + + # this bombs out on Ultrix which expect "cut -d" + +-- +2.43.0 +meta-oe/recipes-benchmark/nbench-byte/nbench-byte_2.2.3.bb +3
-2@@ -9,7 +9,9 @@ SECTION = "console/utils" SRC_URI = "https://fossies.org/linux/misc/old/${BP}.tar.gz \ file://nbench_32bits.patch \ - file://Makefile-add-more-dependencies-to-pointer.h.patch" + file://Makefile-add-more-dependencies-to-pointer.h.patch \ + file://Makefile-Fix-sysinfo-generation-in-parallel-build.patch \ + file://sysinfo.sh-Fix-typo-in-rm-command.patch" SRC_URI[md5sum] = "285dfab361080759d477ea1fe7d3093a" SRC_URI[sha256sum] = "723dd073f80e9969639eb577d2af4b540fc29716b6eafdac488d8f5aed9101ac" --2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#124548): https://lists.openembedded.org/g/openembedded-devel/message/124548
Mute This Topic: https://lists.openembedded.org/mt/117957011/3616702
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 2 lines · Anuj Mittal
Thank you, I've cherry-picked this from master. Would you please send a cherry-pick for whinlatter as well so it's not missed there?
Okay, done.
Also, it would be possible to backport to kirkstone. The scarthgap patch should apply cleanly to kirkstone too (unlike the master/whinlatter version).