ImportError:
dlopen(/Users/jph/Public/hello.app/Contents/Resources/lib/python2.7/lib-dynloa
d/_mysql.so,
2): Symbol not found: _strnlen
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] Referenced from:
/Users/jph/Public/hello.app/Contents/MacOS/../Frameworks/libmysqlclient_r.16.d
ylib
Background
Did a Hello World type test app on Lion. Used py2app to bundle it into
an OSX app. Works fine. Copied over to a fresh install of Snow Leopard
10.6.8 and works fine. Bundle is standalone.
Now, added MySQLdb and made a database connection on Lion - works as
expected - result returned from simple query. MySQL database is on a
third machine. Now copied bundle over to Snow Leopard machine (again a
fresh install) and received the following error:
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] Traceback (most
recent call last):
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] File
"/Users/jph/Public/hello.app/Contents/Resources/__boot__.py", line 57,
in<module>
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] _run('hello.py')
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] File
"/Users/jph/Public/hello.app/Contents/Resources/__boot__.py", line 54,
in _run
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] execfile(path,
globals(), globals())
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] File
"/Users/jph/Public/hello.app/Contents/Resources/hello.py", line 9, in
<module>
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] import MySQLdb
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] File
"MySQLdb/__init__.pyc", line 19, in<module>
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] ImportError:
dlopen(/Users/jph/Public/hello.app/Contents/Resources/lib/python2.7/lib-dynloa
d/_mysql.so,
2): Symbol not found: _strnlen
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] Referenced from:
/Users/jph/Public/hello.app/Contents/MacOS/../Frameworks/libmysqlclient_r.16.d
ylib
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] Expected in:
/usr/lib/libSystem.B.dylib
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] in
/Users/jph/Public/hello.app/Contents/MacOS/../Frameworks/libmysqlclient_r.16.d
ylib
8/15/11 4:30:09 PM hello[716] hello Error
8/15/11 4:30:10 PM com.apple.launchd.peruser.501[102]
([0x0-0x2e02e].org.pythonmac.unspecified.hello[716]) Exited with exit
code: 255
The key line seems to be ImportError:
dlopen(/Users/jph/Public/hello.app/Contents/Resources/lib/python2.7/lib-dynloa
d/_mysql.so,
2): Symbol not found: _strnlen
8/15/11 4:30:08 PM
[0x0-0x2e02e].org.pythonmac.unspecified.hello[716] Referenced from:
/Users/jph/Public/hello.app/Contents/MacOS/../Frameworks/libmysqlclient_r.16.d
ylib
Python on Lion is from MacPorts.
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on
darwin
Type "help", "copyright", "credits" or "license" for more information.
/opt/local/bin/python: Mach-O 64-bit executable x86_64
MySQLdb is also from MacPorts
mysql5/mysql/libmysqlclient.16.dylib: Mach-O 64-bit dynamically linked
shared library x86_64
mysql5/mysql/libmysqlclient_r.16.dylib: Mach-O 64-bit dynamically linked
shared library x86_64
Py2App script
setup.py
from setuptools import setup
setup(
app = ['hello.py'],
options = {
'py2app': {
'argv_emulation': 0,
#'plist': {
#plist'LSPrefersPPC':
False,
#},
'includes': ['PySide.QtCore',
'PySide.QtGui', 'PySide.QtWebKit', 'PySide.QtNetwork', 'MySQLdb'],
'site_packages': 1
}
},
data_files = ['copying.txt'],
setup_requires = ['py2app'],
)
Does anyone have any ideas of how to correct this.