Hi,
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.
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