Cabal Install cabal-install Fails on Linux
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:
- libghc-zeromq-haskell-dev
- libghc-zeromq-haskell-doc
- libghc-zeromq-haskell-prof
- libghc-zip-archive-dev
- libghc-zip-archive-doc
- libghc-zip-archive-prof
- libghc-zlib-bindings-dev
- libghc-zlib-bindings-doc
- libghc-zlib-bindings-prof
- libghc-zlib-conduit-dev
- libghc-zlib-conduit-doc
- libghc-zlib-conduit-prof
- libghc-zlib-dev
- libghc-zlib-doc
- libghc-zlib-enum-dev
- libghc-zlib-enum-doc
- libghc-zlib-enum-prof
- libghc-zlib-prof
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:
- libghc-zlib-dev
- libghc-zlib-bindings-dev
- libghc-zlib-enum-dev
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 :)