WebFaction
Community site: login faq

For an legacy application (plone 2.0.5) i need python 2.3. The compile succeeds but the zlib module is not built. The zlib.h file is present in /usr/include

I am at a loss here because later versions of python compile without problems with zlib support.

I tried so far: configure --prefix=path/to/my/install --zlib=/usr/include

and with a zlib compiled from scratch in my home dir

configure --prefix=path/to/my/install --zlib=/home/my-user/include configure --prefix=path/to/my/install --zlib=/home/my-user/

also configure --prefix=path/to/my/install --zlib=/home/my-user/

between make runs i always do a: make clean so no remnants of previous compiles should interfere

asked 01 Dec '11, 06:18

Christian%20Ledermann's gravatar image

Christian Le...
112
accept rate: 0%


Edit: Klynton looked into this and found the solution in the comments at this post: Configure and compile Python with Zlib

The trick is after you run configure, you need to uncomment zlib in Modules/Setup in the Python source tree, eg:

tar zxf Python-2.3.7.tgz
cd Python-2.3.7
./configure --prefix=$HOME/python
sed -i "s/^#zlib/zlib/g" Modules/Setup
make 
make install

That said, if you still want to build against a locally-installed zlib, then my original answer below should work.


I just tested installing Python 2.3 with zlib support on one of our CentOS 6 servers and was able to do it as follows (installing everything into ~/python):

mkdir ~/src ~/python
cd ~/src
wget http://zlib.net/zlib-1.2.5.tar.bz2
tar xjf zlib-1.2.5.tar.bz2
cd zlib-1.2.5
./configure --prefix=$HOME/python
make
make install
cd ..
wget http://www.python.org/ftp/python/2.3.7/Python-2.3.7.tgz
tar zxf Python-2.3.7.tgz
cd Python-2.3.7
./configure --prefix=$HOME/python --with-zlib=$HOME/python/include/
make
make install

A quick test after the build shows that zlib is available and working:

$ ~/python/bin/python -c "import zlib;x = zlib.compress('foo');print zlib.decompress(x)"
foo

Hope that helps!

permanent link

answered 01 Dec '11, 10:43

seanf's gravatar image

seanf ♦♦
11.9k21333
accept rate: 37%

edited 01 Dec '11, 17:20

thanks that works. Just for the record:

the trick seems to be to install zlib and python in the SAME directory (same --prefix)

so configure zlib:

./configure --prefix=/path/to/my/python

make

make install

and python:

./configure --prefix=/path/to/my/python --with-zlib=/path/to/my/python/include

make

make test

make install

note the --with-zlib=/path/to/my/python/include has include at the end of the path

permanent link

answered 02 Dec '11, 00:35

Christian%20Ledermann's gravatar image

Christian Le...
112
accept rate: 0%

edited 02 Dec '11, 00:38

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×333
×7

question asked: 01 Dec '11, 06:18

question was seen: 5,513 times

last updated: 02 Dec '11, 00:38

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2017 PARAGON INTERNET GROUP LIMITED
WEBFACTION IS A SERVICE OF PARAGON INTERNET GROUP LIMITED
REGISTERED IN ENGLAND AND WALES 7573953 - VAT REGISTRATION NUMBER 182147021
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM