08.18.08

Installing mod_python on 64-bit redhat ES 4

Posted in Web authoring, python, linux at 10:29 am by karl

I recently had to install python2.5 and mod_python on some RedHat ES4 x86_64 machines. It turned out to be a little more complicated than I anticipated. First I installed python and everything seemed OK, but later on I discovered (while trying to install some python modules) that it wasn’t compiled against zlib correctly. To add further pain, having figured out the above I tried to compile mod_python and got the following error:

/usr/bin/ld:
/usr/lib/python2.4/config/libpython2.4.a(abstract.o):
relocation R_X86_64_32 against `a local symbol' can not be
used when making a shared object; recompile with -fPIC
/usr/lib/python2.4/config/libpython2.4.a: could not read
symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

After some trawling the interwebs I found some answers on the python mailing list and on agile testing. Basically it comes down to how shared libraries are compiled - in certain circumstances “relocatable code” needs to be generated (presumably something to do with the larger address space on 64 bit architectures) and this isn’t done by default when you build python on a 64 bit system (the python mailing list entry above explains the rationale).

Here are the steps I used to make mod_python/python2.5 work on RedHat ES4 (x86_64):

1. install zlib1.2.3 (edit makefile with CFLAGS = "-fPIC")
 > ./configure --shared
 > make
 > sudo make install	This puts this version of zlib in /usr/local/lib (the original is in /usr/lib)

2. install python 2.5:
 > ./configure --enable-shared
 > CFLAGS="-fPIC" CXXFLAGS="-fPIC" LDFLAGS="/usr/local/lib" make
 > su

 # make install
 # vi /etc/ld.so.conf.d/python2.5.conf
 	add text '/usr/local/bin' to file and :wq (see other files in that folder for examples)
 # /sbin/ldconfig
 # exit

now check if you've got 64 bit python:
 > python
 >>> import sys
 >>> sys.maxint
 9223372036854775807 # hurray! this is a 64 bit number
 >>> quit()

make sure you're linking against 64 bit libs:

> ldd /usr/local/bin/python
The listed libs should all start with /lib64

3. make sure you've got apache2 and related libs
> up2date -i http http-devel

5. install mod_python 3.3.1:
 >./configure --with-apxs=/usr/sbin/apxs --with-python=/usr/local/bin/python
 > make
 >sudo make install

08.08.08

$(), python/cheetah and javascript/prototype

Posted in Web authoring, javascript, python at 10:06 am by karl

08.04.08

apache 2/mod_python on OS X

Posted in Web authoring, scripting, python at 3:12 pm by karl

07.07.08

Conway’s life in javascript

Posted in Web authoring, scripting, javascript at 6:15 pm by karl

06.17.08

MVC dispatcher in python

Posted in Web authoring, scripting, python at 3:16 pm by karl

05.27.08

I *heart* python

Posted in scripting, python at 3:07 pm by karl

03.31.08

Web pages performance checklist

Posted in Web authoring, scripting at 7:26 pm by karl

02.19.08

Leitrim Design House website

Posted in Web authoring, javascript at 4:19 pm by karl

02.01.08

how to choose a javascript library

Posted in Web authoring, javascript at 11:28 pm by karl

12.10.07

Google charts - bring on the trends API!

Posted in Web authoring, mashups at 11:52 pm by karl

« Previous entries · Next entries »