While upgrading cabal with cabal-install on Ubuntu 12.04 I received the following error:
Linking dist/build/cabal/cabal ... /usr/bin/ld: cannot find -lz
After that extremely helpful error message, I decided to trawl the Internet. I found information on a similar error on SO that pointed to some possible libraries I needed to install on my OS.
The -l in -lz seemed to indicate libghc and the following characters the name of the library, in this case: z. So I searched for a list of libraries that were of the form: libghc-z* and came up with this list:
So I decided to filter the list to only libghc-zlib- variations. I also removed -doc and -prof variants. I further removed -conduit- variations because I was not using conduit.
The final list was:
I decided to install each library in turn. After which I would install cabal-install to see if it worked.
After installing libghc-zlib-dev via:
sudo apt-get install libghc-zlib-dev I found that cabal-install installed successfully. That turned out to be a very lucky guess.
Happy Days :)