mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Jean-Claude Monnin" <jc_monnin@emailplus.org>
To: "Michael Olbrich" <m.olbrich@pengutronix.de>
Cc: ptxdist@pengutronix.de
Subject: Re: [ptxdist] Error building nodejs in 2023.10.0
Date: Fri, 10 Nov 2023 09:44:03 +0100	[thread overview]
Message-ID: <17cbff84-d77c-4dce-9a7c-b45b1055f693@app.fastmail.com> (raw)
In-Reply-To: <ZU3jJu/jOqlSS8HB@pengutronix.de>

Hi Michael,

Thanks for the reply. I'm using ptxdist-2023.10.0.
Python is called by the node build system, and it looks like it was using the host python in my case. Possibly it's because another package selects host python; maybe it works if host python isn't there at all.
I'm happy with the workaround, but I see your point of wanting to use system python instead. Is there any way to check/fix why it selects host python on my system?

Jean-Claude

On Fri, Nov 10, 2023, at 9:00 AM, Michael Olbrich wrote:
> 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 <module>
>>     import configure
>>   File "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/configure.py", line 14, in <module>
>>     import bz2
>>   File "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/sysroot-target/usr/lib/python3.11/bz2.py", line 17, in <module>
>>     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 |



  reply	other threads:[~2023-11-10  8:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 16:04 Jean-Claude Monnin
2023-11-10  8:00 ` Michael Olbrich
2023-11-10  8:44   ` Jean-Claude Monnin [this message]
2023-11-10  8:55     ` [ptxdist] [PATCH] nodejs: explicitly call configure with 'python3' Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17cbff84-d77c-4dce-9a7c-b45b1055f693@app.fastmail.com \
    --to=jc_monnin@emailplus.org \
    --cc=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox