On 12 February 2011 03:02, Michael Bartz <[email protected]> wrote: > Graham: > > I could not run the mod_wsgi test because it apparently will not > load. When I restart Apache with mod_wsgi.so loaded, I get > segmentation faults in the error log: > > [Fri Feb 11 09:55:04 2011] [notice] child pid 78060 exit signal > Segmentation fault (11)
That can be caused by external factors. Do you have either mod_php or mod_python configured to load in the same Apache. Crashes can be debugged as described in: http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Debugging_Crashes_With_GDB Graham > The results you asked for: > > bash-3.2# file /usr/bin/python > /usr/bin/python: Mach-O universal binary with 2 architectures > /usr/bin/python (for architecture ppc7400): Mach-O executable ppc > /usr/bin/python (for architecture i386): Mach-O executable i386 > > > bash-3.2# ls -las /usr/bin/python > 8 lrwxr-xr-x 1 root wheel 72 Mar 9 2009 /usr/bin/python -> ../../ > System/Library/Frameworks/Python.framework/Versions/2.5/bin/python > > > bash-3.2# ls -las /usr/bin/python2.5 > 8 lrwxr-xr-x 1 root wheel 75 Mar 9 2009 /usr/bin/python2.5 - >> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/ > python2.5 > > > On Feb 10, 5:14 pm, Graham Dumpleton <[email protected]> > wrote: >> On 11 February 2011 10:04, Michael Bartz <[email protected]> wrote: >> >> > mail:~ bartz$ arch -x86_64 python >> > arch: posix_spawnp: python: Bad CPU type in executable >> >> That means your Python is fat, ie., supporting both 32bit and 64bit. >> >> Remember now. On Leopard the Apple Python although it provided 32/64 >> bit fat Python library, only supplied 32bit python executable. >> >> So, no chance of it working from command line even with these options. >> >> Did though the WSGI hello world test under Apache/mod_wsgi work? >> >> The only solution to this may be to try and build much newer Python >> version from source and supply appropriate configure options to make >> it build fat Python. I think latest Python from PSF can make a fat >> 'python' executable. If not, then you would have to go back to using >> 32 bit MySQL and 32 bit Python wrapper for MySQL. >> >> Anyway, can you supply output from: >> >> file /usr/bin/python >> >> and: >> >> ls -las /usr/bin/python >> ls -las /usr/bin/python2.5 >> >> Graham >> >> >> >> > mail:~ bartz$ ARCHPREFERENCE=x86_64 python >> > Python 2.5.1 (r251:54863, Sep 1 2010, 22:03:14) >> > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin >> > Type "help", "copyright", "credits" or "license" for more information. >> >>>> import MySQLdb >> > Traceback (most recent call last): >> > File "<stdin>", line 1, in <module> >> > File "build/bdist.macosx-10.5-i386/egg/MySQLdb/__init__.py", line >> > 19, in <module> >> > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in >> > <module> >> > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in >> > __bootstrap__ >> > ImportError: dlopen(/Users/bartz/.python-eggs/MySQL_python-1.2.3-py2.5- >> > macosx-10.5-i386.egg-tmp/_mysql.so, 2): no suitable image found. Did >> > find: >> > /Users/bartz/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.5- >> > i386.egg-tmp/_mysql.so: mach-o, but wrong architecture >> >> > On Feb 10, 4:49 pm, Graham Dumpleton <[email protected]> >> > wrote: >> >> On 11 February 2011 08:29, Michael Bartz <[email protected]> wrote: >> >> >> > Graham: >> >> >> > FYI, I rolled everything back to a base install again and started from >> >> > scratch just to make sure that I did not have something lurking. >> >> >> > When I built MySQL-python I noticed this warning this time: >> >> >> > "In file included from _mysql.c:36: >> >> > /usr/local/mysql/include/my_config.h:1069:1: warning: "HAVE_WCSCOLL" >> >> > redefined >> >> > In file included from /System/Library/Frameworks/Python.framework/ >> >> > Versions/2.5/include/python2.5/Python.h:8, >> >> > from pymemcompat.h:10, >> >> > from _mysql.c:29: >> >> > /System/Library/Frameworks/Python.framework/Versions/2.5/include/ >> >> > python2.5/pyconfig.h:721:1: warning: this is the location of the >> >> > previous definition" >> >> >> Nothing to be worried about. >> >> >> > With regards to your queries: >> >> >> > file `find . -name _mysql.o -print` >> >> > ./build/temp.macosx-10.5-i386-2.5/_mysql.o: Mach-O 64-bit object >> >> > x86_64 >> >> >> > file /usr/local/mysql/lib/libmysqlclient_r.16.dylib >> >> > /usr/local/mysql/lib/libmysqlclient_r.16.dylib: Mach-O 64-bit >> >> > dynamically linked shared library x86_64 >> >> >> > When executing the import, I get the following error: >> >> >> > Python 2.5.1 (r251:54863, Sep 1 2010, 22:03:14) >> >> > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin >> >> > Type "help", "copyright", "credits" or "license" for more information. >> >> >>>> import MySQLdb >> >> > Traceback (most recent call last): >> >> > File "<stdin>", line 1, in <module> >> >> > File "build/bdist.macosx-10.5-i386/egg/MySQLdb/__init__.py", line >> >> > 19, in <module> >> >> > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in >> >> > <module> >> >> > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in >> >> > __bootstrap__ >> >> > ImportError: dlopen(/Users/bartz/.python-eggs/MySQL_python-1.2.3-py2.5- >> >> > macosx-10.5-i386.egg-tmp/_mysql.so, 2): no suitable image found. Did >> >> > find: >> >> > /Users/bartz/.python-eggs/MySQL_python-1.2.3-py2.5-macosx-10.5- >> >> > i386.egg-tmp/_mysql.so: mach-o, but wrong architecture >> >> >> Try the following: >> >> >> arch -x86_64 python >> >> >>> import MySQLdb >> >> >> and: >> >> >> ARCHPREFERENCE=x86_64 python >> >> >>> import MySQLdb >> >> >> BTW, I am presuming that your machine does have a 64bit capable CPU. >> >> Would only be early Mac Intel chips that don't. >> >> >> These commands should force Python to run as 64 bit instead of 32 bit, >> >> presuming you are using Apple supplied Python which is fat and has 64 >> >> bit as well as 32 bit. >> >> >> Then under Apache/mod_wsgi, try a simple hello world program: >> >> >> import MySQLdb >> >> >> def application(environ, start_response): >> >> status = '200 OK' >> >> output = 'Hello World!' >> >> >> response_headers = [('Content-type', 'text/plain'), >> >> ('Content-Length', str(len(output)))] >> >> start_response(status, response_headers) >> >> >> return [output] >> >> >> Since Apache defaults to running as 64 bit, that should work based on >> >> about output from 'file'. >> >> >> If 'arch' override works, that may be a simple workaround for now. >> >> >> Graham >> >> >> > On Feb 10, 7:43 am, Graham Dumpleton <[email protected]> >> >> > wrote: >> >> >> On 11 February 2011 00:21, Michael Bartz <[email protected]> >> >> >> wrote: >> >> >> >> > I will be more specific :). >> >> >> >> > The server is a Mac Mini running Mac OS X 10.5.8: >> >> >> >> > Model Name: Mac mini >> >> >> > Model Identifier: Macmini2,1 >> >> >> > Processor Name: Intel Core 2 Duo >> >> >> >> > I have the 64-bit version of MySQL 5.1 installed as follows: >> >> >> >> > mysql-5.1.55-osx10.5-x86_64 >> >> >> >> > I downloaded the most recent version of MySQLdb from SourceForge >> >> >> > (MySQL-python-1.2.3). >> >> >> >> > I edited the site.cfg to find the local version of MySQL (/usr/local/ >> >> >> > mysql/bin/mysql_config). >> >> >> >> > and ran "python setup.py install" discerning no errors except that >> >> >> > all >> >> >> > the libraries are labeled i386 (rather than x86_64 or some such). >> >> >> >> Confirm what the situation is by running: >> >> >> >> file _mysql.so >> >> >> >> Also run: >> >> >> >> file /usr/local/mysql/lib/libmysqlclient_r.16.dylib >> >> >> >> Command line Python on Leopard from memory runs as 32 bit so I >> >> >> actually think problem is that _mysql.so is 32 bit but that >> >> >> libmysqlclient_r.16.dylib is actually 64 bit and so why the error. >> >> >> >> If you use Apple Apache and Apple Python however, as Apache starts as >> >> >> 64 but by default, then Python will also run as 64 bit and so long as >> >> >> _mysql.so is fat and has both 32/64 bit in one file, then the >> >> >> libmysqlclient_r.16.dylib should work under Apache at least. >> >> >> >> Post the output of the 'file' command for each to confirm and can then >> >> >> suggest what you actually need to do. >> >> >> >> Graham >> >> >> >> > I started python and tried to import MySQLdb and got the error >> >> >> > message >> >> >> > below. Ignore please the newbie issue of not removing the source >> >> >> > directory. This is where the trail started. From there I have tried >> >> >> > numerous homebrew methods derived from google searching. I make it >> >> >> > the furthest by uploading MacPython 2.6.6 but got stuck and finally >> >> >> > reached out here. >> >> >> >> > Python 2.5.1 (r251:54863, Sep 1 2010, 22:03:14) >> >> >> > [GCC 4.0.1 (Apple Inc. build 5465)] on darwin >> >> >> > Type "help", "copyright", "credits" or "license" for more >> >> >> > information. >> >> >> >>>> import MySQLdb >> >> >> > /Library/Python/2.5/site-packages/MySQL_python-1.2.3-py2.5-macosx-10.5- >> >> >> > i386.egg/_mysql.py:3: UserWarning: Module _mysql was already imported >> >> >> > from /Library/Python/2.5/site-packages/MySQL_python-1.2.3-py2.5- >> >> >> > macosx-10.5-i386.egg/_mysql.pyc, but /Users/bartz/MySQL-python-1.2.3 >> >> >> > is being added to sys.path >> >> >> > import sys, pkg_resources, imp >> >> >> > Traceback (most recent call last): >> >> >> > File "<stdin>", line 1, in <module> >> >> >> > File "MySQLdb/__init__.py", line 19, in <module> >> >> >> > import _mysql >> >> >> > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 7, in >> >> >> > <module> >> >> >> > File "build/bdist.macosx-10.5-i386/egg/_mysql.py", line 6, in >> >> >> > __bootstrap__ >> >> >> > ImportError: >> >> >> > dlopen(/Users/bartz/.python-eggs/MySQL_python-1.2.3-py2.5- >> >> >> > macosx-10.5-i386.egg-tmp/_mysql.so, 2): Library not loaded: >> >> >> > /usr/local/ >> >> >> > mysql/lib/libmysqlclient_r.16.dylib >> >> >> > Referenced from: /Users/bartz/.python-eggs/MySQL_python-1.2.3-py2.5- >> >> >> > macosx-10.5-i386.egg-tmp/_mysql.so >> >> >> > Reason: no suitable image found. Did find: >> >> >> > /usr/local/mysql/lib/libmysqlclient_r.16.dylib: mach-o, but >> >> >> > wrong >> >> >> > architecture >> >> >> >>>> quit >> >> >> >> > On Feb 9, 8:19 pm, Graham Dumpleton <[email protected]> >> >> >> > wrote: >> >> >> >> On 10 February 2011 04:44, Michael Bartz <[email protected]> >> >> >> >> wrote: >> >> >> >> >> > Graham: >> >> >> >> >> > Thanks for the reply. I realize that the "solution" is to upgrade >> >> >> >> > to >> >> >> >> > Snow Leopard, but that is not an option currently. >> >> >> >> >> > I certainly may have gotten lost wandering through version levels >> >> >> >> > of >> >> >> >> > the different components. >> >> >> >> >> > I think my problems started when I tried to build the MySQLdb >> >> >> >> > connector with the 32-bit Python. >> >> >> >> >> > Are you saying that the answer to these issues is to create a >> >> >> >> > local >> >> >> >> > build of a 64-bit Python? Is that something already done or do I >> >> >> >> > need >> >> >> >> > to go down that road on my own? >> >> >> >> >> Don't know, as I still can't see that you have clearly described >> >> >> >> what >> >> >> >> your original problem was. >> >> >> >> >> Was it that MySQLdb wrapper wouldn't compile, or you got some sort >> >> >> >> of >> >> >> >> error when loading it? If the latter, what error? Or was it that >> >> >> >> your >> >> >> >> Python wouldn't even load in Apache? >> >> >> >> >> Graham >> >> >> >> >> > On Feb 8, 7:19 pm, Graham Dumpleton <[email protected]> >> >> >> >> > wrote: >> >> >> >> >> What is the specific MySQLdb problem you are trying to resolve? >> >> >> >> >> The >> >> ... >> >> read more » > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
