I don't make a habit of posting compilation gotchas, but this one was a phenomenally unpleasant time drain. Looking to interface python with MIDI on Snow Leopard, I came across pyPortMIDI, based on part of PortMedia.
Compilation seemed OK, following these hints (also found in pm_python/hints.txt in the portmidi dist), but running the pyPortMIDI test.py script returned the following:
Traceback (most recent call last):
File "test.py", line 11, in
import pypm
ImportError: dlopen(/Library/Python/2.6/site-packages/pypm.so, 2): Symbol not found: _Pt_Time
Referenced from: /Library/Python/2.6/site-packages/pypm.so
Expected in: flat namespace
in /Library/Python/2.6/site-packages/pypm.so
Following some excrutiating exploration with dtrace and nm, it transpired that it boiled down to an architecture issue: according to the portmidi xcode build file, /usr/local/lib/libportmidi.dylib was compiled as i386/ppc, but my system is 64-bit.
Solution:
* Open the .xcodeproj file in XCode, change the .dylib Target arch to x86_64, rebuild and install over the existing /usr/local/lib/libportmidi.dylib
* Clean up the pyPortMIDI build, rebuild and reinstall
Now working without a hitch.
