...JAVASCRIPT_wrap.cxx:238:10: fatal error: 'uv.h' file not found
Closed this issue · 5 comments
Hi, I am trying out current main branch (as of 15/07/2024). I am trying your fork to get smart pointers support. It seems there's a strong libuv dependency, which I am trying to sort out. I decided to go with cmake-js build and I am using UseSWIG macros. I use -c++ -javascript -napi
args. I am getting the following error:
/build/CMakeFiles/rpc.dir/rpcJAVASCRIPT_wrap.cxx:238:10: fatal error: 'uv.h' file not found
#include <uv.h>
^~~~~~
1 error generated.
make[2]: *** [CMakeFiles/rpc.dir/CMakeFiles/rpc.dir/rpcJAVASCRIPT_wrap.cxx.o] Error 1
make[1]: *** [CMakeFiles/rpc.dir/all] Error 2
make: *** [all] Error 2
What is the best approach to get pass this error? Should I include emnapi?
I commented out the include in
and that works for me, so maybe that should be included conditionally for WASM?uv.h
is part of the Node.js distribution and it must be in the same directory as node_api.h
. If it is missing, you have a problem with your Node.js distribution. emnapi
overrides it with its own version.
I think I am facing the issue with cmake-js
you mentioned here.
If I remove "binary": {"napi_versions": [7]}
from package.json
, then I get
-DCMAKE_JS_INC=/Users/mateuszp/.cmake-js/node-arm64/v22.4.1/include/node
otherwise:
-DCMAKE_JS_INC=/opt/homebrew/lib/node_modules/cmake-js/node_modules/node-api-headers/include;/Users/mateuszp/Developer/sw/AppiumDriver/node_modules/node-addon-api
According to https://github.com/nodejs/node-addon-api/blob/main/doc/README.md#abi-stability-guideline
It is important to remember that other Node.js interfaces such as libuv (included in a project via #include <uv.h>) are not ABI-stable across Node.js major versions.
The generated SWIG code doesn't seem to use any of uv_*
API, so why do we need to include it? Is it required for async?
How does the include of node_api.h
work then?
Through node-api-headers
package:
> tree /opt/homebrew/lib/node_modules/cmake-js/node_modules/node-api-headers/include
/opt/homebrew/lib/node_modules/cmake-js/node_modules/node-api-headers/include
├── js_native_api.h
├── js_native_api_types.h
├── node_api.h
└── node_api_types.h