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

Crashes with firewalker npm module #15054

Closed
lenovouser opened this issue Nov 8, 2024 · 3 comments
Closed

Crashes with firewalker npm module #15054

lenovouser opened this issue Nov 8, 2024 · 3 comments
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@lenovouser
Copy link
Contributor

What version of Bun is running?

1.1.34+5e5e7c60f

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

import { Firewall } from 'firewalker';

const firewall = new Firewall();

What is the expected behavior?

To not crash.

What do you see instead?

It crashes with:

{
  dir: "/Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/ref-napi",
}
58 |     'node=' + process.versions.node,
59 |     process.versions.electron ? 'electron=' + process.versions.electron : '',
60 |     typeof __webpack_require__ === 'function' ? 'webpack=true' : '' // eslint-disable-line
61 |   ].filter(Boolean).join(' ')
62 |
63 |   throw new Error('No native build was found for ' + target + '\n    loaded from: ' + dir + '\n')
             ^
error: No native build was found for platform=darwin arch=arm64 runtime=node abi=127 uv=1 armv=8 libc=glibc node=22.6.0
    loaded from: /Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/ref-napi

      at /Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/node-gyp-build/node-gyp-build.js:63:9
      at load (/Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/node-gyp-build/node-gyp-build.js:22:30)
      at /Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/ref-napi/lib/ref.js:8:18
      at /Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/ffi-napi/lib/ffi.js:7:7
      at /Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/firewalker/dist/wirefilter.js:17:20
      at /Users/silas/Workspace/panascais/projects/experiments/node_modules/.pnpm/[email protected]/node_modules/firewalker/dist/firewall.js:24:7

Bun v1.1.34 (macOS arm64)

Image

Additional information

I also reported the bug in SerCeMan/firewalker#44, but after looking at it again it might be an issue in Bun.

@lenovouser lenovouser added bug Something isn't working needs triage labels Nov 8, 2024
@nektro
Copy link
Member

nektro commented Nov 8, 2024

we can see in https://unpkg.com/browse/[email protected]/prebuilds/ they indeed have no darwin-arm64 build

@nektro nektro added bun install Something that relates to the npm-compatible client and removed needs triage labels Nov 8, 2024
@nektro
Copy link
Member

nektro commented Nov 8, 2024

using npm i also get an error, havent fully digested it yet though

