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-gyp assumes nodejs 8 is compiled against openssl 1.0, but it might not #1415

Closed
kapouer opened this issue Apr 14, 2018 · 9 comments
Closed

Comments

@kapouer
Copy link
Contributor

kapouer commented Apr 14, 2018

Hi,

the nodejs 8.11 debian (testing/sid) debian package is built against openssl 1.1.0.
When one compiles a module using directly the node-gyp debian package, it's all
right because headers are available where expected. In the module directory,
node-gyp rebuild succeeds.
When one compiles using manually installed npm 5.8.0 (and maybe olders), it pulls
its own node-gyp copy, which in turn gets nodejs headers for the installed version it
finds, but there node-gyp seems to install openssl 1.0 headers, making npm install
fail.
You can see that behavior with @kapouer/[email protected] which will fail
to compile using openssl 1.0 headers.

@kapouer
Copy link
Contributor Author

kapouer commented Apr 14, 2018

@nodejs/delivery-channels might be interested by that kind of problem.

@kapouer
Copy link
Contributor Author

kapouer commented Apr 14, 2018

{ http_parser: '2.8.1',
  node: '8.11.1',
  v8: '6.2.414.50',
  uv: '1.18.0',
  zlib: '1.2.8',
  ares: '1.14.0',
  modules: '57',
  nghttp2: '1.31.0',
  openssl: '1.1.0h',
  icu: '57.1',
  unicode: '8.0',
  cldr: '29.0',
  tz: '2016b' }

@bnoordhuis
Copy link
Member

node-gyp gets the download URL from process.release.headersUrl. Override that with ./configure --release-urlbase=https://example.org/download/release/. The default ishttps://nodejs.org/download/release/.

@kapouer
Copy link
Contributor Author

kapouer commented Apr 14, 2018

Good to know. I suppose it would be up to nodejs to bundle its headers / expose a path to them somehow.
Or would it be possible for node-gyp to accept a directory path for headersUrl (typically /usr/include/nodejs/ on debian) instead of an url-to-tarball ?

@bnoordhuis
Copy link
Member

it would be up to nodejs to bundle its headers / expose a path to them somehow.

Not sure what you mean.

would it be possible for node-gyp to accept a directory path for headersUrl [..] instead of an url-to-tarball

I guess it could. If you want to look into that, you probably need a patch like this:

diff --git a/lib/configure.js b/lib/configure.js
index bc39302..44cc472 100644
--- a/lib/configure.js
+++ b/lib/configure.js
@@ -50,6 +50,10 @@ function configure (gyp, argv, callback) {
     // 'python' should be set by now
     process.env.PYTHON = python
 
+    if (RegExp('^file://').test(release.tarballUrl)) {
+      gyp.opts.nodedir = release.tarballUrl.slice('file://'.length)
+    }
+
     if (gyp.opts.nodedir) {
       // --nodedir was specified. use that for the dev files
       nodeDir = gyp.opts.nodedir.replace(/^~/, osenv.home())

@kapouer
Copy link
Contributor Author

kapouer commented Apr 15, 2018

it would be up to nodejs to bundle its headers / expose a path to them somehow.
Not sure what you mean.

I meant: if nodejs bundled/installed its headers, then node-gyp would naturally have to use them instead of downloading them.

I'll try the patch. What's missing ? Tests ?

@bnoordhuis
Copy link
Member

Yep, needs tests.

@rvagg
Copy link
Member

rvagg commented Jun 20, 2019

This comes back to the detect-local-headers problem that's been lingering for a long time, node-gyp should first try and find them locally before downloading them, it'd solve many problems (probably introduce a few too!) but it needs someone to put in that work.

@rvagg rvagg closed this as completed Jun 20, 2019
@rvagg
Copy link
Member

rvagg commented Jun 20, 2019

Ref: #1247 is where we could track local-headers work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants