-
Notifications
You must be signed in to change notification settings - Fork 30.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
Building node as a shared library for Android #3074
Comments
You'll have to figure out in what shared object Cross-referencing nodejs/roadmap#9. |
Thanks, but ldd says it's not a dynamic executable... |
Google told me that you can find that with readelf command, and I found that libnode.so only references 4 libraries:
"android-ndk-r10e/platforms/android-9/arch-arm/usr/lib/libc.so" has "getservbyport" but not "getservbyport_r". Is this the cause of this problem? |
It should be part of libc but it was probably added after API level 9. You could try commenting out HAVE_GETSERVBYPORT_R in deps/cares/config/android/ares_config.h and rebuilding. |
I tried commenting out that and it works now, thanks. I checked expored symbols of libc.so from "android-ndk-r10e/platforms/android-21/arch-arm/usr/lib/libc.so", but it also only has "getservbyport". Where is this implemented? |
Good question. A quick grep through the AOSP tree suggests it's been in bionic since at least 4.0.4 / API level 15. Maybe it only gets compiled in conditionally. |
Does that mean getservbyport_r doesn't work on most Android devices? Then should we disable that by default? |
We (and libuv) are not really in the business of supporting older Android versions, see e.g. ecb840c.
We do, more or less. You can see in android-configure how it builds with |
What about getservbyport_r? Is this supported on all devices running Android 5.0 or later? |
I'd assume it is. An android developer forum is probably a better place to ask though. |
I noticed that UnsatisfiedLinkError with I tested shared node on emulators without disabling |
I'm seeking some feedback about how Node.js is used on Android if anyone watching this thread would like to tell us about it: nodejs/build#359 |
Closing, I don't think there is anything left to do here. |
I couldn't get this to work on android.
First of all, I changed platform toolchain version from 21(Android 5.0?) to 9(Android 2.3) so that it would work on older devices.
Looking at its Changelog, it was changed to 21 to avoid issues with libuv, but library built for API 21 always fails to load on devices older than Android 5.0.
After changing it, the library builds, but doesn't load at all with this error:
E/AndroidRuntime(23716): java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "getservbyport_r" referenced by "libnode.so"...
The text was updated successfully, but these errors were encountered: