Topic: Node.js on chumby!

I took a couple of hours and built node.js (version 0.4.11) for chumby.

node.js is basically an event-based web services engine based on Google's V8 engine.  It allows you to create web services such as web sites using just Javascript.  node.js is the "new hotness" for the creation of simple web services.

To get it, just download this file (MD5 fe894c6b754a0e6cd85377f1d280b2b9), and unpack it to internal storage or a USB dongle.  You should end up with a single self-contained executable called "node".  You'll need to create a script to run with it.

To install (for instance, to "/mnt/storage" on chumby One or chumby 8):

# cd /mnt/storage
# wget
# tar xzvf node.tgz
# rm node.tgz

A trivial example - create the file "/mnt/storage/example.js" with the contents:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
console.log('Server running on port 1337');

..and start it with:

# cd /mnt/storage
#./node example.js

You should be able to access this with a browser at "http://(ip of your chumby):1337", and it should respond with the text "Hello World".

For more elaborate examples, see the node.js wiki and documentation.

This was built entirely on a chumby 8 using the native toolchain.  First you have to build Python 2.6, then build node - there were only very minor changes needed to build it (mainly to let V8 know which ARM version we're building on, and disabling a gcc optimization that fails on all ARM devices, plus two obscure lib calls that are optional anyway).  Note that it's a slow build, mainly due to i/o throughput to the SD card.

Note also that it's a pretty heavy user of memory, even when doing little.

UPDATE: I've reposted an SSL-enabled version of the binary, link has been updated.

Re: Node.js on chumby!

Thank you, Duane!

Before reading this post, I've tried to build Node.js without success on my Insignia Infocast 8".

I'm very close: I've enabled swap to build on the device, noticed the -fno-tree-sink option for disabling the flawed GCC optimization, the --without-ssl and --without-snapshot configure options, used march=armv5te, and disabled inotify, epoll and sync_file_range. I now get a complete install that segfaults so hard it logs me out.

I've posted my verbose instructions here:

Could you please share the remaining modifications you made in order to build? I'd love to have a complete guide and I know I'm very close to having a working build. (Feel free to fork the gist!)


Re: Node.js on chumby!

Actually, it sounds like you more or less did what I did - not sure why you're having issues.

I edited the V8 SConstruct file to include -fno-tree-sink and -march=armv5t options for CCFLAGS for arch:arm.

I configured --without-ssl but left everything else on (note, I recently built with SSL - all you need is the headers from the chumby source archive, the libraries are there already).

As you probably know, you then get link errors in libev - I simply edited ev.c to #undef IN_CLOEXEC (to avoid to call to inotifiy_init1) and ev_epoll.c to #undef EPOLL_CLOEXEC (to avoid the call to epoll_create1)- this makes it use alternative functions.

Since I built on a Chumby 8, I already had swap enabled.

Does the binary I built work for you?  I only ran it C8 and C1, not I8.

Re: Node.js on chumby!


Is node.js still around? I'm getting 404'd.


Re: Node.js on chumby!

cbreeze wrote:


Is node.js still around? I'm getting 404'd.

Cheers is working here.

Cleaning up any loose bits and bytes.

Re: Node.js on chumby!


Sorry, I meant the pre-compiled version for Chumby. I guess it works now, or I got the bad link elsewhere.