Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use python 3.12 in the nodejs 22 container for native extensions. #474

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jackorp
Copy link

@jackorp jackorp commented Feb 10, 2025

A nodejs tool "node-gyp" used for compiling native extensions from npm from source requires python version >= 3.8.

Install the high-enough python version 3.12 for RHEL 8 container. RHEL 8 base version is 3.6, it is not enough for node-gyp. Python 3.12 in RHEL 8 has support until 2029,
the currently projected RHEL 8 EOL, similarly to python 3.6

nodejs-22-minimal container does not do anything with python, leave that Containerfile as-is.

A nodejs tool "node-gyp" used for compiling native extensions
from npm from source requires python version >= 3.8.

Install the high-enough python version 3.12 for RHEL 8 container.
RHEL 8 base version is 3.6, it is not enough for node-gyp.
Python 3.12 in RHEL 8 has support until 2029,
the currently projected RHEL 8 EOL, similarly to python 3.6

nodejs-22-minimal container does not do anything with python,
leave that Containerfile as-is.
Copy link

github-actions bot commented Feb 10, 2025

Pull Request validation

Failed

🔴 Approval - missing or changes were requested

Success

🟢 CI - All checks have passed
🟢 Review - Reviewed by a member

@phracek
Copy link
Member

phracek commented Feb 11, 2025

[test]

Copy link

github-actions bot commented Feb 11, 2025

Testing Farm results

namecomposearchstatusstarted (UTC)timelogs
Fedora - 18-minimalFedora-latestx86_64✅ passed11.02.2025 14:34:147min 55stest pipeline
Fedora - 18Fedora-latestx86_64❌ error11.02.2025 14:34:019min 29stest pipeline
CentOS Stream 9 - 20CentOS-Stream-9x86_64❌ error11.02.2025 14:44:0513min 24stest pipeline
Fedora - 20Fedora-latestx86_64✅ passed11.02.2025 14:45:4811min 42stest pipeline
CentOS Stream 9 - 20-minimalCentOS-Stream-9x86_64✅ passed11.02.2025 15:32:5110min 38stest pipeline
Fedora - 20-minimalFedora-latestx86_64✅ passed11.02.2025 15:44:128min 8stest pipeline
CentOS Stream 10 - 22CentOS-Stream-10x86_64✅ passed11.02.2025 17:44:0410min 25stest pipeline
RHEL9 - 18RHEL-9.4.0-Nightlyx86_64✅ passed11.02.2025 14:34:113h 23min 34stest pipeline
RHEL9 - 18-minimalRHEL-9.4.0-Nightlyx86_64✅ passed11.02.2025 14:34:513h 23min 10stest pipeline
RHEL8 - 18RHEL-8.10.0-Nightlyx86_64✅ passed11.02.2025 14:34:003h 26min 7stest pipeline
Fedora - 22Fedora-latestx86_64❌ error11.02.2025 17:47:2513min 1stest pipeline
RHEL8 - 18-minimalRHEL-8.10.0-Nightlyx86_64✅ passed11.02.2025 14:42:383h 21min 42stest pipeline
CentOS Stream 10 - 22-minimalCentOS-Stream-10x86_64✅ passed11.02.2025 17:58:308min 56stest pipeline
Fedora - 22-minimalFedora-latestx86_64✅ passed11.02.2025 17:58:329min 14stest pipeline
RHEL8 - 20RHEL-8.10.0-Nightlyx86_64✅ passed11.02.2025 14:59:073h 15min 50stest pipeline
RHEL9 - 20RHEL-9.4.0-Nightlyx86_64✅ passed11.02.2025 15:08:443h 14min 34stest pipeline
RHEL8 - 20-minimalRHEL-8.10.0-Nightlyx86_64✅ passed11.02.2025 16:14:363h 6min 24stest pipeline
RHEL9 - 20-minimalRHEL-9.4.0-Nightlyx86_64✅ passed11.02.2025 17:43:522h 25min 2stest pipeline
RHEL9 - 22-minimalRHEL-9.4.0-Nightlyx86_64✅ passed11.02.2025 18:01:162h 18min 26stest pipeline
RHEL10 - 22-minimalRHEL-10-Nightlyx86_64✅ passed11.02.2025 18:01:202h 18min 20stest pipeline
RHEL10 - 22RHEL-10-Nightlyx86_64❌ error11.02.2025 17:48:252h 32min 47stest pipeline
RHEL8 - 22-minimalRHEL-8.10.0-Nightlyx86_64✅ passed11.02.2025 18:01:042h 23min 1stest pipeline
RHEL9 - 22RHEL-9.4.0-Nightlyx86_64✅ passed11.02.2025 17:57:342h 26min 34stest pipeline
RHEL8 - 22RHEL-8.10.0-Nightlyx86_64✅ passed11.02.2025 17:54:302h 33min 29stest pipeline

@phracek
Copy link
Member

phracek commented Feb 12, 2025

RHEL10 failed here:

npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error rdkafka_admin.c: In function 'rd_kafka_UserScramCredentialUpsertion_new':
npm error rdkafka_admin.c:5986:21: error: implicit declaration of function 'RAND_priv_bytes' [-Wimplicit-function-declaration]
npm error  5986 |                 if (RAND_priv_bytes(random_salt, sizeof(random_salt)) == 1) {
npm error       |                     ^~~~~~~~~~~~~~~
npm error make[2]: *** [../mklove/Makefile.base:97: rdkafka_admin.o] Error 1
npm error make[1]: *** [Makefile:27: libs] Error 2
npm error make: *** [deps/librdkafka.target.mk:30: 11a9e3388a67e1ca5c31c1d8da49cb6d2714eb41.intermediate] Error 2
npm error gyp ERR! build error 
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules_22/npm/node_modules/node-gyp/lib/build.js:216:23)
npm error gyp ERR! System Linux 6.12.0-48.el10.x86_64
npm error gyp ERR! command "/usr/bin/node-22" "/usr/lib/node_modules_22/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /opt/app-root/src/node_modules/node-rdkafka
npm error gyp ERR! node -v v22.11.0
npm error gyp ERR! node-gyp -v v10.2.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: /opt/app-root/src/.npm/_logs/2025-02-11T20_19_18_326Z-debug-0.log
Error: building at STEP "RUN /usr/libexec/s2i/assemble": while running runtime: exit status 1
  ERROR: Failed to to build /tmp/tmp.h7eUN9OVnp/Dockerfile.sURe
Test for image 'ubi10/nodejs-22:1' FAILED (exit code: 1)

Fedora 22 passed, but the result is FAILED. Error in common module. The same for CentOS Stream 9

Copy link
Member

@phracek phracek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RHEL10 is still failing on rdkafka. See comment.

@jackorp
Copy link
Author

jackorp commented Feb 12, 2025

RHEL10 is still failing on rdkafka. See comment.

Not sure what can be done about that currently from our side as that is node-rdkafka bundled library's compilation problem, I'd guess confluentinc/librdkafka#4732 fixes that, but it is still open.

But the test got through python in node-gyp in other streams so there it is a betterment on RHEL 8 and fix of no longer using incorrect python with nodejs:22.

@jackorp
Copy link
Author

jackorp commented Feb 12, 2025

Actually this has better description of what's going on, which is OpenSSL incompatibility confluentinc/librdkafka#4911 and confluentinc/librdkafka#3535 should have fixed it, but the npm package node-rdkafka has the library as a git submodule and it's compiled as part of npm install... They probably need to update it.

@mhdawson
Copy link
Member

@khardix was this all that was needed to fixup the issue with respect to RHEL 8 the python version and the problems with node-rdkafka or was there something else?

@pacostas confirmed today that the issue on RHEL 9 has been resolved, there was an update 2 days ago that pulled in the new version of librdkafka that the needed fix with respect to OpenSSL.

@jackorp
Copy link
Author

jackorp commented Feb 20, 2025

was this all that was needed to fixup the issue with respect to RHEL 8 the python version and the problems with node-rdkafka or was there something else?

This will satisfy node-gyp's requirement for python >= 3.8 (that I last looked at)

confirmed today that the issue on RHEL 9 has been resolved, there was an update 2 days ago that pulled in the new version of librdkafka that the needed fix with respect to OpenSSL.

One problem fixed, another added. Now, we have too old compiler, default RHEL 8 gcc does not understand -std=c++20 introduced here: Blizzard/node-rdkafka@c8389ea

$ rpm -qa python3.12 npm nodejs gcc-c++
npm-10.9.2-1.22.13.1.1.module+el8.10.0+22759+46b58560.x86_64
gcc-c++-8.5.0-23.el8_10.x86_64
python3.12-3.12.8-1.el8_10.x86_64
nodejs-22.13.1-1.module+el8.10.0+22759+46b58560.x86_64
$ npm install node-rdkafka
<snip>
npm error make[1]: Leaving directory '/root/node_modules/node-rdkafka/deps/librdkafka'
npm error   TOUCH Release/obj.target/deps/librdkafka.stamp
npm error   CXX(target) Release/obj.target/node-librdkafka/src/binding.o
npm error rm 11a9e3388a67e1ca5c31c1d8da49cb6d2714eb41.intermediate
npm error make: Leaving directory '/root/node_modules/node-rdkafka/build'
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | linux | x64
npm error gyp info find Python using Python version 3.12.8 found at "/usr/bin/python3"
npm error gyp info spawn /usr/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/node_modules/node-rdkafka/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/root/.cache/node-gyp/22.13.1/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/22.13.1',
npm error gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/22.13.1/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/root/node_modules/node-rdkafka',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error g++: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?
npm error make: *** [node-librdkafka.target.mk:128: Release/obj.target/node-librdkafka/src/binding.o] Error 1
npm error gyp ERR! build error
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:216:23)
npm error gyp ERR! System Linux 6.12.11-200.fc41.x86_64
npm error gyp ERR! command "/usr/bin/node-22" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /root/node_modules/node-rdkafka
npm error gyp ERR! node -v v22.13.1
npm error gyp ERR! node-gyp -v v11.0.0
npm error gyp ERR! not ok

Notice line: npm error g++: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?

@khardix
Copy link
Contributor

khardix commented Feb 24, 2025

One problem fixed, another added. Now, we have too old compiler, default RHEL 8 gcc does not understand -std=c++20 introduced here: Blizzard/node-rdkafka@c8389ea

Well, Node 22 cannot itself be compiled with the default gcc; we use gcc-toolset-12 in the spec file. I would suggest doing the same for this test.

@jackorp
Copy link
Author

jackorp commented Feb 24, 2025

Well, Node 22 cannot itself be compiled with the default gcc; we use gcc-toolset-12 in the spec file. I would suggest doing the same for this test.

That would also mean introducing it for the container, but I think it is a reasonable assumption from npm package developers that a capable enough compiler that was used for node build is used for npm compilation as well. Let's try it out here.

Node.js 22's minimal GCC requirement is higher than the default GCC
and GCC-C++ available on RHEL 8. It is reasonable from npm module
developers to expect at least the minimal version node.js supports
for compilation will be available to also compile the native extension
from source.

Therefore use and enable the gcc-toolset-14 collection inside container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants