Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

porting node.js v0.8.x on Android #15

Open
sequoiar opened this Issue Mar 28, 2013 · 14 comments

Comments

Projects
None yet
7 participants

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?

  1. compile node.js on Android natively
    1. implement jni wrapper of node.js
    2. ...
Owner

paddybyers commented Mar 28, 2013

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:

  1. 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.

  1. 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:
    paddybyers/node#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 paddybyers referenced this issue in paddybyers/node Mar 28, 2013

Closed

porting node.js v0.8.x on Android #23

@paddybyers

I will study on this first, and keep sync.

Owner

paddybyers commented Apr 6, 2013

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?

Owner

paddybyers commented Apr 11, 2013

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 ?

Owner

paddybyers commented Apr 11, 2013

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.
Owner

paddybyers commented Apr 11, 2013

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

Rush commented Apr 13, 2013

I have a perfectly running node with npm using Arch Linux chroot on Android but could your build run on an unrooted device?

Owner

paddybyers commented Apr 13, 2013

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.

bardu commented Jun 6, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment