Results 1 to 5 of 5

Thread: Compiling python 2.5/2.6 with zlib

  1. #1
    Join Date
    May 2011
    Beans
    2

    Compiling python 2.5/2.6 with zlib

    Hi,

    I'm trying to compile Python 2.5.5 (and 2.6) with zlib support on Natty. I have installed zlib1g-dev and several other dev packages. I'm able to compile python but zlib is not included:

    ImportError: No module named zlib

    Anyone else that have this problem, or have a solution for it?

    Best wishes

    Svenn.

  2. #2
    Join Date
    Dec 2010
    Beans
    3

    Re: Compiling python 2.5/2.6 with zlib

    Quote Originally Posted by Svennhg View Post
    I'm trying to compile Python 2.5.5 (and 2.6) with zlib support on Natty.

    ImportError: No module named zlib
    It is Ubuntu's "fault". They changed where shared libraries are placed in order to support multiple architectures better (eg both x86 and x86_amd64 on the same machine) in a way that diverges from how it has always been done in the past.

    As part of Python's build process it has many optional modules such as zlib. To determine if a module can be built it looks for a header file and for the library in the normal locations. Because of the changed layout it can't find the library and hence doesn't build the module.

    Upstream Python is being patched, but that doesn't really help as they are only doing it with current versions of Python. (I have to build every Python version from 2.3 through 3.3 so a few patched versions doesn't do me any good.)

    This disgusting hack works for me on an AMD64 machine:

    Code:
      cd /lib
      sudo ln -s x86_64-linux-gnu/libz.so.1 libz.so

  3. #3
    Join Date
    May 2011
    Beans
    2

    Re: Compiling python 2.5/2.6 with zlib

    Thanks, this worked for me as well.

  4. #4
    Join Date
    May 2008
    Location
    Edinburgh, UK
    Beans
    188
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Compiling python 2.5/2.6 with zlib

    Unfortunately, it didn't work for me (I have python2.5 in opt, as Ubuntu runs on 2.6)

  5. #5
    Join Date
    Jan 2010
    Location
    Hannover, Deutschland
    Beans
    4
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Compiling python 2.5/2.6 with zlib

    The disgusting hack worked for me. But this other way from Christian Heimes at LiPyrary also worked for me as well as allowing many other necessary bits to be installed as well...

    http://lipyrary.blogspot.mx/2011/05/...untu-1104.html

    Code:
    $ make distclean
    $ export LDFLAGS="-L/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
    $ ./configure
    $ make
    $ make install
    $ unset LDFLAGS
    Last edited by hunterm4573r; April 30th, 2012 at 05:54 PM. Reason: found more resources

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •