I just found this out today – if you get the “/usr/bin/ld: cannot find -lz” message when you are trying to compile code in linux, it means you need to get the zlib development packages.

This took a long time to figure out, so I figured I would share the love.

if you are using Ubuntu:

Go to the package manager and search for zlib. Add the packages that appear that mention development in their description.

EDIT: It seems this post is getting a lot of hits. If you found it useful or have anything to add please reply to help other out too!

Post or Rate This Article:
  • Digg
  • Reddit
  • Slashdot
  • del.icio.us
  • Fark
  • NewsVine
  • Google Bookmarks
Tags:
3 Responses to “How to Fix: “/usr/bin/ld: cannot find -lz””
  1. zlib1g-dev was the package that worked for me. Thx!

  2. Carlos Eduardo says:

    Thanks for the tip ;)

  3. Thx for the tip. zlib1g-dev solved the problem

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>