2

Recently switched back to Ubuntu 16.04 and had an unprecedented amount of trouble getting cabal to work. Cabal 1.22 is currently installed and "working"...

I tried installing a package that I wrote as a test, but it depends on base>=4.10, which cabal 1.22 apparently can't access:

cabal update
cabal install base

Resolving dependencies...
All the requested packages are already installed:
base-4.9.1.0
Use --reinstall if you want to reinstall anyway.

cabal install base-4.10

Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: base (user goal)
rejecting: base-4.10.0.0, 4.9.1.0/installed-4.9..., 4.9.1.0, 4.9.0.0, 4.8.2.0,
4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0, 4.5.1.0,
4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1, 4.2.0.0,
4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires ==4.10)
Dependency tree exhaustively searched.

So I tried installing the newest version of cabal:

Resolving dependencies...
Configuring zlib-0.6.2...
Failed to install zlib-0.6.2
Build log ( /home/ebanflo/.cabal/logs/zlib-0.6.2.log ):
Configuring zlib-0.6.2...
setup-Simple-Cabal-2.2.0.1-x86_64-linux-ghc-8.0.2: Missing dependency on a
foreign library:
* Missing (or bad) header file: zlib.h
* Missing (or bad) C library: z
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

cabal: Error: some packages failed to install:
cabal-install-2.2.0.0 depends on zlib-0.6.2 which failed to install.
hackage-security-0.5.3.0 depends on zlib-0.6.2 which failed to install.
zlib-0.6.2 failed during the configure step. The exception was:
ExitFailure 1

I tried installing zlib and got the same error message.

I was tempted to upload a new version of my package with lower dependencies to see if it would work, but haven't yet because that's a stupid solution since I still won't be able to download packages with these inaccessible dependencies.

UPDATE:

I tried installing zlib1g-dev from the apt repository:

sudo apt install zlib1g-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 zlib1g-dev : Depends: zlib1g (= 1:1.2.8.dfsg-2ubuntu4) but 1:1.2.8.dfsg-2ubuntu4.1 is to be installed
E: Unable to correct problems, you have held broken packages.

So I tried installing the non-dev version:

sudo apt install zlib1g

Reading package lists... Done
Building dependency tree       
Reading state information... Done
zlib1g is already the newest version (1:1.2.8.dfsg-2ubuntu4.1).
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.

I tried a few things to install 1.2.8.dfsg-2ubuntu4 but I guess I don't know the proper syntax. I also tried to purge and autoremove zlib1g and got the following error message for both commands:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 crda : Depends: libssl1.0.0 (>= 1.0.0) but it is not going to be installed
 libical1a : Depends: tzdata but it is not going to be installed
 mount : PreDepends: libblkid1 (>= 2.17.2) but it is not going to be installed
         PreDepends: libmount1 (>= 2.25) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Next I'm going to try installing the Haskell zlib mentioned in the comments straight from the cabal source package.

Downloaded, extracted, ran ghc Setup, and tried to run ./Setup configure and got the following error message:

Configuring zlib-0.6.2...
Setup: Missing dependency on a foreign library:
* Missing (or bad) header file: zlib.h
* Missing (or bad) C library: z
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

Well that should be fine, I do have some version of zlib1g installed, or so I thought. After running dpkg -L zlib I found that there are no binary files for zlib. I'm totally lost.

  • »» Missing (or bad) header file: zlib.h «« : Maybe sudo apt install zlib1g-dev ... Please note that "zlib-0.6.2" is the "haskell zlib 0.6.2". hackage.haskell.org/package/zlib – Knud Larsen Jun 3 '18 at 13:15
  • KnudLarsen Thanks, didn't work but next I'm going to try installing via the tarball on hackage. – Eben Cowley Jun 3 '18 at 19:40
1

Haskell beginner here.

sudo apt install libghc-zlib-dev did the trick for me on the same symptom but on a different case (using stack and including zlib or any other package which depends on zlib in package.yaml, and then trying to call stack build).

I hope this solves your problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.