[Pythonmac-SIG] Py2App-Lion-MySQLdb Error Msg

precipice.development precipice.development at gmail.com
Tue Aug 16 19:43:26 CEST 2011


On 15/8/11 5:20 PM, Ned Deily wrote:
> In article<4E49B196.7050609 at gmail.com>,
>   "precipice.development"<precipice.development at 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.
>
I went ahead and added the following to macports.conf in order to for 
the target to 10.6

macosx_deployment_target 10.6
sdkroot /Developer/SDKs/MacOSX10.6.sdk


Unfortunately, I got a compilation error in qt

:info:build kernel/qt_cocoa_helpers_mac.mm:1523: warning: invalid 
receiver type ‘void *’
:info:build make[2]: *** [.obj/debug-shared/qt_cocoa_helpers_mac.o] Error 1
:info:build make[2]: *** Waiting for unfinished jobs....
:info:build make[2]: Leaving directory 
`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/ 
qt-everywhere-opensource-src-4.7.3/src/gui'
:info:build make[1]: *** [debug-all] Error 2
:info:build make[1]: Leaving directory 
`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/ 
qt-everywhere-opensource-src-4.7.3/src/gui'
:info:build make: *** [sub-gui-all-ordered] Error 2
:info:build make: Leaving directory 
`/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt- 
everywhere-opensource-src-4.7.3'
:info:build shell command " cd 
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/work/qt- 
everywhere-opensource-src-4.7.3" && /usr/bin/make -j4 -w all " returned 
error 2
:error:build Target org.macports.build returned: shell command failed 
(see log for details)
:debug:build Backtrace: shell command failed (see log for details)
while executing
"command_exec build"
(procedure "portbuild::build_main" line 8)
invoked from within
"$procedure $targetname"
:info:build Warning: the following items did not execute (for qt4-mac): 
org.macports.activate org.macports.build org.macports.destroot 
org.macports.install
:error:build Failed to install qt4-mac
:notice:build Log for qt4-mac is at: 
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_qt4-mac/qt4-mac/main.log

Looks like reverting back may be the only option for now.

Thanks for your help.


More information about the Pythonmac-SIG mailing list