Bug 14451 - nodejs won't build on Fedora 35
Summary: nodejs won't build on Fedora 35
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2021.08
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-13 10:00 UTC by htenberge
Modified: 2022-01-09 16:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description htenberge 2021-12-13 10:00:07 UTC
Although I'm using host-python, the nodejs build cycle uses at some point the system python instead of the host python.

On Fedora 35 this is Python 3.10, causing problems. Switching to Python 3.9 system-wide fixes the issue.
Comment 1 Vincent Fazio 2021-12-13 16:27:52 UTC
Certain parts of the build invoke "python" and aren't using a full path to the bin to do so. While PATH has been set to include the host built python3 and PYTHON is set to host-python3 built bin, the build process is not respecting that. We do not have a symlink python -> python3 (afaik most distros do not include python by default, just python3) so when the build stage gets invoked it's using the "python" available from PATH


  LD_LIBRARY_PATH=/mnt/development/buildroot/output/build/nodejs-14.18.1/out/Release/lib.host:/mnt/development/buildroot/output/build/nodejs-14.18.1/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../tools/v8_gypfiles; mkdir -p /mnt/development/buildroot/output/build/nodejs-14.18.1/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated; python ../../deps/v8/tools/run.py "/mnt/development/buildroot/output/build/nodejs-14.18.1/out/Release/v8-qemu-wrapper" "/mnt/development/buildroot/output/build/nodejs-14.18.1/out/Release/bytecode_builtins_list_generator" "/mnt/development/buildroot/output/build/nodejs-14.18.1/out/Release/obj/gen/generate-bytecode-output-root/builtins-generated/bytecodes-builtins-list.h"
Comment 2 Arnout Vandecappelle 2021-12-14 19:03:05 UTC
We can use the same approach as in qt5webkit:

# QtWebkit's build system uses python, but only supports python2. We work
# around this by forcing python2 early in the PATH, via a python->python2
# symlink.
QT5WEBKIT_CONF_ENV = PATH=$(@D)/host-bin:$(BR_PATH)
QT5WEBKIT_MAKE_ENV = PATH=$(@D)/host-bin:$(BR_PATH)
define QT5WEBKIT_PYTHON2_SYMLINK
        mkdir -p $(@D)/host-bin
        ln -sf $(HOST_DIR)/bin/python2 $(@D)/host-bin/python
endef
QT5WEBKIT_PRE_CONFIGURE_HOOKS += QT5WEBKIT_PYTHON2_SYMLINK
Comment 3 Fabrice Fontaine 2021-12-22 14:10:42 UTC
The following patch should fix this issue:
https://patchwork.ozlabs.org/project/buildroot/patch/20211222140737.1179968-1-fontaine.fabrice@gmail.com/

Moreover, python 3.10 support has been added to nodejs 14.18.2:
https://github.com/nodejs/node/releases/tag/v14.18.2