npm install firewalker
❯ npm install firewalker                                      
npm error code 1
npm error path /Users/meghandenny/src/test/node_modules/ffi-napi
npm error command failed
npm error command sh -c node-gyp-build
npm error CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm error   LIBTOOL-STATIC Release/nothing.a
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/aarch64/ffi.o
npm error   CC(target) Release/obj.target/ffi/deps/libffi/src/aarch64/sysv.o
npm error   LIBTOOL-STATIC Release/libffi.a
npm error   CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
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] | darwin | arm64
npm error gyp info find Python using Python version 3.12.6 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
npm error gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
npm error gyp info spawn args [
npm error gyp info spawn args '/opt/homebrew/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 '/Users/meghandenny/src/test/node_modules/ffi-napi/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/meghandenny/Library/Caches/node-gyp/22.9.0/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=/Users/meghandenny/Library/Caches/node-gyp/22.9.0',
npm error gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/meghandenny/Library/Caches/node-gyp/22.9.0/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/meghandenny/src/test/node_modules/ffi-napi',
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 warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm error ../deps/libffi/src/java_raw_api.c:328:46: warning: 'ffi_java_raw_size' is deprecated [-Wdeprecated-declarations]
npm error   328 |   ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
npm error       |                                              ^
npm error ../deps/libffi/config/mac/arm64/ffi.h:299:56: note: 'ffi_java_raw_size' has been explicitly marked deprecated here
npm error   299 | size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
npm error       |                                                        ^
npm error ../deps/libffi/src/java_raw_api.c:331:3: warning: 'ffi_java_ptrarray_to_raw' is deprecated [-Wdeprecated-declarations]
npm error   331 |   ffi_java_ptrarray_to_raw (cif, avalue, raw);
npm error       |   ^
npm error ../deps/libffi/config/mac/arm64/ffi.h:295:93: note: 'ffi_java_ptrarray_to_raw' has been explicitly marked deprecated here
npm error   295 | void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) __attribute__((deprecated));
npm error       |                                                                                             ^
npm error 2 warnings generated.
npm error ../deps/libffi/src/aarch64/ffi.c:738:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
npm error   738 |       if (i + 1 == cif->aarch64_nfixedargs)
npm error       |           ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
npm error ../deps/libffi/src/aarch64/ffi.c:991:17: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
npm error   991 |       if (i + 1 == cif->aarch64_nfixedargs)
npm error       |           ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~
npm error 2 warnings generated.
npm error In file included from ../src/ffi.cc:5:
npm error /Users/meghandenny/src/test/node_modules/get-uv-event-loop-napi-h/include/get-uv-event-loop-napi.h:26:30: error: incompatible function pointer types assigning to 'get_uv_event_loop_fn' (aka 'napi_status (*)(napi_env__ *, uv_loop_s **)') from 'napi_status (*)(node_api_basic_env, struct uv_loop_s **)' (aka 'napi_status (*)(const napi_env__ *, uv_loop_s **)')
npm error    26 |   napi_get_uv_event_loop__ = &napi_get_uv_event_loop;
npm error       |                              ^~~~~~~~~~~~~~~~~~~~~~~
npm error In file included from ../src/ffi.cc:3:
npm error In file included from ../src/ffi.h:2:
npm error In file included from /Users/meghandenny/src/test/node_modules/node-addon-api/napi.h:2725:
npm error /Users/meghandenny/src/test/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
npm error    63 |   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm error       |            ^~~~~~~~~~~~~~~~~~
npm error /Users/meghandenny/src/test/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm error  1965 |     status = Napi::details::AttachData(env, *result, data);
npm error       |                             ^
npm error /Users/meghandenny/src/test/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<Napi::Value (*)(const Napi::CallbackInfo &), Napi::Value>>' requested here
npm error  2021 |   napi_status status = CreateFunction(env,
npm error       |                        ^
npm error ../src/ffi.cc:58:38: note: in instantiation of function template specialization 'Napi::Function::New<Napi::Value (*)(const Napi::CallbackInfo &)>' requested here
npm error    58 |   target["ffi_prep_cif"] = Function::New(env, FFIPrepCif);
npm error       |                                      ^
npm error /Users/meghandenny/Library/Caches/node-gyp/22.9.0/include/node/js_native_api.h:525:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_basic_finalize' (aka 'void (*)(const napi_env__ *, void *, void *)') for 4th argument
npm error   525 | napi_add_finalizer(napi_env env,
npm error       | ^
npm error   526 |                    napi_value js_object,
npm error   527 |                    void* finalize_data,
npm error   528 |                    node_api_basic_finalize finalize_cb,
npm error       |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm error In file included from ../src/ffi.cc:3:
npm error In file included from ../src/ffi.h:2:
npm error In file included from /Users/meghandenny/src/test/node_modules/node-addon-api/napi.h:2725:
npm error /Users/meghandenny/src/test/node_modules/node-addon-api/napi-inl.h:63:12: error: no matching function for call to 'napi_add_finalizer'
npm error    63 |   status = napi_add_finalizer(env, obj, data, finalizer, hint, nullptr);
npm error       |            ^~~~~~~~~~~~~~~~~~
npm error /Users/meghandenny/src/test/node_modules/node-addon-api/napi-inl.h:1965:29: note: in instantiation of function template specialization 'Napi::details::AttachData<Napi::details::CallbackData<void (*)(const Napi::CallbackInfo &), void>>' requested here
npm error  1965 |     status = Napi::details::AttachData(env, *result, data);
npm error       |                             ^
npm error /Users/meghandenny/src/test/node_modules/node-addon-api/napi-inl.h:2021:24: note: in instantiation of function template specialization 'Napi::CreateFunction<Napi::details::CallbackData<void (*)(const Napi::CallbackInfo &), void>>' requested here
npm error  2021 |   napi_status status = CreateFunction(env,
npm error       |                        ^
npm error ../src/ffi.cc:60:34: note: in instantiation of function template specialization 'Napi::Function::New<void (*)(const Napi::CallbackInfo &)>' requested here
npm error    60 |   target["ffi_call"] = Function::New(env, FFICall);
npm error       |                                  ^
npm error /Users/meghandenny/Library/Caches/node-gyp/22.9.0/include/node/js_native_api.h:525:1: note: candidate function not viable: no known conversion from 'napi_finalize' (aka 'void (*)(napi_env__ *, void *, void *)') to 'node_api_basic_finalize' (aka 'void (*)(const napi_env__ *, void *, void *)') for 4th argument
npm error   525 | napi_add_finalizer(napi_env env,
npm error       | ^
npm error   526 |                    napi_value js_object,
npm error   527 |                    void* finalize_data,
npm error   528 |                    node_api_basic_finalize finalize_cb,
npm error       |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm error 3 errors generated.
npm error make: *** [Release/obj.target/ffi_bindings/src/ffi.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> (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:216:23)
npm error gyp ERR! System Darwin 24.0.0
npm error gyp ERR! command "/opt/homebrew/Cellar/node/22.9.0_1/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /Users/meghandenny/src/test/node_modules/ffi-napi
npm error gyp ERR! node -v v22.9.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: /Users/meghandenny/.npm/_logs/2024-11-08T22_36_06_245Z-debug-0.log

@lenovouser
Copy link
Contributor Author

Ah, my bad. I use pnpm and did not have ref-napi in the onlyBuiltDependencies allowlist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

2 participants