[PyOpenGL] GLUT link error on MacBook+Leopard

Since Leopard, I like using PyObjC and PyOpenGL(3.0.0a6) to develop 3D softwares. I usually install PyOpenGL via wonderful easy_install command. On my MacBook Pro, it’s very straightforward and no harm. However, I could not make it on my client’s MacBook (CoreDuo 2.0MHz). The installation was OK, but the application never launched successfully.

The error log was like this:

dlopen(glut, 10)
can't find image named glut

After 2 hour fighting, I reached the following solution:

At the line#56 of PyOpenGL-3.0.0a6-py2.5.egg/OpenGL/platform/darwin.py (.egg files are just zips), replace

# glut shouldn't need to be global, but just in case a dependent library makes
# the same assumption GLUT does...
GLUT = ctypesloader.loadLibrary(
    ctypes.cdll,
    'glut',
    mode=ctypes.RTLD_GLOBAL
)

with

GLUT = None

Now, it works without import OpenGL.GLUT. When I need GLUT functions (it rarely happens), I just make Objective-C method wrapper.


UPDATE on May 28, 2008

You can fix that with

GLUT = ctypesloader.loadLibrary(
    ctypes.cdll,
    'GLUT', # Upper case!!
    mode=ctypes.RTLD_GLOBAL
)

Apparently, it’s related to OS X case-insensitive file system. Thanks to Matthew for a comment.


LeopardのMacBookでPyOpenGLのGLUTのリンクが上手くいきませんでした。PyOpenGLを編集して、GLUTをimportしない事でこの問題を当面避けられます。 [追記] どこからかやってきたMatthewがもっといい解決策をコメントしてくれました。どうやらOS Xのケースセンシティブとかに関係がある模様。

Body
2 Comments