Compiling externals for Pure Data "Vanilla" (Raspberry Pi 2) 

in which I compile externals for Pure Data (duh) 

October 13th, 2015

for my own raspi2 projects, i often use the touchOSC and gyrOSC apps on from my iphone which, unsuprisingly, use the OSC standard to transmit their data. so i need some objects in pure data to both receive/transmit UDP or TCP packets over the network; and something to create/interpret the OSC messages contained therein. enter martin peach's lovely external libraries for pure data called osc and net!

first of all, i can’t use apt-get because it will assume its own version of pure data and jack as dependencies and install all of those, very likely mucking up my own hand-rolled version. (see this mess of a post for far too many details...) otherwise this would be as easy as sudo apt-get install pd-osc and so forth.

okay. the first thing you need to know is that the repository containing most of the pure data community’s externals is a subversion repository located at http://sourceforge.net/p/pure-data/svn/HEAD/tree/trunk/externals/ and the ones i’m concerned with at the moment are of course in the directory mrpeach/net and mrpeach/osc.

now, i’m really not interested in downloading the entire friggin’ repository onto my pi. in lieu of that, i’m just going to pick-and-choose externals as i need them. so let’s install subversion:

sudo apt-get install subversion

and then in my ~/sources directory (i just made this up to keep things tidy and to know what i’ve installed by hand, because i haven’t gotten around to rolling my manually-compiled stuff into debian packages... lazy, lazy, lazy)

svn checkout svn://svn.code.sf.net/p/pure-data/svn/trunk/externals/mrpeach/osc

then i cd osc and do make -j4 && sudo make install. it is good to note that within the pure data community, the standard location for externals on linux is /usr/local/lib/pd-externals and so you shouldn’t have to worry about specifying it manually in pure data. the new objects will just show up when you restart the program. note also that -j4 tells make to use the raspberry 2’s 4 processors. somewhat trivial for such a small job, but it’s fun to know you’re getting your money’s worth.

same thing for net as above, EXCEPT during make i got

tcpclient.c:31:21: fatal error: s_stuff.h: No such file or directory
compilation terminated.
Makefile:245: recipe for target 'tcpclient.o' failed
make: *** [tcpclient.o] Error 1

aww, snap! ok. after a bit of thinking i was like, duh, this has to be compiled against the pure data source code. you still have that hanging around, right? mine is in ~/sources/pure-data (as previously mentioned, er, somewhat...) and the file in question (s_stuff.h, nice naming, miller...) is in the src directory. so do something like this: make CFLAGS=-I~/sources/pure-data/src.

actually, in hindsight, that’s unwise. let’s poke around the Makefile, which is used by make to handle the details of compilation. i see that CFLAGS there has a default of -Wall -W -g which i assume i was overwriting entirely by specifying my pure data source path. so to be safe i could have done CFLAGS=-Wall -W -g -I~/sources/pure-data/src (compilation still went off fine without doing this, however).

OR! if we look just above CFLAGS, we see ALL_CFLAGS = -I"$(PD_INCLUDE)” which strongly indicates to me that we can set PD_INCLUDE instead. upon testing this hypothesis, compilation also works.

there seems to be very recent discussion about setting sensible defaults for PD_INCLUDE, which in any case would probably fail for my particular set up. however, if the community-sanctioned Makefile template for pure data externals continues to contain this variable, then i will probably just go ahead and set it in my ~/.profile thus: export PD_INCLUDE=~/sources/pure-data/src.

happy CAMP-piling, queerdos of the world!