-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
NodeJS native extensions can't access libraries APIs #2674
Comments
@nicolasnoble Thanks for reporting! Could this issue explain the problem: android/ndk#201 or is it something else? Do you have any idea how to improve things (I don't know much about node.js internals myself)? |
It's very likely the case, yes. NodeJS is expecting its dependencies to be transitively available to its addons. If LD_PRELOAD is a way to put the dependents in the global space, we could wrap the Node binary to make sure that all of its dependencies are pre-loaded. I'll give it a try. |
Yes, it's making it load using a wrapper script that LD_PRELOAD all the node libraries. I don't know yet if the module works properly, but that's outside the scope of this bug :-) I'd recommend that the termux package ships with a similar script by renaming the binary to something else, and having the wrapper be the name "node", this way the node binary on Termux will behave the same as the official distribution. |
Also, the module seems to be working flawlessly, so only the wrapper script around the node binary is needed to properly fix this issue. |
This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
¯\(ツ)/¯ |
The problem(?) is that there is more than one way to fix this. I would rather do something like: CXXFLAGS="-I$TERMUX_PREFIX/include" LDFLAGS="-L$TERMUX_PREFIX/lib -lz" npm install grpc Of course the |
Is this still reproducible? |
I'm not sure if this one is even fixable, but the normal NodeJS runtime exposes libraries' API such as zlib or openssl to native addons. See https://nodejs.org/api/addons.html#addons_linking_to_node_js_own_dependencies
With termux's nodejs package, it seems this isn't working properly. See attached screenshot, when trying to load grpc (
npm install grpc
)The text was updated successfully, but these errors were encountered: