Skip to content

Instantly share code, notes, and snippets.

@alexlawrence
Forked from adammw/README.md
Created December 29, 2012 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexlawrence/4407826 to your computer and use it in GitHub Desktop.
Save alexlawrence/4407826 to your computer and use it in GitHub Desktop.

Node.js for Raspberry Pi

This is a very old gist - it may not work nor be correct anymore. Use everything at your own risk. See http://n8.io/cross-compiling-nodejs-v0.8/ for something slightly more up-to-date.

OpenSSL has been problematic in the past, use --without-ssl first to determine if it's a problem with node or OpenSSL.

Pre-built binaries

Raspbian (hard-float)

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

v0.8.6-pre (adammw/node@3a42578d477249cc8851cd76cfb4fa4cb88ab0a0)

Raspberry Pi Soft Float Systems

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

Compiling Node.js

Cross-compiling on Linux

  1. Download pre-compiled cross-compilers from raspberrypi/tools, ensure to get the correct one for your system (e.g. use the hardfp version for Raspbian)
  2. Install the compilers in your PATH by editing your .profile file, ensuring to add the /tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin directory.
  3. Download this cross-compile helper script
  4. Download the version of node.js source code you want or clone the git repository.
  5. If you are compiling Node.js 0.8.10 or lower, apply this newer set of patches or this patch, but not both.
  6. Run the cross-compiler helper script to get a shell with the correct variables. If compiling for a soft float system or anything besides the default, use the HOST envrionmental variable to set the correct HOST prefix, e.g. :
HOST=arm-bcm2708-linux-gnueabi ~/crosscompile.sh

otherwise to use the default (which is arm-bcm2708hardfp-linux-gnueabi):

~/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.

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

Native Compile

Be warned: this will take forever.

  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
This file has been truncated, but you can view the full file.
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.)

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