Ubuntu: Installing zlib

by on Jun.24, 2010, under Linux (Ubuntu)

Today I tried to compile ProFTPd with some additional modules (for example: mod_quotatab). However, after configuring and trying to compile the project, I received an error message. It said something like /usr/bin/ld: cannot find -lz . I googled for this error message and found out, it was caused by a library called zlib, so I decided to install it ^^

1. Download the installation package (if the link doesn’t work, simply visit their website here)(Thanks to srinivasu for the updated link):

2. After downloading the package, extract it like that :
tar -xvzf zlib-1.2.8.tar.gz

3. Change to the directory we just created :
cd zlib-1.2.8

4. Configure the zlib library :
./configure --prefix=/usr/local/zlib

5. Compile it :

6. Install it :
sudo make install

That’s it, zlib should be installed properly

And here’s how to install the HEADER files of zlib. They’re needed when compiling several applications from source.

aptitude install zlib1g-dev

10 Comments for this entry

  • Buxer

    Guys I need some reff ;< .. please register:

  • medical assistant

    I’ve recently started a blog, the information you provide on this site has helped me tremendously. Thank you for all of your time & work.

  • Keeley

    shares use a fantastic webpage decent Gives thank you for the work to guide myself

  • Mark

    when i try to install zlib-1.2.5

    when i put ./configure i get this. and i don´t know what to do. i installed first build-essential

    Checking for gcc…
    checking for shared library support…
    No shared library support.
    building static library libz.a version 1.2.5 with cc.
    Checking for off64_t… No.
    Checking for fseeko… No.
    Checking for unistd.h… No.
    checking whether to use vs[n]printf() or s[n]printf() …using s[n]printf().
    Checking for snprintf() in stdio.h…No.

  • admin

    Try to install gcc via the following command:
    apt-get install gcc

    Then follow my tutorial and use:
    ./configure –prefix=/usr/local/zlib

    I got the following output:
    Checking for gcc…
    Checking for shared library support…
    Building shared library with gcc.
    Checking for off64_t… Yes.
    Checking for fseeko… Yes.
    Checking for unistd.h… Yes.
    Checking whether to use vs[n]printf() or s[n]printf()… using vs[n]printf().
    Checking for vsnprintf() in stdio.h… Yes.
    Checking for return value of vsnprintf()… Yes.
    Checking for attribute(visibility) support… Yes.

  • patrick

    need to update your post as zlib file is not found
    command should now be wget

    hope this helps

  • Lasan

    thank you. It helped

  • Sankar

    i am trying to compile zlib with above steps but am getting below error.

    ./configure –prefix=/ccmwa/fscm/siva/new/zlib
    Checking for gcc…
    /usr/ucb/cc: language optional software package not installed
    Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).
    ** ./configure aborting.

    Please some one help to resolve this issue?

  • Thiago

    Same error here (‘Compile error reporting is to harsh…’).

Leave a Reply


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!