25

When I try it I get:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/cscalelib.so, 2): Symbol not found: _glBindFramebufferEXT Referenced from: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/cscalelib.so Expected in: dynamic lookup

I've tried all sort of things in the setup.py file. What do I actually need to put in it to link to OpenGL properly? My code compiles fine so there's no point putting that on there. Here is setup.py

from distutils.core import setup, Extension

module1 = Extension('cscalelib',
              extra_compile_args = ["-framework OpenGL", "-lm", "-lGL", "-lGLU"],
                    sources = ['cscalelib.cpp'])

setup (name = 'cscalelib',
       version = '0.1',
       description = 'Test for setup_framebuffer',
       ext_modules = [module1])
7
  • How does your current approach to link look? Commented May 2, 2010 at 19:46
  • Well the current setup.py looks like: from distutils.core import setup, Extension module1 = Extension('cscalelib', extra_compile_args = ["-framework OpenGL", "-lm", "-lGL", "-lGLU"], sources = ['cscalelib.cpp']) setup (name = 'cscalelib', version = '0.1', description = 'Test for setup_framebuffer', ext_modules = [module1]) I've tried lots of different things. That was an attempt to add lots of gcc arguments that might work. Commented May 2, 2010 at 19:55
  • 3
    What are the actual compiler commands that are executed? ('python setup.py build -v' should show you, if it doesn't by default. Remove the 'build' directory if it decides not to rebuild anything.) '-framework' seems to be a linker option, not a compiler option, so you should probably put it in extra_link_args instead -- but I have no idea if it will matter. Commented May 2, 2010 at 22:45
  • 3
    I didn't realise I had to remove the build directory. Now it imports correctly. Thank you for that. For anyone that needs to know you need: extra_link_args=['-framework', 'OpenGL'] Delete the build directory and try it again. It will work. Commented May 3, 2010 at 11:29
  • 5
    @ThomasWouters, it appears to me that you answered this question. So perhaps you'll turn your comment into an answer, so it can be accepted this question doesn't appear as unanswered forever. Commented Jul 5, 2012 at 16:06

1 Answer 1

4

I didn't realise I had to remove the build directory. Now it imports correctly.

For anyone that needs to know you need: extra_link_args=['-framework', 'OpenGL'] Delete the build directory and try it again. It will work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.