Tuesday, December 23, 2014

Installing libgroove and nodejs groove module in Raspbian

As we are working on small internal hobby project turning the Raspberry PI into a music box, I came across the need for building the nodejs groove module which requires a pretty big amount of effort. I'm going to provide you with the instruction for building from source.

UPDATE: If using testing/unstable repo is not a problem for you, an alternative method is available and is much faster by using binary packages. Jump to the "Install using testing/unstable binary packages"  section.

Install from source

This is the shorten version of the build script for Raspbian Wheezy that I think it may be useful for other ones struggling with a similar task.

Note: this is the simplified version of a great guide created by Andrew Kelly: Turn Your Raspberry Pi Into a Music Player Server

# install tools and libs
sudo apt-get install cmake git screen
sudo apt-get install libchromaprint-dev libspeexdsp-dev libasound2-dev libmp3lame-dev libvorbis-dev

# install libebur128 from source
cd
git clone https://github.com/jiixyj/libebur128
cd libebur128/
mkdir build
cd build/
cmake .. -DCMAKE_BUILD_TYPE=Debug
make
sudo make install
sudo mv /usr/local/lib/arm-linux-gnueabihf/* /usr/local/lib/
sudo rmdir /usr/local/lib/arm-linux-gnueabihf
sudo ldconfig

# install SDL2 from source
cd
wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
tar xvf SDL2-2.0.3.tar.gz
cd SDL2-2.0.3/
./configure --enable-audio --disable-video --disable-render --disable-events --disable-joystick --disable-haptic --disable-power --disable-file --disable-timers --disable-loadso --disable-cpuinfo
make
sudo make install

# install libav from source, will takes about 9hrs (!), consider using 'screen'
cd
wget http://www.libav.org/releases/libav-10.1.tar.gz
tar xvf libav-10.1.tar.gz
cd libav-10.1/
./configure --enable-shared --enable-debug --disable-static --enable-gpl --enable-libmp3lame --enable-libvorbis
make
sudo make install
sudo ldconfig

# install libgroove from source
cd
git clone https://github.com/andrewrk/libgroove
cd ~/libgroove/
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make
sudo make install
sudo ldconfig
ls /usr/local/lib/

#install newer nodejs ARM, this is optional
get https://github.com/needforspeed/Nodejs-ARM-builder/raw/master/v0.10.33/nodejs_0.10.33-armv6_armhf.deb
sudo dpkg -i nodejs_0.10.33-armv6_armhf.deb
which node


#install nodejs groove
npm install groove -g

Install from testing/unstable binary packages

At the time of writing, the testing repository of Raspbian contains a usable set of binary packages that are sufficient for installing node groove module.

Step 1: switch to testing

Edit the /etc/apt/sources.list to replace wheezy with testing, so that the first line of the file reads:

deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi

Step 2: update and install the libraries

sudo apt-get update
sudo apt-get install libgroove4 libgroove-dev libgroovefingerprinter4 libgroovefingerprinter-dev libgrooveloudness4 libgrooveloudness-dev libgrooveplayer-dev libgrooveplayer4

Step 3: install node groove module

npm install groove -g