node-on-android: libnode.so for 32 bit is missing

okay it looks like I got it installed, it says it built successfully, but when I tried to run it on my phone I got this error:

Error:error: '../../../../src/main/jniLibs/armeabi-v7a/libnode.so', needed by '../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so', missing and no known rule to make it

I’m trying to figure out where libnode.so comes from? okay, a bit of searching led me here: https://github.com/nodejs/node/issues/14158

gonna check that out…

btw, I changed line 14 of app/build.gradle to

abiFilters 'armeabi-v7a', 'arm64-v8a'

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 23 (1 by maintainers)

Most upvoted comments

Hi - I managed to compile a version of node (from master - 9.0.0?) on a Samsung Galaxyy Tab A SM-T280 tablet running Android 5.1.1 Cortex A7 CPU - it is armeabi-v7a, compiled via termux.

Here is my commit with the shared lib if anyone needs it. I followed @mafintosh’s steps to create the node shared lib.

https://github.com/bunsenbrowser/cordova-node-plugin/commit/bb8969098537e46a1ea0294fb95102cbe1168a57

I haven’t been able to test it correctly - I think I also may need to make the other shared lib - libc++_shared.so - but haven’t had a chance to figure out that process.

Thanks a lot to @mafintosh for leading the way for node on android and to @aschrijver for his perseverence and extremely useful list of the many ways to try to compile node on android.

Here are my notes - they are based on the steps @mafintosh made above:

https://github.com/node-on-mobile/node-on-android/issues/4#issuecomment-318919220

pkg install git python2
apt install clang clang++ g++
pkg install make
pkg install zip
downloaded zip of node from https://github.com/nodejs/node/archive/master.zip
cd /usr/bin
ln -s python2 python

Configure

python configure --without-snapshot --openssl-no-asm --shared --dest-os=android
Then in deps/cares/config/android/ares_config.h comment out

#define HAVE_GETSERVBYPORT_R 1
And run make (will take a while). Remember to have Termux aquire a wake lock so your phone doesnt go to sleep

Shared lib is out/Release/lib.target/libnode.so.57

hmm, so node has an android-configure script, with this comment at the top:

# In order to cross-compile node for Android using NDK, run:
#   source android-configure <path_to_ndk> [arch]
#
# By running android-configure with source, will allow environment variables to
# be persistent in current session. This is useful for installing native node
# modules with npm. Also, don't forget to set the arch in npm config using
# 'npm config set arch=<arch>'

so this seemed to work:

./android-configure ~/android-sdk/ndk-bundle/ arm --shared

remember to include “–shared” so that it becomes a shared object