Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile Python 2.4.6 with ssl, readline and zlib on Debian Lenny

I have a virtual Linux box with Debian 7.1 where I need a Python 2.4.6 to reanimate an old Zope installation (in order to update it to Plone 4, of course).

I definitely need ssl support, and when I'm compiling, I want readline as well, of course. Finally, of course I need zlib, otherwise ez_setup.py etc. won't work; I'm having a hard time to get zlib included.

I downloaded the tarball of Python 2.4.6, enabled ssl in Modules/Setup.dist:

SSL=/usr/local/ssl
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

... and called:

./configure  --prefix=/my/dest/dir --with-zlib
make

make gives me some warnings at the end about crypt and nis, but make install doesn't yield any errors. However, the resulting Python features both readline and ssl support, but no zlib; thus, I can't use ez_setup.py to get setuptools/pip etc.

I tried both to uncomment and re-exclude the line

zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz

from Setup.dist.

Some system packages which are installed:

  • zlib1g-dev
  • lib32z1-dev
  • libreadline-gplv2-dev

Is there anything else I have missed?

Update, after heaving read https://stackoverflow.com/a/4047583/1051649:

I did

$ sudo apt-get install zlib1g zlib1g-dev libncurses5-dev libreadline6-dev ncurses-doc
$ python setup.py clean
$ ./configure --with-ssl --with-zlib --prefix=...
$ make
$ sudo make install

The resulting interpreter was not able to execute distribute_setup.py.

like image 565
Tobias Avatar asked Aug 29 '13 17:08

Tobias


1 Answers

I found the solution here:

I changed setup.py, looking for the first assignment to the lib_dirs variable, changing it like so:

lib_dirs = self.compiler.library_dirs + [
'/lib64', '/usr/lib64',
'/lib', '/usr/lib',
'/usr/lib/x86_64-linux-gnu',   # added
'/usr/lib/i386-linux-gnu',     # added
]

Then I repeated the whole thing, starting with setup.py clean, and it worked.

like image 150
Tobias Avatar answered Sep 29 '22 18:09

Tobias