Message ID | 20211222140737.1179968-1-fontaine.fabrice@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/1] package/nodejs: force host-python3 | expand |
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
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
>>>>> "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.
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
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(-)