From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 10 Nov 2023 09:00:48 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1r1MRc-005WTD-0c for lore@lore.pengutronix.de; Fri, 10 Nov 2023 09:00:48 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1r1MRc-0007gY-Ic; Fri, 10 Nov 2023 09:00:48 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r1MRT-0007gL-MP; Fri, 10 Nov 2023 09:00:39 +0100 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r1MRT-007y9H-9J; Fri, 10 Nov 2023 09:00:39 +0100 Received: from mol by pty.whiteo.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r1MRT-00EgPU-0A; Fri, 10 Nov 2023 09:00:39 +0100 Date: Fri, 10 Nov 2023 09:00:38 +0100 From: Michael Olbrich To: Jean-Claude Monnin Message-ID: Mail-Followup-To: Jean-Claude Monnin , ptxdist@pengutronix.de References: <2140a7cd-a17c-4400-a223-7692942b1ade@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2140a7cd-a17c-4400-a223-7692942b1ade@app.fastmail.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain Subject: Re: [ptxdist] Error building nodejs in 2023.10.0 X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Hallo, On Wed, Nov 01, 2023 at 05:04:30PM +0100, Jean-Claude Monnin wrote: > When trying to build nodejs with the latest ptxdist, I faced an error about missing a python module `ModuleNotFoundError: No module named '_bz2'` (see [1]). > > I'm not very proficient with ptxdist, so I would like to check if the solution I came up is correct. Feedback welcome. If solution is ok, feel free to apply it upstream or ask for a proper email patch. > > I think it's due to following issues: > - The host python is missing the option to support BZIP2. I added an option for that. > - nodejs.in says it depends on HOST_SYSTEM_PYTHON3, however it seems like the build isn't using system python but host python built by ptxdist. I think it should depend on HOST_PYTHON3 and the new HOST_PYTHON3_BZIP2. > > See [2] for the patch I applied. Python in PTXdist is a bit tricky. We don't want to compile Python itself just to run a few Python scripts at build-time. That's what "host-system-python3" is for. It does not build anything, it just checks if Python3 and required packages are installed. "host-python3" is used when building Python packages for the target. In this case, it looks like the wrong Python is used. Which ptxdist version are you using? Michael > Kind regards, > Jean-Claude > > > [1] Error message > > ---------------------- > target: nodejs.prepare > ---------------------- > > Node.js configure: Found Python 3.11.2... > Traceback (most recent call last): > File "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/./configure", line 28, in > import configure > File "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/configure.py", line 14, in > import bz2 > File "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/sysroot-target/usr/lib/python3.11/bz2.py", line 17, in > from _bz2 import BZ2Compressor, BZ2Decompressor > ModuleNotFoundError: No module named '_bz2' > > > [2] possible patch > > diff --git a/rules/host-python3.in b/rules/host-python3.in > index e15b90571..64f34affa 100644 > --- a/rules/host-python3.in > +++ b/rules/host-python3.in > @@ -6,6 +6,7 @@ config HOST_PYTHON3 > select HOST_LIBFFI > select HOST_OPENSSL > select HOST_ZLIB if HOST_PYTHON3_ZLIB > + select HOST_BZIP2 if HOST_PYTHON3_BZIP2 > default y if ALLYES > help > Python is an interpreted, interactive, > @@ -16,4 +17,7 @@ if HOST_PYTHON3 > config HOST_PYTHON3_ZLIB > bool > > +config HOST_PYTHON3_BZIP2 > + bool > + > endif > diff --git a/rules/nodejs.in b/rules/nodejs.in > index 80c6aec21..c75480953 100644 > --- a/rules/nodejs.in > +++ b/rules/nodejs.in > @@ -3,7 +3,8 @@ > config NODEJS > tristate > prompt "Node.js " > - select HOST_SYSTEM_PYTHON3 > + select HOST_PYTHON3 > + select HOST_PYTHON3_BZIP2 > select HOST_QEMU > select HOST_QEMU_USR > select C_ARES > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |