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

烈酒焚心 提交于 2019-12-04 23:56:40

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/18516956/how-to-compile-python-2-4-6-with-ssl-readline-and-zlib-on-debian-lenny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!