Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#18879 closed defect (fixed)

mod_wsgi-1.1_0 compiles against Python 2.4 but links against system Python 2.5

Reported by: francis@… Owned by: ys@…
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: Cc: blb@…
Port: mod_wsgi

Description

After installing mod_wsgi (and adding a LoadModule for it to httpd.conf) I get warnings in the apache error_log about Python versions:

[Tue Mar 17 14:17:59 2009] [notice] SIGHUP received.  Attempting to restart
[Tue Mar 17 14:18:00 2009] [notice] mod_python: Creating 8 session mutexes based on 256 max processes and 0 max threads.
[Tue Mar 17 14:18:00 2009] [notice] mod_python: using mutex_directory /tmp 
[Tue Mar 17 14:18:00 2009] [notice] Digest: generating secret for digest authentication ...
[Tue Mar 17 14:18:00 2009] [notice] Digest: done
[Tue Mar 17 14:18:00 2009] [warn] mod_wsgi: Compiled for Python/2.4.6.
[Tue Mar 17 14:18:00 2009] [warn] mod_wsgi: Runtime using Python/2.5.1.
[Tue Mar 17 14:18:00 2009] [warn] mod_wsgi: Python module path '/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/../../Extras/lib/python:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk:/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload'.
[Tue Mar 17 14:18:00 2009] [notice] Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8j DAV/2 mod_python/3.3.1 Python/2.4.6 mod_wsgi/1.1 Python/2.5.1 configured -- resuming normal operations

I am using OS X 10.5.6 on Intel.

"otool" shows that mod_wsgi.so is indeed linked against Python 2.5:

# otool -L /opt/local/apache2/modules/mod_wsgi.so 
/opt/local/apache2/modules/mod_wsgi.so:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
	/System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.1)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

Workaround: set up LDFLAGS by hand as follows:

1) port configure mod_wsgi

2) edit /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/mod_wsgi/work/mod_wsgi-1.1/Makefile and change the line

LDFLAGS = -framework Python -u _PyMac_Error  /opt/local/Library/Frameworks/

to

LDFLAGS = -framework Python -u _PyMac_Error  -F/opt/local/Library/Frameworks/

i.e. add "-F" before "/opt/local/Library/Frameworks/"

3) port install mod_wsgi

Attachments (1)

mod_wsgi.diff (2.0 KB) - added by blb@… 15 years ago.
diff to mod_wsgi

Download all attachments as: .zip

Change History (13)

comment:1 Changed 15 years ago by mf2k (Frank Schima)

Owner: changed from macports-tickets@… to ys@…

Do you have python_select set to a macports python?

comment:2 Changed 15 years ago by francis@…

Yes, python_select is set to python24:

francis@spaceman ~ $ python_select -s
python24

comment:3 Changed 15 years ago by blb@…

What version of the python24 port do you have installed? A fix for it (in r48185, bring python24 to 2.4.6_1) which improved linking against it, and it may fix your issue. You'd need to rebuild mod_wsgi after upgrading python24 if that's the case.

comment:4 Changed 15 years ago by francis@…

I have python24 2.4.6_1 installed. I have tried rebuilding mod_wsgi to make sure it has been built against that version of python24, but it still links against the wrong python:

spaceman ~ # port clean mod_wsgi
--->  Cleaning mod_wsgi
spaceman ~ # port location python24
Port python24 2.4.6_1+darwin_9+macosx is installed as an image in:
/opt/local/var/macports/software/python24/2.4.6_1+darwin_9+macosx
spaceman ~ # port install mod_wsgi
--->  Fetching mod_wsgi
--->  Verifying checksum(s) for mod_wsgi
--->  Extracting mod_wsgi
--->  Configuring mod_wsgi
--->  Building mod_wsgi
--->  Staging mod_wsgi into destroot
Warning: mod_wsgi requests to install files outside the common directory structure!
--->  Installing mod_wsgi @1.1_0
########################################################
# To enable mod_wsgi add
#  LoadModule python_module modules/mod_wsgi.so
# to your apache2 config file:
#  /opt/local/apache2/conf/httpd.conf
########################################################
--->  Activating mod_wsgi @1.1_0
--->  Cleaning mod_wsgi
spaceman ~ # otool -L /opt/local/apache2/modules/mod_wsgi.so
/opt/local/apache2/modules/mod_wsgi.so:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
	/System/Library/Frameworks/Python.framework/Versions/2.5/Python (compatibility version 2.5.0, current version 2.5.1)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
spaceman ~ # 

comment:5 Changed 15 years ago by blb@…

I see, the configure script is making some framework assumptions that don't work too well with MacPorts' python. Attached is a diff for mod_wsgi which should fix this. Note that an error with python24 was fixed in r48320 which is needed for this to work.

Changed 15 years ago by blb@…

Attachment: mod_wsgi.diff added

diff to mod_wsgi

comment:6 Changed 15 years ago by francis@…

Thanks, that patch works for me (with python24 2.4.6_2).

spaceman mod_wsgi # port install mod_wsgi
--->  Fetching mod_wsgi
--->  Verifying checksum(s) for mod_wsgi
--->  Extracting mod_wsgi
--->  Applying patches to mod_wsgi
--->  Configuring mod_wsgi
--->  Building mod_wsgi
--->  Staging mod_wsgi into destroot
Warning: mod_wsgi requests to install files outside the common directory structure!
--->  Installing mod_wsgi @1.1_1
########################################################
# To enable mod_wsgi add
#  LoadModule python_module modules/mod_wsgi.so
# to your apache2 config file:
#  /opt/local/apache2/conf/httpd.conf
########################################################
--->  Activating mod_wsgi @1.1_1
--->  Cleaning mod_wsgi
spaceman mod_wsgi # !otool
otool -L /opt/local/apache2/modules/mod_wsgi.so
/opt/local/apache2/modules/mod_wsgi.so:
	/opt/local/Library/Frameworks/Python.framework/Versions/2.4/Python (compatibility version 2.4.0, current version 2.4.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

comment:7 Changed 15 years ago by blb@…

Cc: blb@… added

Cc Me!

comment:8 Changed 15 years ago by Graham.Dumpleton@…

Is mod_wsgi 1.1 really the most up to date version of mod_wsgi MacPorts supply?

The latest version of mod_wsgi available at this time is mod_wsgi 2.3 with 2.4 and 3.0 not far away.

You should really be deprecating your 1.1 port and marking it not for use.

comment:9 Changed 15 years ago by blb@…

Resolution: fixed
Status: newclosed

Applied in r48610 (maintainer timeout).

comment:10 Changed 15 years ago by ys@…

sorry guys, have been on vacation...

comment:11 Changed 15 years ago by andreas@…

Nothing to do with the bug report but here's how I installed mod_wsgi 2.4 with macports python 2.6 and macports apache2:

http://tr.im/iKAV

I guess it would work with macports python 2.5 aswell.

comment:12 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

Note: See TracTickets for help on using tickets.