BP.IO / POST

Building libpd in Windows

Here’s how I got libpd built and running under Windows. The key is to use msys2 and mingw-w64 instead of the older mingw32.

# install msys2-installer

# open msys2_shell
pacman –needed -Sy bash pacman pacman-mirrors msys2-runtime
pacman -Su
# restart msys_shell
pacman -S git
pacman -S mingw32/mingw-w64-i686-gcc
pacman -S make

# run mingw32_shell.bat
# issues with git ca certs? try http://stackoverflow.com/a/8467406
git clone https://github.com/libpd/libpd.git libpd
cd libpd
# update the pure-data submodule
git submodule init
git submodule update
# build it
make UTIL=true EXTRA=true
# set path to dlls
export PATH=/c/dev/libpd-2/libs:$PATH

# c sample
cd samples/c/pdtest
env CC=gcc make UTIL=true EXTRA=true
./pdtest.exe test.pd .

# output
Ben@bentoshi MINGW32 /c/dev/libpd/samples/c/pdtest
$ ./pdtest.exe test.pd .
bonk version 1.5
expr, expr~, fexpr~ version 0.4 under GNU Lesser General Public License
fiddle version 1.1 TEST4
pique 0.1 for PD version 23
sigmund~ version 0.07
print: 0
noteon: 0 0 0
print: 1
noteon: 0 1 0
print: 2
noteon: 0 2 0
print: 3
noteon: 0 3 0
print: 4
noteon: 0 4 0

As for samples/cpp/pdtest_rtaudio … adding “AUDIO_API = -lole32 -loleaut32 -ldsound -lwinmm” to the windows section of the Makefile eliminates a few of the link errors. I still get some link errors … but I’ll tackle those another time.

Update: I’ve got c++ bindings working now. There were a few minor flags to add to some Makefiles, notably -Wl,–export-all-symbols to the linker and some windows libs to the rtaudio demo. I’ve submitted the patch.

Update 2: After a bit of work today I also got libpd and sfml talking nicely to each other.