Search code examples
node.jsarmcross-compilingv8raspberry-pi

Cross-compiling Node.js for ARM6 (Raspberry Pi)


I'm trying to get node.js v0.7.9 to compile for the raspberry pi, but as node and v8 are quite large, I'm hoping to be able to cross-compile on another more powerful PC. I'm using the linux-x86 arm-bcm2708-linux-gnueabi toolchain from https://github.com/raspberrypi/tools and have used them to successfully build other executables for the system. I ended up setting the CC,CXX,CPP,STRIP,OBJCOPY,etc. variables to the toolchain equivalents in the environmental variables and ran configure with: ./configure --dest-cpu=arm --without-snapshot to get the final executable. Copying it over to the system and running it however produces the following error:

Extension or internal compilation error at line 0.
Segmentation fault

However, the segmentation fault doesn't happen for any of the non-javascript tasks like node --version and node --help. Are there any CFLAGS/CXXFLAGS I might be missing causing this problem? Bit confused....


Solution

  • I've been working on this a bit since the question was originally asked, even added some patches to help auto-detect cross-compiler settings. Node.js in the repositories is (at the moment) a rather old version, and may or may not support the full hard-float (VFP) architecture.

    For a full detailed HOWTO, see Nathan Rajlich's write up at http://n8.io/cross-compiling-nodejs-v0.8/

    I've posted binaries for others who don't want to go through all this hassle for the same hardware at https://gist.github.com/3245130