package/nodejs: fix parallel build
PATCH 1/1 package/nodejs: fix parallel build
In ninja-based nodejs builds performing parallel builds using "make -jX" is not working during buildroot initiated builds because the JOBS variable is set in the MAKE_OPTS variables in nodejs.mk. This commit remedies the issue by setting JOBS to BR2_JLEVEL and also by fixing the top-level Makefile of nodejs due to an incorrect tab-based indentation being used. Furthermore, it is important to also set LD_LIBRARY_PATH in v8-qemu-wrapper.in to our staging libdirs as otherwise execution of build tools fail due to host OS libraries being preferred.
--- ...-fixing-Makefile-for-parallel-builds.patch | 37 +++++++++++++++++++ package/nodejs/nodejs.mk | 6 ++- package/nodejs/v8-qemu-wrapper.in | 1 + 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch
package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch new file +37 -0
@@ -0,0 +1,37 @@ +From 1c4582c7dd7c80fbac89031d8fa8cf418249d01e Mon Sep 17 00:00:00 2001 +From: Jens Maus <[email protected]> +Date: Sat, 23 Sep 2023 11:09:50 +0200 +Subject: [PATCH] fixing Makefile for parallel builds + +This change fixing incorrect GNU makefile indentation in the top-level +Makefile which causes issues with parallel "make -jXX" builds. + +Upstream: N/A (specific to buildroot builds) +Signed-off-by: Jens Maus <[email protected]> +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index b7871bf218..87c47bcc0b 100644 +--- a/Makefile ++++ b/Makefile +@@ -138,12 +138,12 @@ else + ifeq ($(BUILD_WITH), ninja) + NINJA ?= ninja + ifeq ($(V),1) +- NINJA_ARGS := $(NINJA_ARGS) -v ++NINJA_ARGS := $(NINJA_ARGS) -v + endif + ifdef JOBS +- NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS) ++NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS) + else +- NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) ++NINJA_ARGS := $(NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) + endif + $(NODE_EXE): config.gypi out/Release/build.ninja + $(NINJA) -C out/Release $(NINJA_ARGS) +-- +2.34.1 +
package/nodejs/nodejs.mk +4 -2
@@ -46,14 +46,16 @@ HOST_NODEJS_MAKE_OPTS = \ CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \ LDFLAGS.host="$(HOST_LDFLAGS)" \ NO_LOAD=cctest.target.mk \ - PATH=$(@D)/bin:$(BR_PATH) + PATH=$(@D)/bin:$(BR_PATH) \ + JOBS=$(BR2_JLEVEL) NODEJS_MAKE_OPTS = \ $(TARGET_CONFIGURE_OPTS) \ NO_LOAD=cctest.target.mk \ PATH=$(@D)/bin:$(BR_PATH) \ LDFLAGS="$(NODEJS_LDFLAGS)" \ - LD="$(TARGET_CXX)" + LD="$(TARGET_CXX)" \ + JOBS=$(BR2_JLEVEL) # nodejs's build system uses python which can be a symlink to an unsupported # python version (e.g. python 3.10 with nodejs 14.18.1). We work around this by
package/nodejs/v8-qemu-wrapper.in +1 -0
@@ -5,5 +5,6 @@ exec @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ @QEMU_USERMODE_ARGS@ \ -L "${STAGING_DIR}/" \ + -E LD_LIBRARY_PATH="${STAGING_DIR}/lib:${STAGING_DIR}/usr/lib/" \ "$@"
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Jens, All,
+Thomas for the qemu part...
On 2023-09-23 11:39 +0200, Jens Maus via buildroot spake thusly:
Quoted 8 lines
In ninja-based nodejs builds performing parallel builds using "make -jX" is not working during buildroot initiated builds because the JOBS variable is set in the
MAKE_OPTSvariables in nodejs.mk. This commit remedies the issue by setting JOBS toBR2_JLEVELand also by fixing the top-levelMakefileof nodejs due to an incorrect tab-based indentation being used. Furthermore, it is important to also setLD_LIBRARY_PATHin v8-qemu-wrapper.in to our staging libdirs as otherwise execution of build tools fail due to host OS libraries being preferred.
That are two different changes, so they should be two different patches.
The commit log is thus misleading, becausee you are not "just" fixing the parallel build issue.
See below for more comments.
Quoted 14 lines
Signed-off-by Jens Maus <[email protected]>--- ...-fixing-Makefile-for-parallel-builds.patch | 37 +++++++++++++++++++ package/nodejs/nodejs.mk | 6 ++- package/nodejs/v8-qemu-wrapper.in | 1 + 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 package/nodejs/0005-fixing-Makefile-for-parallel-builds.patchpackage/nodejs/0005-fixing-Makefile-for-parallel-builds.patch new file +0
-0
package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch line 9
Quoted 9 lines
package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch new file +9
-0@@ -0,0 +1,37 @@ +From 1c4582c7dd7c80fbac89031d8fa8cf418249d01e Mon Sep 17 00:00:00 2001 +From: Jens Maus <[email protected]> +Date: Sat, 23 Sep 2023 11:09:50 +0200 +Subject: [PATCH] fixing Makefile for parallel builds + +This change fixing incorrect GNU makefile indentation in the top-level +Makefile which causes issues with parallel "make -jXX" builds. + +Upstream: N/A (specific to buildroot builds)
If the indentation is causing issues, then that's surely a fix that *must* be sent upstream.
Also, please explain what the actual error is.
[--SNIP--]
package/nodejs/v8-qemu-wrapper.in line 9
Quoted 10 lines
package/nodejs/v8-qemu-wrapper.in +1
-0@@ -5,5 +5,6 @@ exec @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ @QEMU_USERMODE_ARGS@ \ -L "${STAGING_DIR}/" \ + -E LD_LIBRARY_PATH="${STAGING_DIR}/lib:${STAGING_DIR}/usr/lib/" \ "$@"
We've already had hints about doing something like that, but this is going to require a much more detailed commit log than you provided. Ah, I see you were part of:
https://bugs.busybox.net/show_bug.cgi?id=14366
Also, Thomas did quite some in-depth analysis of the qemu issue (you even were in Cc of that mail):
https://lore.kernel.org/buildroot/20221031213926.50d3c778@windsurf/
As you see, just stating "it is important to also set LD_LIBRARY_PATH in v8-qemu-wrapper.in to our staging libdirs as otherwise execution of build tools fail due to host OS libraries being preferred" is not enough. We really need an actual explanation.
So, please, canyou split this patch into two:
- fix the parallel build issue,
- fix the qemu wrapper with a synthesis of Thomas' extensive analysis
And in that second patch, please add a reference to the bug you close.
Regards,
Yann E. MORIN.
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Yann,
Quoted 12 lines
Am 23.09.2023 um 12:09 schrieb Yann E. MORIN <[email protected]>:
On 2023-09-23 11:39 +0200, Jens Maus via buildroot spake thusly:
Quoted 8 lines
In ninja-based nodejs builds performing parallel builds using "make -jX" is not working during buildroot initiated builds because the JOBS variable is set in the
MAKE_OPTSvariables in nodejs.mk. This commit remedies the issue by setting JOBS toBR2_JLEVELand also by fixing the top-levelMakefileof nodejs due to an incorrect tab-based indentation being used. Furthermore, it is important to also setLD_LIBRARY_PATHin v8-qemu-wrapper.in to our staging libdirs as otherwise execution of build tools fail due to host OS libraries being preferred.
Quoted 4 lines
That are two different changes, so they should be two different patches.
The commit log is thus misleading, becausee you are not "just" fixing the parallel build issue.
You are right. I really forgot about the already submitted v8-qemu-wrapper bug report completely for some reason. Will of course split this into two parts now.
Quoted 29 lines
See below for more comments.
Quoted 14 lines
Signed-off-by Jens Maus <[email protected]>---
...-fixing-Makefile-for-parallel-builds.patch | 37 +++++++++++++++++++ package/nodejs/nodejs.mk | 6 ++- package/nodejs/v8-qemu-wrapper.in | 1 + 3 files changed, 42 insertions(+), 2 deletions(-)create mode 100644
package/nodejs/0005-fixing-Makefile-for-parallel-builds.patchpackage/nodejs/0005-fixing-Makefile-for-parallel-builds.patch new file +0
-0package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch line 9
Quoted 9 lines
package/nodejs/0005-fixing-Makefile-for-parallel-builds.patch new file +9
-0@@ -0,0 +1,37 @@ +From 1c4582c7dd7c80fbac89031d8fa8cf418249d01e Mon Sep 17 00:00:00 2001 +From: Jens Maus <[email protected]> +Date: Sat, 23 Sep 2023 11:09:50 +0200 +Subject: [PATCH] fixing Makefile for parallel builds + +This change fixing incorrect GNU makefile indentation in the top-level +Makefile which causes issues with parallel "make -jXX" builds. + +Upstream: N/A (specific to buildroot builds)If the indentation is causing issues, then that's surely a fix that *must* be sent upstream.
Quoted 1 line
Also, please explain what the actual error is.
Ok, will do so as soon as I get this reproduced again. This patch had been long time into my buildroot patch folder and I really had to fix that indentation to get things going. Will try to resubmit that patch again with some more details error message/explaination. And then I can see if I will have to sent the Makefile patch upstream or not while I am still, however, not sure if/when it will be accepted there.
Quoted 28 lines
[--SNIP--]
package/nodejs/v8-qemu-wrapper.in line 9
Quoted 10 lines
package/nodejs/v8-qemu-wrapper.in +1
-0@@ -5,5 +5,6 @@ exec @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ @QEMU_USERMODE_ARGS@ \ -L "${STAGING_DIR}/" \ + -E LD_LIBRARY_PATH="${STAGING_DIR}/lib:${STAGING_DIR}/usr/lib/" \ "$@"We've already had hints about doing something like that, but this is going to require a much more detailed commit log than you provided. Ah, I see you were part of:
https://bugs.busybox.net/show_bug.cgi?id=14366Also, Thomas did quite some in-depth analysis of the qemu issue (you even were in Cc of that mail):
https://lore.kernel.org/buildroot/20221031213926.50d3c778@windsurf/As you see, just stating "it is important to also set
LD_LIBRARY_PATHin v8-qemu-wrapper.in to our staging libdirs as otherwise execution of build tools fail due to host OS libraries being preferred" is not enough. We really need an actual explanation.
Quoted 5 lines
So, please, canyou split this patch into two:
- fix the parallel build issue,
- fix the qemu wrapper with a synthesis of Thomas' extensive analysisAnd in that second patch, please add a reference to the bug you close.
Ok, I just submitted a new patch just for fixing v8-qemu-wapper.in <http://v8-qemu-wapper.in/>. The other issue with the parallel build I will resubmit as soon as I have the error at hand again and can explain it in more detail.
Best Regards,
Jens
Signature · 7 lines
Jens Maus, Dresden/Germany http://jens-maus.de/ _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi again,
Quoted 3 lines
Am 23.09.2023 um 13:07 schrieb Jens Maus <[email protected]>:
Ok, I just submitted a new patch just for fixing v8-qemu-wapper.in <http://v8-qemu-wapper.in/>. The other issue with the parallel build I will resubmit as soon as I have the error at hand again and can explain it in more detail.
FYI: I just retested the nodejs build without the top-level makefile patch which I suggested in my initial patch upload. However, I could not reproduce the issue anymore. I have therefore now resubmitted the patch but without the top-level Makefile patch.
Best Regards,
Jens
Signature · 7 lines
Jens Maus, Dresden/Germany http://jens-maus.de/ _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/1 package/nodejs: fix cross-compile builds
In reply to Jens Maus via buildrootWhen nodejs is build a qemu wrapper script is used to execute some programs built for the target in user-mode emulation. However, in some constellations this causes the build to fail because libraries from the build host are used rather than from the target staging directory. This has been already reported [1] and throughoutly investigate [2]. A commonly used fix for this issue is to explicitly use LD_LIBRARY_PATH to make sure that the correct runtime libraries are preferred rather than using libraries from the build host.
[1] https://bugs.busybox.net/show_bug.cgi?id=14366
[2] https://lore.kernel.org/buildroot/20221031213926.50d3c778@windsurf/
--- package/nodejs/v8-qemu-wrapper.in | 1 + 1 file changed, 1 insertion(+)
package/nodejs/v8-qemu-wrapper.in +1 -0
@@ -5,5 +5,6 @@ exec @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ @QEMU_USERMODE_ARGS@ \ -L "${STAGING_DIR}/" \ + -E LD_LIBRARY_PATH="${STAGING_DIR}/lib:${STAGING_DIR}/usr/lib/" \ "$@"
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedRe: [Buildroot] [PATCH 1/1] package/nodejs: fix cross-compile builds
Jens, All,
On 2023-09-23 12:59 +0200, Jens Maus via buildroot spake thusly:
Quoted 8 lines
When nodejs is build a qemu wrapper script is used to execute some programs built for the target in user-mode emulation. However, in some constellations this causes the build to fail because libraries from the build host are used rather than from the target staging directory. This has been already reported [1] and throughoutly investigate [2]. A commonly used fix for this issue is to explicitly use
LD_LIBRARY_PATHto make sure that the correct runtime libraries are preferred rather than using libraries from the build host.
Compared to the in-depth analysis that Thomas did, the above was very, very light. It did not even explain the core of the issue ("in some constellations" is very vague, when Thomas explaned exactly what is going on).
For such a difficult issue, we do want to carry the explanations in the repository, when a remote URL may disapear any time.
So, I did duplicate most of Thomas analysis, and just tweaked it ever so slightly so that it fits better as a commit log.
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 26 lines
[1] https://bugs.busybox.net/show_bug.cgi?id=14366
[2] https://lore.kernel.org/buildroot/20221031213926.50d3c778@windsurf/Signed-off-by Jens Maus <[email protected]>--- package/nodejs/v8-qemu-wrapper.in | 1 + 1 file changed, 1 insertion(+)package/nodejs/v8-qemu-wrapper.in +1
-0@@ -5,5 +5,6 @@ exec @QEMU_USER@ -r @TOOLCHAIN_HEADERS_VERSION@ \ @QEMU_USERMODE_ARGS@ \ -L "${STAGING_DIR}/" \ + -E LD_LIBRARY_PATH="${STAGING_DIR}/lib:${STAGING_DIR}/usr/lib/" \ "$@"Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/1] package/nodejs: fix cross-compile builds
In reply to Jens Maus via buildrootQuoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Jens" == Jens Maus via buildroot <[email protected]> writes:
When nodejs is build a qemu wrapper script is used to execute some programs built for the target in user-mode emulation. However, in some constellations this causes the build to fail because libraries from the build host are used rather than from the target staging directory. This has been already reported [1] and throughoutly investigate [2]. A commonly used fix for this issue is to explicitly use
LD_LIBRARY_PATHto make sure that the correct runtime libraries are preferred rather than using libraries from the build host.
Quoted 4 lines
[1] https://bugs.busybox.net/show_bug.cgi?id=14366
[2] https://lore.kernel.org/buildroot/20221031213926.50d3c778@windsurf/Signed-off-by Jens Maus <[email protected]>
Committed to 2023.02.x and 2023.08.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/1 package/nodejs: fix parallel build
In reply to Jens Maus via buildrootIn ninja-based nodejs builds performing parallel builds using "make -jX" is not working during buildroot initiated builds because the JOBS variable is not set in the MAKE_OPTS variables in nodejs.mk. This commit remedies the issue by setting JOBS to BR2_JLEVEL.
---
Changes v1 -> v2:
- removed unrelated v8-qemu-wrapper.in change (Yann)
- revised change summary (Yann)
- removed unnecessary top-level Makefile modifications (Yann)
--- package/nodejs/nodejs.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
package/nodejs/nodejs.mk +4 -2
@@ -46,14 +46,16 @@ HOST_NODEJS_MAKE_OPTS = \ CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \ LDFLAGS.host="$(HOST_LDFLAGS)" \ NO_LOAD=cctest.target.mk \ - PATH=$(@D)/bin:$(BR_PATH) + PATH=$(@D)/bin:$(BR_PATH) \ + JOBS=$(BR2_JLEVEL) NODEJS_MAKE_OPTS = \ $(TARGET_CONFIGURE_OPTS) \ NO_LOAD=cctest.target.mk \ PATH=$(@D)/bin:$(BR_PATH) \ LDFLAGS="$(NODEJS_LDFLAGS)" \ - LD="$(TARGET_CXX)" + LD="$(TARGET_CXX)" \ + JOBS=$(BR2_JLEVEL) # nodejs's build system uses python which can be a symlink to an unsupported # python version (e.g. python 3.10 with nodejs 14.18.1). We work around this by
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedJens, All,
On 2023-09-23 18:04 +0200, Jens Maus via buildroot spake thusly:
Quoted 4 lines
In ninja-based nodejs builds performing parallel builds using "make -jX" is not working during buildroot initiated builds because the JOBS variable is not set in the
MAKE_OPTSvariables in nodejs.mk. This commit remedies the issue by setting JOBS toBR2_JLEVEL.
I was very confused that nodejs would not build in parallel; that would have made for very, very,very long builds. And indeed, it does build in parallel, in fact.
However, what it does, is use as many CPUs as are available, without accounting for the value set by the user in BR2_JLEVEL, thus overshooting the limits set by the user.
So, I reworded the whoe commit log to explain that.
Applied to master, thanks.
Regards,
Yann E. MORIN.
Quoted 43 lines
Signed-off-by Jens Maus <[email protected]>---
Changes v1 -> v2:
- removed unrelated v8-qemu-wrapper.in change (Yann)
- revised change summary (Yann)
- removed unnecessary top-levelMakefilemodifications (Yann)Signed-off-by Jens Maus <[email protected]>--- package/nodejs/nodejs.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)package/nodejs/nodejs.mk +4
-2@@ -46,14 +46,16 @@ HOST_NODEJS_MAKE_OPTS = \ CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \ LDFLAGS.host="$(HOST_LDFLAGS)" \ NO_LOAD=cctest.target.mk \ - PATH=$(@D)/bin:$(BR_PATH) + PATH=$(@D)/bin:$(BR_PATH) \ + JOBS=$(BR2_JLEVEL) NODEJS_MAKE_OPTS = \ $(TARGET_CONFIGURE_OPTS) \ NO_LOAD=cctest.target.mk \ PATH=$(@D)/bin:$(BR_PATH) \ LDFLAGS="$(NODEJS_LDFLAGS)" \ - LD="$(TARGET_CXX)" + LD="$(TARGET_CXX)" \ + JOBS=$(BR2_JLEVEL) # nodejs's build system uses python which can be a symlink to an unsupported # python version (e.g. python 3.10 with nodejs 14.18.1). We work around this bySignature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Jens, All,
On 2023-09-23 18:04 +0200, Jens Maus via buildroot spake thusly:Quoted 4 lines
In ninja-based nodejs builds performing parallel builds using "make -jX" is not working during buildroot initiated builds because the JOBS variable is not set in the
MAKE_OPTSvariables in nodejs.mk. This commit remedies the issue by setting JOBS toBR2_JLEVEL.I was very confused that nodejs would not build in parallel; that would have made for very, very,very long builds. And indeed, it does build in parallel, in fact.
Quoted 7 lines
However, what it does, is use as many CPUs as are available, without accounting for the value set by the user in
BR2_JLEVEL, thus overshooting the limits set by the user.So, I reworded the whoe commit log to explain that.
Applied to master, thanks.
Committed to 2023.02.x, 2023.05.x and 2023.08.x, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot