I have a huge gl.pxd file with all the definitions of gl.h , glu.h and glut.h For example, it has the following lines:
cdef extern from '<OpenGL/gl.h>': ctypedef unsigned int GLenum cdef void glBegin( GLenum mode )
I have a window.pyx file that looks like this:
# Import OpenGL definitions
I also have setup.py that looks like this:
from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext setup( cmdclass = {'build_ext': build_ext}, ext_modules = [Extension('window', ['window.pyx'])] )
Which I call with python3 setup.py build_ext --inplace , and it compiles, and the output is as follows:
running build_ext cythoning window.pyx to window.c building 'window' extension /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c window.c -o build/temp.macosx-10.6-intel-3.3/window.o /usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.3/window.o -o /Users/petervaro/cygl/window.so
And I have window_test.py that looks like this:
import window window.main()
But if I want to run this python fragment, I got this error:
Traceback (most recent call last): File "/Users/petervaro/cygl/window_test.py", line 3, in <module> import window ImportError: dlopen(/Users/petervaro/cygl/window.so, 2): Symbol not found: _glBegin Referenced from: /Users/petervaro/cygl/window.so Expected in: flat namespace in /Users/petervaro/cygl/window.so
My problem is very similar to this: What is the point of this ImportError when importing a .so generated Cython file? - although afaik I do not have an external library, I want to use the built-in OpenGL Lib ...
Oh, and I'm on Mac OS X 10.8.5, Cython 19.2, and Python 3.3. Any help would be appreciated!
Thanks in advance!