Skip to content Skip to sidebar Skip to footer

Mod_wsgi Python2.5 Ubuntu 11.04 Problem

I have such cfg on my amd64 platform with ubuntu 11.04: build python2.5 from source to /usr/local/python2.5 virtualenv at /home/se7en/.virtualenvs/e-py25 alsp i recompile mod_wsg

Solution 1:

The operating system supplied Python versions on Linux boxes are compiled for UCS4 Unicode character width. If you build from source code, if you don't explicitly say otherwise it will default to UCS2. The result is that your system Python 2.5 and local version under /usr/local are expecting different widths for Unicode characters and since Unicode functions have the UCS type as part of the name, when you are using objects compiled for one Python with the other, you get undefined errors for the Unicode functions.

Why this is occuring as hinted at by other answer is that mod_wsgi.so is actually picking up the system wide UCS4 libpython2.5.so file instead of that for UCS2 Python under /usr/local/lib. Although you could set LD_LIBRARY_PATH to make a process to look in /usr/local/lib first, that is a pain to do under Apache. Instead what you should do is rebuild mod_wsgi from source code again and do:

make distclean
./configure --with-python=/usr/local/bin/python2.5LD_RUN_PATH=/usr/local/lib make
sudo make install

By setting LD_RUN_PATH as environment variable on the command when invoking 'make', the linker will embed /usr/local/lib into library search path direct into mod_wsgi.so. That way it will find correct libpython2.5.so at run time without needing to set LD_LIBRARY_PATH. You can confirm it worked by running 'ldd' on the resultant mod_wsgi.so and it should then pick up correct library from /usr/local/lib.

Solution 2:

It's loading against the system Python. You'll need to use $LD_LIBRARY_PATH to point it to the VE Python. See the ld.so(8) man page for details.

Post a Comment for "Mod_wsgi Python2.5 Ubuntu 11.04 Problem"