Skip to content

Building v0.11 for Android

paddybyers edited this page Apr 12, 2013 · 3 revisions

Introduction

There's a branch now with some initial work to get node to build and run on Android. Here are some quick notes to get you started.

Set up the build environment

These instructions should work on Mac and Linux. Windows/cygwin is not fully working yet.

Get the latest Android SDK and NDK. You need at least version 8b of the NDK.

Install a recent version of Python 2.x.

Install Git.

Create a directory, we'll refer to as <work dir> that will contain all of the repositories you need, and cd into this directory.

Prerequisites - SSL

anode depends on the openssl libraries libssl.so and libcrypto.so. These libraries are present on the phone and also on the emulator, but aren't officially part of the ndk. We prefer to use the platform-provided versions of these libraries (instead of building a copy into node) and so you have to build a copy of each of these libraries before building node itself.

Starting in <work dir>, clone the repo:

git clone git://github.com/paddybyers/openssl-android.git

To build it:

cd openssl-android
ndk-build

Download the code

cd back to <work dir>.

Clone each of the repositories in turn.

git clone git://github.com/paddybyers/pty.git
git clone git://github.com/paddybyers/node.git -b v0.11-android

Build v8

I've not done anything yet to migrate the v8 build process to Android. This has all been changed since I last did it for 0.6, and things are quite complex so I decided not to mess with it initially.

Therefore we're using v8 as a shared library.

cd node/deps/v8
make dependencies
make -j8 GYPFLAGS="-Dcomponent=shared_library" android_arm.debug

Build node

cd ../..
export NDK_MODULE_PATH=.:..
ndk-build NDK_PROJECT_PATH=. NDK_APPLICATION_MK=Application.mk V=1

Deploy

Assuming you've got a rooted device, put libv8.so into /system/lib Copy libs/armeabi-v7a/node to the device (not the SD card, somewhere on the internal storage).

Then you should be able to run it.

Clone this wiki locally