Git Product home page Git Product logo

node-jni's Introduction

node-jni

Access node.js on jvm/dalvik/ART, read: android.

General idea

I work towards the day when the back end nodejs engineer can code the communication plumbing for the (android) mobile front end...

Goals

Not necessarily in this order:

  • Build shared library (node.js/io.js) -- DONE
  • Redirect node stdout to Log.debug, or to TextView, see fprintf(stdout... and this link,
  • Change where require() stores stuff (gyp parameter?)
  • Write JNI binding, aka borrow from joeferner/node-java and android-cpp-sdk
  • Write android app to play with node.js, from a phone/tablet/wearable
  • Release! Profit?!?!?!?! Nah, collect bug reports and cultivate grey hair.
  • Fix 'require()' issue, this might require hacking node.js
  • Build *.so for arm, arm64, x86, x86_64, mips
  • Secure the application, or at least think of strategies
  • Repackage NodeJNI.java as jcenter or maven repository jar

News

22 jan 2015

Brainfart: I wanna play with lzham compression. Maybe something for IO.js.

I should make IO.js embeddable in android too. -- DONE

22 jan 2015

If applied my patch can fix nodejs master branch to build a shared library for Android.

Don't be alarmed by:

01-22 03:41:21.721  10819-10819/nl.sison.android.node_jni A/libc﹕ ../deps/uv/src/unix/proctitle.c:53: uv_setup_args: assertion "process_title.len + 1 == size" failed
01-22 03:41:21.721  10819-10819/nl.sison.android.node_jni A/libc﹕ Fatal signal 6 (SIGABRT) at 0x00002a43 (code=-6), thread 10819 (ndroid.node_jni)

At least we know node::Start is getting called.

The next step would be to write callbacks for nodejs <-> android I/O. Stay tuned for more updates.

19 jan 2015

The function calls were being mangled beyond all recognition, due to the deps being compiled with standard armeabi toolchain version 4.6 getting mixed with version 4.8.

The dependencies were also getting mangled badly due to this reason.

A patch for all the required changes will be released soon.

See: README-android.md.

Update: found this. The --as-needed compiler switch might be disregarding stuff in the build prematurely.

16 jan 2015

Apparently, I wasn't paying much attention to how android handles NDK/JNI. Android's System.loadLibrary only accepts *.so files, dynamic linking library / shared object, thingies.

The following does not work out-of-the-box, by changing one line node.gyp:

{
    // ...
    'type': 'shared_library', // where it was 'executable' before
    // ...
}

It produces a broken so, that is missing some or all dependencies.

The next step, imho, is to write an mk file (android make), in the node workspace, to generate a libnode.so.

But this is blocking:

[armeabi] SharedLibrary  : libnode.so
/android-ndk-r10/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/node/__/src/node_jni.o: in function Java_NodeJNI_start:/git-repositories/node/jni/../src/node_jni.cc:40: error: undefined reference to 'node::Start(int, char**)'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libnode.so] Error 1

node-jni's People

Contributors

buggaboo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.