Skip to content
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

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

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

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

sequoiar opened this issue Mar 28, 2013 · 14 comments

Comments

@sequoiar
Copy link

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. ...
@paddybyers
Copy link
Owner

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:
    Running multiple node instances in a process 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.

@sequoiar
Copy link
Author

@paddybyers

I will study on this first, and keep sync.

@paddybyers
Copy link
Owner

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.

@joshmarinacci
Copy link

I'd love to help on the new nodejs port. Is there a separate repo that has your port of v8?

@paddybyers
Copy link
Owner

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.

@joshmarinacci
Copy link

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 ?

@paddybyers
Copy link
Owner

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.

@joshmarinacci
Copy link

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.

@paddybyers
Copy link
Owner

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
Copy link

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?

@paddybyers
Copy link
Owner

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.

@ghost
Copy link

ghost commented Jun 6, 2013

Any update on this port?

@elipsitz
Copy link

I too am interested in this port. What else needs to be done? Anything other people can work on?

@shkim3000
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants