Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 289
Adam M-W Avatar asked Jun 14 '12 17:06

Adam M-W


People also ask

Can you run NodeJS on Raspberry Pi?

NodeJS is a powerful JavaScript runtime environment that allows you to run JavaScript natively without a web browser. Thanks to its speed and relative ease of use, it is a fantastic framework to run on the Raspberry Pi. If you have had any issues installing the software, please leave a comment below.


1 Answers

NodeJS is available pre-compiled for a few Linux distributions: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Since NodeJS is still in testing phase for Debian, in order to install NodeJS on my Raspberry Pi under Debian wheezy, I do:

sudo su echo deb ftp://ftp.dk.debian.org/debian/ sid main > /etc/apt/sources.list.d/sid.list apt-get update apt-get install nodejs rm /etc/apt/sources.list.d/sid.list apt-get update exit 

NodeJS works very fine and stable on my Raspberry Pi.

like image 124
Alexandre Alapetite Avatar answered Sep 29 '22 02:09

Alexandre Alapetite