Problems creating an OpenGL based Python module

Started by
0 comments, last by Kylotan 19 years, 7 months ago
I'm working on a C based module for python using OpenGL. The code basicly wraps some vertex buffer code, and I made sure not to use any OpenGL extention libraries. I've created a setup.py (below).

from distutils.core import setup, Extension

module1 = Extension('PyGame3D',
                    sources = ['primitiveobject.cpp'])

setup (name = 'PyGame3D',
       version = '1.0',
       description = 'Extentions for PyGame',
       ext_modules = [module1])
My C code (primitiveobject.cpp) compiles just fine, but when setup.py invokes the linker, it says it cannot find the OpenGL functions. I've cut and pasted the output below.

running install
running build
running build_ext
building 'PyGame3D' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3 -c primitiveobject.cpp -o build/temp.darwin-7.5.0-Power_Macintosh-2.3/primitiveobject.o
creating build/lib.darwin-7.5.0-Power_Macintosh-2.3
c++ -Wl,-F. -Wl,-F. -bundle -framework Python build/temp.darwin-7.5.0-Power_Macintosh-2.3/primitiveobject.o -o build/lib.darwin-7.5.0-Power_Macintosh-2.3/PyGame3D.so
ld: warning -prebind has no effect with -bundle
ld: Undefined symbols:
_glColorPointer
_glDrawElements
_glNormalPointer
_glTexCoordPointer
_glVertexPointer
error: command 'c++' failed with exit status 1

I use Mac OS 10.3, and the gcc compiler. Thanks for your help.
Advertisement
I think you will need to add opengl as the libraries parameter. Check the distutils docs for how to do this.

This topic is closed to new replies.

Advertisement