Recent releases have been pre-built using cross-compilers and this script and are downloadable below.
If you have found these packages useful, give me a shout out on twitter: @adammw
The .tar.gz
file is an archive, including npm and man pages, that can be extracted and used directly:
cd ~/node/ # or /usr/local if you're feeling brave
tar xzvf /path/to/binary.tar.gz --strip=1
The .bin
file is just the node.js executable.
STABLE: v0.10.24 (joyent/[email protected])
UNSTABLE: v0.11.9 (joyent/[email protected])
MAINTENANCE: v0.8.25 (joyent/[email protected])
This gist is now rather old gist, as such it details a lot of problems which are not present in recent releases and patches required. Patches may not work nor be correct anymore. Use everything at your own risk.
- OpenSSL has been problematic in the past, use
--without-ssl
first to determine if it's a problem with node or OpenSSL. - Nathan Rajlich's write up "Cross Compiling Node.js v0.8.x" may provide some useful extra and more-recent information for cross-compiling
- Install or download a cross-compiler. The pre-compiled cross-compilers from raspberrypi/tools may work for you, however please ensure you get the correct one for your system (e.g. use the hardfp version for Raspbian) and install the compilers in your PATH by editing your
.profile
file, ensuring to add the /tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin directory. - Download this cross-compile helper script.
- Download the version of node.js source code you want or clone the git repository.
- If you are compiling Node.js 0.8.10 or lower, apply either this newer set of patches or this patch, but not both.
- Run the cross-compiler helper script to get a shell with the correct variables.
If compiling for a soft float system or using a different toolchain besides the default (which is
arm-bcm2708hardfp-linux-gnueabi
), use the HOST envrionmental variable to set the correct HOST prefix, e.g. :
HOST=arm-bcm2708-linux-gnueabi ~/crosscompile.sh
otherwise:
~/crosscompile.sh
- It seems that the arm ld doesn't work with the makefile arguments, so set the following export:
export LD="$CXX"
- If you are compiling Node.js 0.8.4 or lower, set the following exports:
export GYP_DEFINES="armv7=0"
export CCFLAGS='-march=armv6'
export CXXFLAGS='-march=armv6'
- Run configure:
./configure --without-snapshot
- Run make
make
Using --jobs=8
to parallelize the build may speed things up if you have a multi-core processor, but is completely untested.
- Copy the node executable to the Raspberry Pi using scp
scp node raspbian:~/bin/node
Be warned: this will take forever for little gain.
- Download the version of node.js source code you want or clone the git repository.
- If you are compiling Node.js 0.8.10 or lower, apply this newer set of patches or this patch, but not both.
- Run configure:
./configure --without-snapshot
- Run make and make install
make
make install
Ok, I've found another bug, but that's more that the patch doesn't patch enough.
It adds symbols for VFP2 as well as renaming VFP to VFP3, but does no auto-detection of VFP2 so the gyp build files must explicitly define CAN_USE_VFP2_INSTRUCTIONS.
I'll see what I can do.