Skip to content

Instantly share code, notes, and snippets.

@adammw
Created August 3, 2012 06:30
Show Gist options
  • Star 166 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save adammw/3245130 to your computer and use it in GitHub Desktop.
Save adammw/3245130 to your computer and use it in GitHub Desktop.
Node.js for Raspberry Pi

Node.js for Raspberry Pi

Pre-built binaries

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.

Raspbian (hard-float)

STABLE: v0.10.24 (joyent/node@v0.10.24-release)

UNSTABLE: v0.11.9 (joyent/node@v0.11.9-release)

MAINTENANCE: v0.8.25 (joyent/node@v0.8.25-release)

Raspberry Pi Soft Float Systems

v0.8.9-pre (TooTallNate/node@???)

Compiling Node.js

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.

Tips

Cross-compiling on Linux

  1. 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.
  2. Download this cross-compile helper script.
  3. Download the version of node.js source code you want or clone the git repository.
  4. If you are compiling Node.js 0.8.10 or lower, apply either this newer set of patches or this patch, but not both.
  5. 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
  1. It seems that the arm ld doesn't work with the makefile arguments, so set the following export:
export LD="$CXX"
  1. 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'
  1. Run configure:
./configure --without-snapshot
  1. 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.

  1. Copy the node executable to the Raspberry Pi using scp
scp node raspbian:~/bin/node

Native Compile

Be warned: this will take forever for little gain.

  1. Download the version of node.js source code you want or clone the git repository.
  2. If you are compiling Node.js 0.8.10 or lower, apply this newer set of patches or this patch, but not both.
  3. Run configure:
./configure --without-snapshot
  1. Run make and make install
make
make install
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

@hertzg
Copy link

hertzg commented Aug 13, 2014

I've searched all over how to cross compile node js for armv6hf (raspberry pi) and as a result ended up with this script which works great with my jenkins setup.

https://gist.github.com/hertzg/12c2d7fc40f68ff6deeb

Assuming you have saved the file as ./cc-node-armv6hf.sh and gave +x permission

# to build the latest stable version
./cc-node-armv6hf.sh

# to build specific source archive
_PARAMS_NODEJS_SOURCE_ARCHIVE_URL="http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz" ./cc-node-armv6hf.sh

Current latest stable version (v0.10.30) will fail cross compiling no matter what. More info here: nodejs/node-v0.x-archive#8062

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment