Preparation

  • First remove the current installation of NodeJS

    opkg remove nodejs –force-depends

This will use the package manager for Angstrom and remove the NodeJS installation and it won’t balk that other packages depend on it (Cloud9, BoneScript, Node-Dev).

  • Download the latest version of NodeJS (or clone the github repo). Browse into the un-tarred directory (or the repo folder).

  • Don’t run this, but the standard build from source mantra is:

    ./configure; make; make install

And this will start to work until you  get two build errors. The first error is when the NodeJS build script goes to build V8 (Google’s JS engine that powers NodeJS), the V8 build script can’t figure out what the architecture of the processor is. After posting an issue on the NodeJS github repo (because I didn’t know that it was an issue with the V8 build script) I was pointed to this NodeJS issue  by Ben Nordhuis and then Ben helped me again by pointing out how to select the correct arm architecture option.

Fixes

  • Edit deps/V8/SConstruct (from the base NodeJS directory) on line 82 to match this:

    ‘CCFLAGS’: ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv7-a']

Now the -march flag tells the compiler to build for a specific architecture. (If you don’t have the latest BeagleBone with an Arm7 chip find your chip type with uname -a and then lookup suitable march args here)

  • The last build error you will encounter is that the compiler / build script cannot link against libcrypto. This is due to the fact that openssl is installed, however the openssl-dev package isn’t installed. So run:

    opkg install openssl-dev

Now this will remove the obsolete libcrypto version and will install the correct one that NodeJS links against.

Finishing Up

  • Conifgure, make, and install. If you did run make before the fixes make sure you run make clean and make distclean.

    ./configure make make install

© 2012 Michael Dillon Suffusion theme by Sayontan Sinha