Building from source -- zlib/binascii problems 2.5.2/2.6.1

Discussion in 'Python' started by peter s., Dec 14, 2008.

  1. peter s.

    peter s. Guest

    I am trying to build Python from source on a RHEL system where I do
    not have root access. There are two modules that I am having trouble
    with: zlib & binascii.

    zlib -- This seems like a make configuration issue. I have noticed
    that 'gcc -v' returns '--with-system-zlib':
    $ gcc -v
    Using built-in specs.
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
    infodir=/usr/share/info --enable-shared --enable-threads=posix --
    enable-checking=release --with-system-zlib --enable-__cxa_atexit --
    disable-libunwind-exceptions --enable-libgcj-multifile --enable-
    languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --
    disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-
    gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
    Thread model: posix
    gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)

    and then when I run 'make' I see:

    building 'zlib' extension
    gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -
    Wstrict-prototypes -I. -I/location/of/Python-2.5.2/./Include -I. -
    IInclude -I./Include -I/usr/local/include -I/location/of/Python-2.5.2/
    Include -I/location/of/Python-2.5.2 -c /location/of/Python-2.5.2/
    Modules/zlibmodule.c -o build/temp.linux-x86_64-2.5/location/of/
    Python-2.5.2/Modules/zlibmodule.o
    gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
    Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
    lib.linux-x86_64-2.5/zlib.so
    /usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for
    -lz
    /usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -
    lz
    /usr/bin/ld: cannot find -lz
    collect2: ld returned 1 exit status

    It seems as though I need to force the build process to use the zlib
    that comes with python source.

    binascii -- I have no idea what binascii requires in order to compile,
    so I am clueless. It properly compiles with 2.5.2, but fails to build
    in 2.6.1. I am OK using 2.5.2 if I could get zlib to work.

    Thanks,

    Peter
    peter s., Dec 14, 2008
    #1
    1. Advertising

  2. > Target: x86_64-redhat-linux
    > gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
    > Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
    > lib.linux-x86_64-2.5/zlib.so
    > /usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for
    > -lz


    Do

    file /usr/lib/libz.so

    It might be a 32-bit library, in which case you can check whether
    /usr/lib64 has a 64-bit library. I'm puzzled why it only
    happens for -lz; perhaps you are better of compiling with a 32-bit
    compiler.

    Regards,
    Martin
    Martin v. Löwis, Dec 14, 2008
    #2
    1. Advertising

  3. peter s.

    peter s. Guest

    On Dec 14, 4:54 pm, "Martin v. Löwis" <> wrote:
    > > Target: x86_64-redhat-linux
    > > gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
    > > Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
    > > lib.linux-x86_64-2.5/zlib.so
    > > /usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for
    > > -lz

    >
    > Do
    >
    >   file /usr/lib/libz.so
    >
    > It might be a 32-bit library, in which case you can check whether
    > /usr/lib64 has a 64-bit library. I'm puzzled why it only
    > happens for -lz; perhaps you are better of compiling with a 32-bit
    > compiler.
    >
    > Regards,
    > Martin


    $ file /usr/lib/libz.s*
    /usr/lib/libz.so: symbolic link to `libz.so.1.2.3'
    /usr/lib/libz.so.1: symbolic link to `libz.so.1.2.3'
    /usr/lib/libz.so.1.2.3: ELF 32-bit LSB shared object, Intel 80386,
    version 1 (SYSV), stripped
    peter s., Dec 14, 2008
    #3
  4. peter s.

    peter s. Guest

    On Dec 14, 5:03 pm, "peter s." <> wrote:
    > On Dec 14, 4:54 pm, "Martin v. Löwis" <> wrote:
    >
    >
    >
    > > > Target: x86_64-redhat-linux
    > > > gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
    > > > Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
    > > > lib.linux-x86_64-2.5/zlib.so
    > > > /usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for
    > > > -lz

    >
    > > Do

    >
    > >   file /usr/lib/libz.so

    >
    > > It might be a 32-bit library, in which case you can check whether
    > > /usr/lib64 has a 64-bit library. I'm puzzled why it only
    > > happens for -lz; perhaps you are better of compiling with a 32-bit
    > > compiler.

    >
    > > Regards,
    > > Martin

    >
    > $ file /usr/lib/libz.s*
    > /usr/lib/libz.so:       symbolic link to `libz.so.1.2.3'
    > /usr/lib/libz.so.1:     symbolic link to `libz.so.1.2.3'
    > /usr/lib/libz.so.1.2.3: ELF 32-bit LSB shared object, Intel 80386,
    > version 1 (SYSV), stripped


    I meant to also add

    $ file /usr/lib64/libz.s*
    /usr/lib64/libz.so.1: symbolic link to `libz.so.1.2.3'
    /usr/lib64/libz.so.1.2.3: ELF 64-bit LSB shared object, AMD x86-64,
    version 1 (SYSV), stripped

    So.. it seems as though I need to get it to point to the 64 bit
    version (or compile the zlib that comes with Python source). I'm not
    sure how to override that.
    peter s., Dec 14, 2008
    #4
  5. > So.. it seems as though I need to get it to point to the 64 bit
    > version (or compile the zlib that comes with Python source). I'm not
    > sure how to override that.


    The easiest solution would be to invoke the linker line manually,
    and replace -lz with the absolute path to the right library.

    Regards,
    Martin
    Martin v. Löwis, Dec 14, 2008
    #5
  6. peter s.

    peter s. Guest

    On Dec 14, 5:20 pm, "Martin v. Löwis" <> wrote:
    > > So.. it seems as though I need to get it to point to the 64 bit
    > > version (or compile the zlib that comes with Python source).  I'm not
    > > sure how to override that.

    >
    > The easiest solution would be to invoke the linker line manually,
    > and replace -lz with the absolute path to the right library.
    >
    > Regards,
    > Martin


    Thanks for you help thus far, though I am still stuck. I have tried a
    number of things with no success. Modifying the actual command that
    builds the zlibmodule to link to other sources produces different
    errors, such as "build/lib.linux-x86_64-2.5/zlib.so: undefined symbol:
    inflateEnd". Will update this thread if I find a solution.
    peter s., Dec 15, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nobody
    Replies:
    7
    Views:
    1,202
    nobody
    Apr 13, 2004
  2. mhearne808[insert-at-sign-here]gmail[insert-dot-he

    Problems building zlib module on RHEL

    mhearne808[insert-at-sign-here]gmail[insert-dot-he, Mar 18, 2008, in forum: Python
    Replies:
    1
    Views:
    650
    mhearne808[insert-at-sign-here]gmail[insert-dot-he
    Mar 18, 2008
  3. Matthew Brett
    Replies:
    4
    Views:
    1,076
    Matthew Brett
    May 9, 2010
  4. Daniel Berger
    Replies:
    5
    Views:
    224
    Roger Pack
    Jun 21, 2009
  5. Nicholas Wieland

    Most simple usage of zlib or pr-zlib

    Nicholas Wieland, Mar 9, 2011, in forum: Ruby
    Replies:
    4
    Views:
    295
    Jeremy Bopp
    Mar 10, 2011
Loading...

Share This Page