anode
anode copied to clipboard
porting node.js v0.8.x on Android
Did you have plan to run node.js v0.8.x on Android? And, could you show me some clue to port node.js to Android?
- compile node.js on Android natively
- implement jni wrapper of node.js
- ...
Hi,
Yes, I do plan to do it (although I guess we'd target 0.10 now).
The work to do falls into two parts:
- a simple port of the node executable. This was relatively straightforward; the work to do this is in this branch:
https://github.com/paddybyers/node/tree/v0.6-android-rebase
It consists of a small number of patches to address omissions in the android libraries and miscellaneous build issues, and also includes Android makefiles for the Android NDK.
You can run the resulting executable on a device provided the device is rooted, so you can push the executable onto it and launch it directly.
- Modifying node so that it runs as a library within a Dalvik VM process, and allowing multiple node instances to run as isolates within a single process. This is much more complex and represents most of the work that I did. There's a reasonable overview of it here: https://github.com/paddybyers/node/issues/16
With all of the changes since 0.6, especially the migration away from libev, domains, and everything else this isn't a simple matter of rebasing the earlier changes onto 0.8. I do plan to spend time on this but I've not been able to fit it in yet.
@paddybyers
I will study on this first, and keep sync.
BTW I've just done a first version of the node port of v0.11.0 to Android: https://github.com/paddybyers/node/tree/v0.11-android
This doesn't have the anode-related isolate changes in, but it can be run as an executable.
Because of the complexity of the new v8 build process I'm running it with v8 as a shared library right now, built separately.
I'd love to help on the new nodejs port. Is there a separate repo that has your port of v8?
Hi, see here: https://github.com/paddybyers/node/commits/v0.11-android
This is a first port of 0.11 - just the executable, not any of the isolate stuff.
I'm first starting with the main branch then I'll switch to 0.11. I've just finished a std build. What is the generated node executable? obj/local/armeabi/bridge.node ?
bridge.node is a node add-on, which implements the java bridge. The build will produce a stripped version, which is the one you would deploy, in libs/armeabi/
However, the node executable comes from building the node repo. 0.11 right now is pretty much at the tip of master so those commits you can see in that branch history will also apply to master and you'll be able to build for Android. There are a few steps to get it to build and I'll put some notes for that into the wiki.
Yeah. I need to understand how to build the node executable. I've checked out the 0.11 branch. Simply doing:
~/projects/android-sdk-macosx/ndk/ndk-build NDK_PROJECT_PATH=. NDK_APPLICATION_MK=Application.mk
doesn't work. I get:
➜ node git:(remotes/origin/v0.11-android) ~/projects/android-sdk-macosx/ndk/ndk-build NDK_PROJECT_PATH=. NDK_APPLICATION_MK=Application.mk
Android NDK: /Users/josh/projects/android-sdk-macosx/ndk/sources/cxx-stl/system/Android.mk: Cannot find module with tag 'deps/cares' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:
Android NDK:
Android.exe.mk:37: *** Android NDK: Aborting. . Stop.
Lets move this to an issue over on the node repo. I just added some notes to the wiki there:
https://github.com/paddybyers/node/wiki/Building-v0.11-for-Android
I have a perfectly running node with npm using Arch Linux chroot on Android but could your build run on an unrooted device?
but could your build run on an unrooted device?
This 0.11 port cannot run on unrooted devices yet.
To do that, you have to wrap it so that it will run as a library, and be loadable by a regular Android java app. I did this for 0.6 (see here: https://github.com/paddybyers/anode) but that's not done yet for this 0.11 port.
Any update on this port?
I too am interested in this port. What else needs to be done? Anything other people can work on?
I have porting v.0.11 on android(version ICS). I finished compile it well.
But when I try to run it on android device, I meet an error as below
Ready on port 8000
net.js:1156 COUNTER_NET_SERVER_CONNECTION(socket)
ReferenceError: COUNTER_NET_SERVER_CONNECTION is not defined at TCP.onconnection (net.js:1156:3)
Pls let me know what should i do.