Embedding Python in MaxMSP

C

Charlie DeTar

A pretty ugly one - embedding python in an external for a proprietary
semi-legacy macintosh application, MaxMSP:

I am trying to update Bill Orcutt's "nyptho" python interpreter
external for MaxMSP (http://www.publicbeta.cx/max/) to actually work
with the latest versions of OS X and python. Currently, the C calls
made by nyptho are to the older PyMac methods, and thus they depend on
the older MacPython distribution.

After some simple changes of the "nyptho" code to use the current
standard Python libraries instead, compilation seems to work fine, but
I am getting the following errors from the linker:

/usr/bin/gcc-3.3 -o "/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.mxo/Contents/MacOS/nyptho"
"-L/Users/tc1/Sources/MaxMSP-SDK/Mach-O Development/nyptho/build"
"-L/sw/lib/python2.3/config/" "-F/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build" "-F/Library/Frameworks" -filelist
"/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.build/nyptho.build/Objects-normal/LinkFileList"
"-framework" "Carbon" "-framework" "MaxAPI" "-arch" "ppc" "-bundle"
"-ldl"
ld: Undefined symbols:
_PyEval_InitThreads
_PyRun_SimpleFile
_PyRun_SimpleString
_PySys_SetArgv
_Py_Finalize
_Py_Initialize

I am curious about the preceding underscores on the undefined symbols
- they are nowhere in the source code. I am very new to C, and am
using Mac's "XCode" IDE (as that's what the MaxMSP SDK examples are
in, and I haven't strayed far from them yet). Following Python's
linker instructions (http://python.org/doc/2.3.4/ext/link-reqs.html)
does nothing but add _PyMac_Error to the list of undefined symbols.

As I mentioned, I am very new to C, and especially don't know anything
about C++. But I feel like I'm so close to having something at least
testable here! Any ideas?

Thanks,
Charlie DeTar
 
C

Charlie DeTar

Oh, in case anyone out there cares or had the same problem at some
point: I was able to fix this by adding "-lpython2.3" to the ld command
list. Probably something to do with "Python.h" not corresponding to
"libpython.a"? Maybe there ought to be links
(libpython.a->libpython2.3.a), so that embedded applications don't
depend on particular versions of python?

cheers,
Charlie

Charlie DeTar wrote:
[snip]
/usr/bin/gcc-3.3 -o "/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.mxo/Contents/MacOS/nyptho"
"-L/Users/tc1/Sources/MaxMSP-SDK/Mach-O Development/nyptho/build"
"-L/sw/lib/python2.3/config/" "-F/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build" "-F/Library/Frameworks" -filelist
"/Users/tc1/Sources/MaxMSP-SDK/Mach-O
Development/nyptho/build/nyptho.build/nyptho.build/Objects-normal/LinkFileList"
"-framework" "Carbon" "-framework" "MaxAPI" "-arch" "ppc" "-bundle"
"-ldl"
ld: Undefined symbols:
_PyEval_InitThreads
_PyRun_SimpleFile
_PyRun_SimpleString
_PySys_SetArgv
_Py_Finalize
_Py_Initialize
[snip]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top