I'm currently writing a small python app that embeds cherrypy and django using py2app. It worked well until I tried to include pyobjc in my project, since my app needed a small GUI (which consists of a small icon in the top menu bar + a drop down menu).
I can run my python script without any problem (I'm using python 2.6 with macports), but I can't launch the application bundle generated by py2app. A dialog box appears with the following message:
ImportError:
dlopen(/Users/denis/tlon/standalone/mac/dist/django_cherry.app/Contents/Resources/lib/python2.6/lib-dynload/CoreFoundation/_inlines.so, 2): no suitable image found.
Did find:
/Users/denis/tlon/standalone/mac/dist/django_cherry.app/Contents/Resources/lib/python2.6/lib-dynload/CoreFoundation/_inlines.so: mach-o, but wrong architecture
I did a quick :
sudo port -u install py26-pyobjc +universal
but for some reason macports tries to build openssl, with which compilation fails each time. It seems the problem is related to zLib - this is what appears in the logs :
:info:build ld: warning: in /opt/local/lib/libz.dylib, file is not of required architecture
...And here is the output of file /opt/local/lib/libz.dylib
:
/opt/local/lib/libz.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libz.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/libz.dylib (for architecture i386): Mach-O dynamically linked shared library i386
Nothing looks wrong to me.
开发者_开发知识库I'm a bit stuck here. I don't even understand what openssl has to do with pyObjc, but it looks like I can't go anywhere if I don't manage to compile it. Macports really suck sometimes :/
EDIT I manage to fix Macports issue, but not py2app one :/
I'm guessing it's because a required library is not in your library path, so the loader can't figure out where it is so it can link the symbols in. You should do one of two things:
- Add
/opt/local/lib
to your$LD_LIBRARY_PATH
environment variable when launching the app; or - Bundle the appropriate libraries with the
.app
file.
精彩评论