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

Node v18+ (and soon v16) has changed to using quictls instead of openssl, nixpkgs derivation is outdated #200515

Open
CMCDragonkai opened this issue Nov 10, 2022 · 1 comment
Labels
0.kind: packaging request Request for a new package to be added 6.topic: nodejs

Comments

@CMCDragonkai
Copy link
Member

Project description

Official nodejs has changed to using quictls (OpenSSL fork with QUIC support). This can be proven by looking at process.versions of downloaded nodejs binaries from https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.xz.

However the current nixpkgs derivation for nodejs still uses openssl and not quictls.

Nixpkgs does have quictls already available https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/quictls/default.nix.

This change is necessary for when NodeJS will have proper quic support.

Older NodeJS versions will still need to use the original openssl.

See the change log here: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md.

And also nodejs/node#45286 which landed in nodejs/node@4124b03...9fb612e.

This change is also occurring for v16 too: nodejs/node#45274

@CMCDragonkai CMCDragonkai added the 0.kind: packaging request Request for a new package to be added label Nov 10, 2022
@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Nov 10, 2022

To prove my point. With respect to https://gist.github.com/CMCDragonkai/1cac0299230f110a6f842ceb654fa0d0

I downloaded https://nodejs.org/dist/v18.12.1/node-v18.12.1-linux-x64.tar.xz.

Then extracted it out with tar xf ./node-v18.12.1-linux-x64.tar.xz.

Now using ldd ./bin/node we see:

[nix-shell:~/Downloads/node18/node-v18.12.1-linux-x64]$ ldd ./bin/node 
	linux-vdso.so.1 (0x00007ffe3ad4e000)
	libdl.so.2 => /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib/libdl.so.2 (0x00007fbaf4a1f000)
	libstdc++.so.6 => not found
	libm.so.6 => /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib/libm.so.6 (0x00007fbaf4946000)
	libgcc_s.so.1 => /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib/libgcc_s.so.1 (0x00007fbaf492c000)
	libpthread.so.0 => /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib/libpthread.so.0 (0x00007fbaf4927000)
	libc.so.6 => /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib/libc.so.6 (0x00007fbaf4727000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib64/ld-linux-x86-64.so.2 (0x00007fbaf4a26000)

We have to set the interpreter AND rpath:

cd bin
patchelf --set-interpreter '/nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib64/ld-linux-x86-64.so.2' ./node
patchelf --set-rpath '/nix/store/lyl6nysc3i3aqhj6shizjgj0ibnf1pvg-glibc-2.34-210/lib:/nix/store/g9x3cm8wdmpm86pyiff6arx8skmdwkn7-gcc-11.3.0-lib/lib' ./node 

I got the interpreter and rpath from my current node in my nix-shell. You can choose to use other ones, just enter a nix-shell with node and look at ldd $(which node) and patchelf --print-rpath $(which node).

Now enter node and run process.versions:

[nix-shell:~/Downloads/node18/node-v18.12.1-linux-x64/bin]$ ./node 
Welcome to Node.js v18.12.1.
Type ".help" for more information.
> process.versions
{
  node: '18.12.1',
  v8: '10.2.154.15-node.12',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.10',
  openssl: '3.0.7+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022b',
  unicode: '14.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}
> 

You can see here that the official openssl is now 3.0.7+quic (at the same time the ngtcp2 and nghttp3 is available internally even if the JS interface isn't ready yet).

Whereas if you get the current nodejs-18_x on nixpkgs master, and you build it, you'll instead see:

Welcome to Node.js v18.12.1.
Type ".help" for more information.
> process.versions
{
  node: '18.12.1',
  v8: '10.2.154.15-node.12',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.10',
  openssl: '3.0.7',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022a',
  unicode: '14.0'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: packaging request Request for a new package to be added 6.topic: nodejs
Projects
Status: Todo
Development

No branches or pull requests

2 participants