All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/nodejs: force host-python3
@ 2021-12-22 14:07 Fabrice Fontaine
  2021-12-22 14:38 ` Thomas Petazzoni
  2022-01-09 16:26 ` Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Fabrice Fontaine @ 2021-12-22 14:07 UTC (permalink / raw)
  To: buildroot; +Cc: Fabrice Fontaine, Martin Bark, Daniel Price

Build of nodejs fails if python 3.10 is installed on host.
As suggested by Arnout in
https://bugs.buildroot.org/show_bug.cgi?id=14451, use the same
workaround than in qt5webkit to force host-python3 (which is in version
3.9)

It should be noted that python 3.10 support has been added in version
14.18.2: https://github.com/nodejs/node/releases/tag/v14.18.2

Fixes:
 - https://bugs.buildroot.org/show_bug.cgi?id=14451

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/nodejs/nodejs.mk | 54 +++++++++++++++++++++-------------------
 1 file changed, 29 insertions(+), 25 deletions(-)

diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index 42ef1baa64..322eed6d19 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -27,6 +27,30 @@ NODEJS_CONF_OPTS = \
 	--cross-compiling \
 	--dest-os=linux
 
+HOST_NODEJS_MAKE_OPTS = \
+	$(HOST_CONFIGURE_OPTS) \
+	CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
+	LDFLAGS.host="$(HOST_LDFLAGS)" \
+	NO_LOAD=cctest.target.mk \
+	PATH=$(@D)/bin:$(BR_PATH)
+
+NODEJS_MAKE_OPTS = \
+	$(TARGET_CONFIGURE_OPTS) \
+	NO_LOAD=cctest.target.mk \
+	PATH=$(@D)/bin:$(BR_PATH) \
+	LDFLAGS="$(NODEJS_LDFLAGS)" \
+	LD="$(TARGET_CXX)"
+
+# 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
+# forcing host-python3 early in the PATH, via a python->python3 symlink.
+define NODEJS_PYTHON3_SYMLINK
+	mkdir -p $(@D)/bin
+	ln -sf $(HOST_DIR)/bin/python3 $(@D)/bin/python
+endef
+HOST_NODEJS_PRE_CONFIGURE_HOOKS += NODEJS_PYTHON3_SYMLINK
+NODEJS_PRE_CONFIGURE_HOOKS += NODEJS_PYTHON3_SYMLINK
+
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 NODEJS_DEPENDENCIES += openssl
 NODEJS_CONF_OPTS += --shared-openssl
@@ -75,21 +99,13 @@ HOST_NODEJS_CXXFLAGS = $(HOST_CXXFLAGS) -DU_DISABLE_RENAMING=1
 define HOST_NODEJS_BUILD_CMDS
 	$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
 		$(MAKE) -C $(@D) \
