electron / node-abi

:turtle: :rocket: Get the Node.js and Electron ABI for a given target and runtime
https://www.npmjs.com/node-abi
MIT License
164 stars 58 forks source link

Node.js 17 headers problem #114

Closed matteodisabatino closed 2 years ago

matteodisabatino commented 2 years ago

In Node.js 17.0.0 an header is missing and this cause the following error during the compilation of a C++ addon.

In file included from ../node_modules/nan/nan.h:58:
In file included from /var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.0/include/node/node.h:63:
In file included from /var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.0/include/node/v8.h:25:
In file included from /var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.0/include/node/v8-array-buffer.h:13:
In file included from /var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.0/include/node/v8-object.h:10:
/var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.0/include/node/v8-persistent-handle.h:10:10: fatal error: 'v8-weak-callback-info.h' file not found
#include "v8-weak-callback-info.h"  // NOLINT(build/include_directory)

This was a known problem and was solved in version 17.0.1; so, in order to solve this compilation error, this row should be changed to: "target": "17.0.1".

In fact, forcing prebuild to use source of Node.js 17.0.1, the compilation succeeds:

$ npx prebuild -r node -t 17.0.1 --force --strip --tag-prefix ""
prebuild info begin Prebuild version 11.0.0
prebuild info build Preparing to prebuild @matteodisabatino/gc_info@1.1.0 for node 17.0.1 on darwin-x64 using node-gyp
prebuild info find Python using Python version 3.10.0 found at "/usr/local/opt/python@3.10/bin/python3.10"
prebuild http GET https://nodejs.org/dist/v17.0.1/node-v17.0.1-headers.tar.gz
prebuild http 200 https://nodejs.org/dist/v17.0.1/node-v17.0.1-headers.tar.gz
prebuild http GET https://nodejs.org/dist/v17.0.1/SHASUMS256.txt
prebuild http 200 https://nodejs.org/dist/v17.0.1/SHASUMS256.txt
(node:9457) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
prebuild info spawn /usr/local/opt/python@3.10/bin/python3.10
prebuild info spawn args [
prebuild info spawn args   '/Users/matteodisabatino/Work/repos/gc_info/node_modules/node-gyp/gyp/gyp_main.py',
prebuild info spawn args   'binding.gyp',
prebuild info spawn args   '-Dmodule_name=gc_info',
prebuild info spawn args   '-f',
prebuild info spawn args   'make',
prebuild info spawn args   '-I',
prebuild info spawn args   '/Users/matteodisabatino/Work/repos/gc_info/build/config.gypi',
prebuild info spawn args   '-I',
prebuild info spawn args   '/Users/matteodisabatino/Work/repos/gc_info/node_modules/node-gyp/addon.gypi',
prebuild info spawn args   '-I',
prebuild info spawn args   '/var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.1/include/node/common.gypi',
prebuild info spawn args   '-Dlibrary=shared_library',
prebuild info spawn args   '-Dvisibility=default',
prebuild info spawn args   '-Dnode_root_dir=/var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.1',
prebuild info spawn args   '-Dnode_gyp_dir=/Users/matteodisabatino/Work/repos/gc_info/node_modules/node-gyp',
prebuild info spawn args   '-Dnode_lib_file=/var/folders/b1/nkhppp291574ww7ftwplz6t80000gn/T/prebuild/node/17.0.1/<(target_arch)/node.lib',
prebuild info spawn args   '-Dmodule_root_dir=/Users/matteodisabatino/Work/repos/gc_info',
prebuild info spawn args   '-Dnode_engine=v8',
prebuild info spawn args   '--depth=.',
prebuild info spawn args   '--no-parallel',
prebuild info spawn args   '--generator-output',
prebuild info spawn args   'build',
prebuild info spawn args   '-Goutput_dir=.'
prebuild info spawn args ]
prebuild info spawn make
prebuild info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/gc_info/src/gc_info.o
  CXX(target) Release/obj.target/gc_info/src/event.o
  CXX(target) Release/obj.target/gc_info/src/heap_stats.o
  CXX(target) Release/obj.target/gc_info/src/gc_stats.o
  SOLINK_MODULE(target) Release/gc_info.node
prebuild info build Stripping debug information from build/Release/gc_info.node
prebuild info build Packing build/Release/gc_info.node into prebuilds/@matteodisabatino/gc_info-v1.1.0-node-v102-darwin-x64.tar.gz
prebuild info build Prebuild written to prebuilds/@matteodisabatino/gc_info-v1.1.0-node-v102-darwin-x64.tar.gz

If you want I can provide a pull request.

VerteDinde commented 2 years ago

Thanks for the issue, @matteodisabatino ! This should be fixed in the next release 🙇‍♀️

electron-bot commented 2 years ago

:tada: This issue has been resolved in version 3.4.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

matteodisabatino commented 2 years ago

Sorry to bother again but there's something I can't understand: release 3.4.1 contains the fix this issue refers to, that means Node.js version has been switched from 17.0.0 to 17.0.1 but then has been released version 3.5.0 in which version was rolled back to 17.0.0. What happened? 🤔

MarshallOfSound commented 2 years ago

@matteodisabatino The ABI registry is auto generated, manually editing the registry will be reverted within ~30 minutes by our automation. @VerteDinde if there is an issue with the registry we'll need to update the script not the JSON file

matteodisabatino commented 2 years ago

Sorry, Is it possible to have any news?

matteodisabatino commented 2 years ago

@VerteDinde sorry, but... are there any news? The problem still persist...