Building MRAA from source on a Raspberry Pi A+

I am using Raspbian (Kernel 4.1) http://downloads.raspberrypi.org/raspbian_latest

You will also need “python” and “git” however these are pre-installed on the device.

Update apt-get

sudo apt-get update
sudo apt-get upgrade

Install NodeJS on a Raspberry Pi A+

latest version of Node for RPI is not supported, gra barchived:
   wget http://node-arm.herokuapp.com/node_archive_armhf.deb
Install it using dpkg
   sudo dpkg -i node_archive_armhf.deb
Test Node and NPM
   node -v
   npm -v
Update npm
   npm update npm
Change npms registry path from https to http
   npm config set registry http://registry.npmjs.org/

Install PCRE

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2
tar jxf pcre-8.37.tar.bz2
chmod 777 configure
./configure
make
sudo make install
sudo ln -sfv ../../lib/$(readlink /usr/lib/libpcre.so) /usr/lib/libpcre.so
sudo ldconfig

Install SWIG 3.07 or higher

http://downloads.sourceforge.net/swig/swig-3.0.7.tar.gz
tar -xzf swig-3.0.7.tar.gz
./configure
make
sudo make install

Install python-dev

sudo apt-get install python-dev

Install cmake

sudo apt-get install cmake

install mraa

git clone https://github.com/intel-iot-devkit/mraa.git
cd mraa

Comment out the following from /src/spi/spi.c
(line 144)
// if (ioctl(dev->devfd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) != -1) {
// if (speed < hz) {
// dev->clock = speed;
// syslog(LOG_WARNING, "spi: Selected speed reduced to max allowed speed");
// }

mkdir build
cd build
cmake .. -DBUILDSWIGNODE=ON -DBUILDSWIGPYTHON=OFF
make

This is where it got weird and i tried something random and it worked

Go into your project directory and install mraa via npm

cd ~projectdirectory
npm install mraa

You then need to copy mraa.node from

~/mraa/build/src/javascript

To

~/projectdirectory/node_modules/mraa/build/Release