-		$(HOST_CONFIGURE_OPTS) \
-		CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
-		LDFLAGS.host="$(HOST_LDFLAGS)" \
-		NO_LOAD=cctest.target.mk \
-		PATH=$(@D)/bin:$(BR_PATH)
+		$(HOST_NODEJS_MAKE_OPTS)
 endef
 
 define HOST_NODEJS_INSTALL_CMDS
 	$(HOST_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
 		$(MAKE) -C $(@D) install \
-		$(HOST_CONFIGURE_OPTS) \
-		CXXFLAGS="$(HOST_NODEJS_CXXFLAGS)" \
-		LDFLAGS.host="$(HOST_LDFLAGS)" \
-		NO_LOAD=cctest.target.mk \
-		PATH=$(@D)/bin:$(BR_PATH)
+		$(HOST_NODEJS_MAKE_OPTS)
 
 	$(foreach f,$(NODEJS_HOST_TOOLS), \
 		$(INSTALL) -m755 -D $(@D)/out/Release/$(f) $(HOST_DIR)/bin/$(f)
@@ -195,11 +211,7 @@ endef
 define NODEJS_BUILD_CMDS
 	$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
 		$(MAKE) -C $(@D) \
-		$(TARGET_CONFIGURE_OPTS) \
-		NO_LOAD=cctest.target.mk \
-		PATH=$(@D)/bin:$(BR_PATH) \
-		LDFLAGS="$(NODEJS_LDFLAGS)" \
-		LD="$(TARGET_CXX)"
+		$(NODEJS_MAKE_OPTS)
 endef
 
 #
@@ -236,22 +248,14 @@ define NODEJS_INSTALL_STAGING_CMDS
 	$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
 		$(MAKE) -C $(@D) install \
 		DESTDIR=$(STAGING_DIR) \
-		$(TARGET_CONFIGURE_OPTS) \
-		NO_LOAD=cctest.target.mk \
-		PATH=$(@D)/bin:$(BR_PATH) \
-		LDFLAGS="$(NODEJS_LDFLAGS)" \
-		LD="$(TARGET_CXX)"
+		$(NODEJS_MAKE_OPTS)
 endef
 
 define NODEJS_INSTALL_TARGET_CMDS
 	$(TARGET_MAKE_ENV) PYTHON=$(HOST_DIR)/bin/python3 \
 		$(MAKE) -C $(@D) install \
 		DESTDIR=$(TARGET_DIR) \
-		$(TARGET_CONFIGURE_OPTS) \
-		NO_LOAD=cctest.target.mk \
-		PATH=$(@D)/bin:$(BR_PATH) \
-		LDFLAGS="$(NODEJS_LDFLAGS)" \
-		LD="$(TARGET_CXX)"
+		$(NODEJS_MAKE_OPTS)
 	$(NODEJS_INSTALL_MODULES)
 endef
 
-- 
2.33.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/nodejs: force host-python3
  2021-12-22 14:07 [Buildroot] [PATCH 1/1] package/nodejs: force host-python3 Fabrice Fontaine
@ 2021-12-22 14:38 ` Thomas Petazzoni
  2021-12-22 15:09   ` Fabrice Fontaine
  2022-01-09 16:26 ` Peter Korsgaard
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2021-12-22 14:38 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Daniel Price, Martin Bark, buildroot

On Wed, 22 Dec 2021 15:07:37 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Build of nodejs fails if python 3.10 is installed on host.
> As suggested by Arnout in
> https://bugs.buildroot.org/show_bug.cgi?id=14451, use the same
> workaround than in qt5webkit to force host-python3 (which is in version
> 3.9)

We already have patches pending that bump host-python3 to 3.10, so is
this really the right approach?

Or are you sending this as something we should then backport in stable
releases, as a fix?

> It should be noted that python 3.10 support has been added in version
> 14.18.2: https://github.com/nodejs/node/releases/tag/v14.18.2

Isn't this a better approach ?

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/nodejs: force host-python3
  2021-12-22 14:38 ` Thomas Petazzoni
@ 2021-12-22 15:09   ` Fabrice Fontaine
  0 siblings, 0 replies; 4+ messages in thread
From: Fabrice Fontaine @ 2021-12-22 15:09 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Daniel Price, Martin Bark, Buildroot Mailing List

Le mer. 22 déc. 2021 à 15:38, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Wed, 22 Dec 2021 15:07:37 +0100
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > Build of nodejs fails if python 3.10 is installed on host.
> > As suggested by Arnout in
> > https://bugs.buildroot.org/show_bug.cgi?id=14451, use the same
> > workaround than in qt5webkit to force host-python3 (which is in version
> > 3.9)
>
> We already have patches pending that bump host-python3 to 3.10, so is
> this really the right approach?
>
> Or are you sending this as something we should then backport in stable
> releases, as a fix?
I would say that this patch should be applied in stable releases and master.
IMHO, this is not expected/correct that nodejs uses the python binary
that it founds on host instead of host-python3.
Currently this is raising a build failure with python 3.10 but
tomorrow, this could again raise unexpected build failures, for
example, if nodejs removes support for python 2.
>
> > It should be noted that python 3.10 support has been added in version
> > 14.18.2: https://github.com/nodejs/node/releases/tag/v14.18.2
>
> Isn't this a better approach ?
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/nodejs: force host-python3
  2021-12-22 14:07 [Buildroot] [PATCH 1/1] package/nodejs: force host-python3 Fabrice Fontaine
  2021-12-22 14:38 ` Thomas Petazzoni
@ 2022-01-09 16:26 ` Peter Korsgaard
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2022-01-09 16:26 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Daniel Price, Martin Bark, buildroot

>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:

 > Build of nodejs fails if python 3.10 is installed on host.
 > As suggested by Arnout in
 > https://bugs.buildroot.org/show_bug.cgi?id=14451, use the same
 > workaround than in qt5webkit to force host-python3 (which is in version
 > 3.9)

 > It should be noted that python 3.10 support has been added in version
 > 14.18.2: https://github.com/nodejs/node/releases/tag/v14.18.2

 > Fixes:
 >  - https://bugs.buildroot.org/show_bug.cgi?id=14451

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>

14.18.2 has in the mean time been applied, but the build should indeed
use our host-python3 - So committed, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-09 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22 14:07 [Buildroot] [PATCH 1/1] package/nodejs: force host-python3 Fabrice Fontaine
2021-12-22 14:38 ` Thomas Petazzoni
2021-12-22 15:09   ` Fabrice Fontaine
2022-01-09 16:26 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.