martes, 24 de julio de 2012

Compiling Pd-extended on armhf / armel (Raspberry PI) [builds inside]

This post describes how to build Pd-extended on Raspberry Pi, almost everything is based on the post http://log.liminastudio.com/writing/tutorials/how-to-build-pd-extended-on-the-raspberry-pi. All credits goes there.

The official debian build for Raspberry Pi has changed the arquitecture from armel to armhf, to speed up the system by using the hardware floating point unit, this should help Pd since it works with float variables.
This process has been tested with Raspbian 15-7-12.

To get the sources, check the Puredata official page, but, for some reason, it doesn't work for me in the nights, so you can always get it from sourceforge:
0.42.5 http://sourceforge.net/projects/pure-data/files/pd-extended/0.42.5/Pd-0.42.5-extended.tar.gz/download
If you want to use the latest 0.43.1 source, it will be downloaded using the rsync command in the Liminastudio post.

Compiling takes around 4-5 hours in my Raspberry Pi (overclocked around 900 Mhz).

Pd-extended 0.43.1

When build the 0.43.1 version, the steps are the same as the post by Liminastudio, just add the repository line " deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi " in the step 2. and add "tcl-dev" in step 4.

Pd-extended 0.42.5

But compiling the previous 0.42.5 may be interesting due to its lighter working compared to the newest 0.43, but it requires some changes to avoid problems compiling.

First of all, I suffered from a gcc compiler bug which triggers assembler errors, with the default gcc-4.6 compiler in debian, I had use gcc-4.7, which was able to compile all the sources without errors.

To compile this version, follows the steps 1 to 4 in the Liminastudio post. Then, download the 0.42.5 sources from the link above, and extract in the current folder.

After that, we'll set the gcc-4.7 as the default:
First, install the gcc-4.7, with g++ and libstdc++6, also, we'll install dssi-dev and liblo-dev, because we'll need them (these package may be installed in the step 4 along with the build dependences).
sudo apt-get install gcc-4.7 g++-4.7 libstdc++6-4.7-dev dssi-dev
fftw2 libgfortran3 libmpich1.0gf tcl-dev tcl8.4-dev tk tk8.4-dev
The default compiler is still gcc-4.6, we'll set the alternatives to use 4.7:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.7 10
Compiling the 0.42.5 version is a little trickier, we have to correct some things in the source. First, the pidip package fails compiling, so we'll replace it with the latest version (don't know it if may break it, haven't tested, just lets pd-extended compile). Just remove the externals/pidip folder, and replace it with the pidip source that we can dowload using

sudo apt-get install cvs
xport CVSROOT=:pserver:anonymous@giss.tv:/home/cvs 
cvs co pidip 

Now we need to correct a file in the source , the file is GEM/src/Pixes/videoV4L.h. We'll replace the file with the one here http://pd-gem.svn.sourceforge.net/viewvc/pd-gem/branches/0.92/Gem/src/Pixes/videoV4L.h?view=markup&pathrev=3937 . If we don't do that, we'll get a file not found error (more info here http://ubuntuforums.org/showthread.php?t=1767292).

The last change is in the pdp external, the ---export-dynamic makes the compiler throw a parameter not recognized error, I've deleted from the affeted files, you should change the following files:
    externals/pdp/Makefile line 29
    externals/pdp/scaf/Makefile line 29
    externals/pdp/opengl/Makefile line 23

The source with all these changes is here: https://docs.google.com/open?id=0B_UT435wUJeTQ2hvNG1WcVhsbGM


Then follow the remaining steps from step 8, you have only to change the name of the package in the dpkg command.
In step 8, a parameter has to be removed from the Makefile, but, if we compille all at once, the makefile hasn't been created before compiling, so we'll modify externals/OSCx/configure (info). There, in line 4429, remove "-lpd", do that also in line 98 of externals/OSCx/configure.ac, this last one don't know if it's necesary, but it's better to be sure in a four hour process .

All these corrections are in the following file if you prefer to skip these changes:

If you prefer to install my builds, just follow the first four steps, download the package using wget and the address and install it with dpkg.

Builds armhf (Raspberry Pi), use with Raspbian or similar:

0.43.1 - 23-7-12: https://docs.google.com/file/d/0B_UT435wUJeTVTh3VEFIODNrOU0
0.42.5: https://docs.google.com/open?id=0B_UT435wUJeTRnp0RFZfR1lfa1k

Direct download - for wget for example

0.43.1 https://dl.dropbox.com/s/0r9muesthz5fghi/Pd-0.43.1-extended-20120723.deb
0.42.5 https://dl.dropbox.com/s/p9xh0ia0xbjrnux/Pd-0.42.5-extended.deb