[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 = NoneNow, 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のケースセンシティブとかに関係がある模様。
May 27th, 2008 at 3:27 am
Instead of GLUT = None you can say try this:
GLUT = ctypesloader.loadLibrary(
ctypes.cdll,
‘GLUT’,
mode=ctypes.RTLD_GLOBAL
)
By any chance do you have a case sensitive filesystem on the broken one and a case-insensitive filesystem on the other (the one that works)?
May 28th, 2008 at 5:31 pm
Thank you Matthew.I updated the article. My laptop, which worked fine, and the broken one both used case-insensitive system. I tested another MacBook later and had the same problem. Apparently, it happens on some MacBook, not on MacBook Pro…