On 15/8/11 5:20 PM, Ned Deily wrote:
In article<4e49b196.7050...@gmail.com>,
  "precipice.development"<precipice.developm...@gmail.com>  wrote:
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.
On 10.7, did you build all of the installed MacPorts MySQL packages with
MACOSX_DEPLOYMENT_TARGET=10.6 and the 10.6 SDK? (I'm not sure how well
that is supported with MacPorts.)  It's always dicey building something
on release n (10.7 in this case) and using it on release n-1 (10.6)
unless you use the appropriate SDK and deployment target.   It is
generally safe to do the reverse, though: build on 10.6 to deploy on
10.7.

No, I let MacPorts do its default thing. I realise that going with the latest and greatest tends to be dodgy at times. Let me try rebuilding MySQL and see what happens.
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to