brave/adblock-rust

Cannot install npm version using `node` 16.0.0

antonok-edm opened this issue · 2 comments

Backtrace from npm install --save adblock-rs:

npm ERR! The following warnings were emitted during compilation:
npm ERR!
npm ERR! warning: ar: node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/build/Release/obj.target/neon/src/neon.o: No such file or directory
npm ERR!
npm ERR! error: failed to run custom build command for `neon-sys v0.3.3`
npm ERR!
npm ERR! Caused by:
npm ERR!   process didn't exit successfully: `node_modules/adblock-rs/native/target/release/build/neon-sys-0bb4e5497a9f6cc1/build-script-build` (exit status: 101)
npm ERR!   --- stdout
npm ERR!   Skipping node-gyp installation as part of npm install.
npm ERR!
npm ERR!   > build-release
npm ERR!   > node-gyp build
npm ERR!
npm ERR!   make: Entering directory 'node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/build'
npm ERR!     CXX(target) Release/obj.target/neon/src/neon.o
npm ERR!   make: Leaving directory 'node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/build'
npm ERR!   TARGET = Some("x86_64-unknown-linux-gnu")
npm ERR!   HOST = Some("x86_64-unknown-linux-gnu")
npm ERR!   AR_x86_64-unknown-linux-gnu = None
npm ERR!   AR_x86_64_unknown_linux_gnu = None
npm ERR!   HOST_AR = None
npm ERR!   AR = None
npm ERR!   running: "ar" "crs" "node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/libneon.a" "node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/build/Release/obj.target/neon/src/neon.o"
npm ERR!   cargo:warning=ar: node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/build/Release/obj.target/neon/src/neon.o: No such file or directory
npm ERR!   exit status: 1
npm ERR!
npm ERR!   --- stderr
npm ERR!   gyp info it worked if it ends with ok
npm ERR!   gyp info using node-gyp@3.6.2
npm ERR!   gyp info using node@16.0.0 | linux | x64
npm ERR!   gyp info spawn make
npm ERR!   gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR!   In file included from ../src/neon.cc:2:
npm ERR!   ../node_modules/nan/nan.h: In function ‘void Nan::AsyncQueueWorker(Nan::AsyncWorker*)’:
npm ERR!   ../node_modules/nan/nan.h:2298:7: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
npm ERR!    2298 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
npm ERR!         |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR!   In file included from ../src/neon.cc:10:
npm ERR!   ../src/neon_task.h: In member function ‘void neon::Task::complete()’:
npm ERR!   ../src/neon_task.h:62:70: warning: ‘v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
npm ERR!      62 |     node::MakeCallback(isolate_, context->Global(), callback, 2, argv);
npm ERR!         |                                                                      ^
npm ERR!   In file included from ../node_modules/nan/nan.h:54,
npm ERR!                    from ../src/neon.cc:2:
npm ERR!   /home/antonok/.node-gyp/16.0.0/include/node/node.h:184:50: note: declared here
npm ERR!     184 |                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
npm ERR!         |                                                  ^~~~~~~~~~~~
npm ERR!   /home/antonok/.node-gyp/16.0.0/include/node/node.h:101:42: note: in definition of macro ‘NODE_DEPRECATED’
npm ERR!     101 |     __attribute__((deprecated(message))) declarator
npm ERR!         |                                          ^~~~~~~~~~
npm ERR!   In file included from ../src/neon.cc:10:
npm ERR!   ../src/neon_task.h: In function ‘void neon::queue_task(neon::Task*)’:
npm ERR!   ../src/neon_task.h:98:17: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
npm ERR!      98 |                 (uv_after_work_cb)complete_task);
npm ERR!         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR!   ../src/neon.cc: In function ‘size_t Neon_ArrayBuffer_Data(void**, v8::Local<v8::ArrayBuffer>)’:
npm ERR!   ../src/neon.cc:216:60: warning: ‘v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents()’ is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
npm ERR!     216 |   v8::ArrayBuffer::Contents contents = buffer->GetContents();
npm ERR!         |                                                            ^
npm ERR!   In file included from /home/antonok/.node-gyp/16.0.0/include/node/node.h:63,
npm ERR!                    from ../node_modules/nan/nan.h:54,
npm ERR!                    from ../src/neon.cc:2:
npm ERR!   /home/antonok/.node-gyp/16.0.0/include/node/v8.h:5572:12: note: declared here
npm ERR!    5572 |   Contents GetContents();
npm ERR!         |            ^~~~~~~~~~~
npm ERR!   ../src/neon.cc: In function ‘void Neon_Class_SetClassMap(v8::Isolate*, void*, Neon_DropCallback)’:
npm ERR!   ../src/neon.cc:328:16: error: cannot convert ‘void (*)(void*)’ to ‘node::Environment*’
npm ERR!     328 |   node::AtExit(cleanup_class_map, holder);
npm ERR!         |                ^~~~~~~~~~~~~~~~~
npm ERR!         |                |
npm ERR!         |                void (*)(void*)
npm ERR!   In file included from ../node_modules/nan/nan.h:54,
npm ERR!                    from ../src/neon.cc:2:
npm ERR!   /home/antonok/.node-gyp/16.0.0/include/node/node.h:898:38: note:   initializing argument 1 of ‘void node::AtExit(node::Environment*, void (*)(void*), void*)’
npm ERR!     898 | NODE_EXTERN void AtExit(Environment* env,
npm ERR!         |                         ~~~~~~~~~~~~~^~~
npm ERR!   In file included from ../src/neon.cc:8:
npm ERR!   ../src/neon_string.h: In member function ‘v8::Local<v8::String> neon::Slice::ToJsString(v8::Isolate*, const char*)’:
npm ERR!   ../src/neon_string.h:28:18: warning: ignoring return value of ‘bool v8::MaybeLocal<T>::ToLocal(v8::Local<S>*) const [with S = v8::String; T = v8::String]’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
npm ERR!      28 |     maybe.ToLocal(&result);
npm ERR!         |     ~~~~~~~~~~~~~^~~~~~~~~
npm ERR!   make: *** [neon.target.mk:103: Release/obj.target/neon/src/neon.o] Error 1
npm ERR!   gyp ERR! build error
npm ERR!   gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR!   gyp ERR! stack     at ChildProcess.onExit (node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/node_modules/node-gyp/lib/build.js:258:23)
npm ERR!   gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR!   gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR!   gyp ERR! System Linux 5.11.16-arch1-1
npm ERR!   gyp ERR! command "/usr/bin/node" "node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/node_modules/.bin/node-gyp" "build"
npm ERR!   gyp ERR! cwd node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native
npm ERR!   gyp ERR! node -v v16.0.0
npm ERR!   gyp ERR! node-gyp -v v3.6.2
npm ERR!   gyp ERR! not ok
npm ERR!   thread 'main' panicked at '
npm ERR!
npm ERR!   Internal error occurred: Command "ar" "crs" "node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/libneon.a" "node_modules/adblock-rs/native/target/release/build/neon-sys-11111d7aa1e4def0/out/native/build/Release/obj.target/neon/src/neon.o" with args "ar" did not execute successfully (status code exit status: 1).
npm ERR!
npm ERR!   ', /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.35/src/lib.rs:2398:5
npm ERR!   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Likely the Neon bindings need to be updated.

I've built a WIP branch with Neon 8.0 and the newer N-API, but that doesn't seem to help. Likely just that Neon has not yet added support for Node 16.

It will work correctly once build.rs is removed: neon-bindings/neon#729 (comment)