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

tfjs-tflite-node install node-gyp rebuild failing #47

Open
nestarz opened this issue May 10, 2022 · 1 comment
Open

tfjs-tflite-node install node-gyp rebuild failing #47

nestarz opened this issue May 10, 2022 · 1 comment
Assignees

Comments

@nestarz
Copy link

nestarz commented May 10, 2022

Hello !

Looking to try tflite on node but can't manage to install it, do you have any highlight on this issue ? Thanks!

Context:
macOS 12; Intel; Node 14/16/18;

➜  folder git:(main) ✗ pnpm add tfjs-tflite-node @tensorflow/tfjs-core @tensorflow/tfjs-backend-cpu
Packages: +17 (current: {"node":"v14.19.2","pnpm":"7.0.1"})
+++++++++++++++++
node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmkmix4wci/node_modules/tfjs-tflite-node: Running install script, failed in 2.7s
.../node_modules/tfjs-tflite-node install$ node-gyp rebuild
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info find Python using Python version 3.9.12 found at "/Users/user/.asdf/installs/python/3.9.12/bin/python3"
│ gyp info spawn /Users/user/.asdf/installs/python/3.9.12/bin/python3
│ gyp info spawn args [
│ gyp info spawn args   '/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py
│ gyp info spawn args   'binding.gyp',
│ gyp info spawn args   '-f',
│ gyp info spawn args   'make',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/user/project/folder/node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmkmix4wci/node_modul
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args   '-I',
│ gyp info spawn args   '/Users/user/Library/Caches/node-gyp/14.19.2/include/node/common.gypi',
│ gyp info spawn args   '-Dlibrary=shared_library',
│ gyp info spawn args   '-Dvisibility=default',
│ gyp info spawn args   '-Dnode_root_dir=/Users/user/Library/Caches/node-gyp/14.19.2',
│ gyp info spawn args   '-Dnode_gyp_dir=/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node-gyp'
│ gyp info spawn args   '-Dnode_lib_file=/Users/user/Library/Caches/node-gyp/14.19.2/<(target_arch)/node.lib',
│ gyp info spawn args   '-Dmodule_root_dir=/Users/user/project/folder/node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmk
│ gyp info spawn args   '-Dnode_engine=v8',
│ gyp info spawn args   '--depth=.',
│ gyp info spawn args   '--no-parallel',
│ gyp info spawn args   '--generator-output',
│ gyp info spawn args   'build',
│ gyp info spawn args   '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info spawn make
│ gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
│   CXX(target) Release/obj.target/node_tflite_binding/binding/node_tflite_binding.o
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:74:3: error: cannot use
│   try {
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:93:3: error: cannot use
│   try {
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:461:3: error: cannot us
│   NAPI_THROW_IF_FAILED(*this, status, Object());
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:468:3: error: cannot us
│   NAPI_THROW_IF_FAILED(*this, status, Value());
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:475:3: error: cannot us
│   NAPI_THROW_IF_FAILED(*this, status, Value());
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:508:3: error: cannot us
│   NAPI_RETURN_OR_THROW_IF_FAILED(
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:113:3: note: expanded from 
│   NAPI_MAYBE_THROW_IF_FAILED(env, status, type);                               \
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:110:3: note: expanded from 
│   NAPI_THROW_IF_FAILED(env, status, type())
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:539:3: error: cannot us
│   NAPI_THROW_IF_FAILED_VOID(_env, status);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:65:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:551:3: error: cannot us
│   NAPI_THROW_IF_FAILED_VOID(_env, status);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:65:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:559:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, nullptr);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:599:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:618:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, napi_undefined);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:652:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:672:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:683:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:694:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:713:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:724:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:735:3: error: cannot us
│   NAPI_THROW_IF_FAILED(_env, status, false);
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ In file included from ../binding/node_tflite_binding.cc:19:
│ In file included from /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:2981:
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi-inl.h:751:3: error: cannot us
│   NAPI_RETURN_OR_THROW_IF_FAILED(
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:113:3: note: expanded from 
│   NAPI_MAYBE_THROW_IF_FAILED(env, status, type);                               \
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:110:3: note: expanded from 
│   NAPI_THROW_IF_FAILED(env, status, type())
│   ^
│ /Users/user/project/folder/node_modules/.pnpm/[email protected]/node_modules/node-addon-api/napi.h:62:28: note: expanded from 
│   if ((status) != napi_ok) throw Napi::Error::New(env);
│                            ^
│ fatal error: too many errors emitted, stopping now [-ferror-limit=]
│ 20 errors generated.
│ make: *** [Release/obj.target/node_tflite_binding/binding/node_tflite_binding.o] Error 1
│ gyp ERR! build error 
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack     at ChildProcess.onExit (/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_modules/pnpm/dist/node_modules/node
│ gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
│ gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
│ gyp ERR! System Darwin 21.4.0
│ gyp ERR! command "/Users/user/.asdf/installs/nodejs/14.19.2/bin/node" "/Users/user/.asdf/installs/nodejs/14.19.2/.npm/lib/node_module
│ gyp ERR! cwd /Users/user/project/folder/node_modules/.pnpm/[email protected]_zdnedjtt7d7rx2jlpmkmix4wci/node_modules/tfjs-tf
│ gyp ERR! node -v v14.19.2
│ gyp ERR! node-gyp -v v8.4.1
│ gyp ERR! not ok 
└─ Failed in 2.7s
@mattsoulanille
Copy link
Member

Thanks for the bug report. That error message is not very clear, but it's appearing because x86-64 Mac is not supported yet (so the compiler is missing the -fexceptions flag). I'll look into adding support for that platform later today. However, it's unfortunately not as simple as adding a config to the binding.gyp file since TFLite also needs to be compiled for x86 Mac (see the cc_deps folder). If you don't want to wait, you should be able to use it from Docker or a Linux virtual machine.

The package should also show a more obvious error message on unsupported platforms, so I'll look into that as well.

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

2 participants