How do I troubleshoot cabal-install errors for the vector-algorithms package, darcs, and others? - haskell

$ ghc -V; cabal -V
The Glorious Glasgow Haskell Compilation System, version 7.0.1
cabal-install version 0.8.2
using version 1.8.0.6 of the Cabal library
Here's the error:
$ cabal install vector-algorithms
Resolving dependencies...
Configuring vector-algorithms-0.3.4...
Preprocessing library vector-algorithms-0.3.4...
Building vector-algorithms-0.3.4...
[1 of 9] Compiling Data.Vector.Algorithms.Common ( Data/Vector/Algorithms/Common.hs, dist/build/Data/Vector/Algorithms/Common.o )
[2 of 9] Compiling Data.Vector.Algorithms.Radix ( Data/Vector/Algorithms/Radix.hs, dist/build/Data/Vector/Algorithms/Radix.o )
[3 of 9] Compiling Data.Vector.Algorithms.Search ( Data/Vector/Algorithms/Search.hs, dist/build/Data/Vector/Algorithms/Search.o )
[4 of 9] Compiling Data.Vector.Algorithms.Optimal ( Data/Vector/Algorithms/Optimal.hs, dist/build/Data/Vector/Algorithms/Optimal.o )
[5 of 9] Compiling Data.Vector.Algorithms.Insertion ( Data/Vector/Algorithms/Insertion.hs, dist/build/Data/Vector/Algorithms/Insertion.o )
[6 of 9] Compiling Data.Vector.Algorithms.TriHeap ( Data/Vector/Algorithms/TriHeap.hs, dist/build/Data/Vector/Algorithms/TriHeap.o )
[7 of 9] Compiling Data.Vector.Algorithms.Intro ( Data/Vector/Algorithms/Intro.hs, dist/build/Data/Vector/Algorithms/Intro.o )
[8 of 9] Compiling Data.Vector.Algorithms.Merge ( Data/Vector/Algorithms/Merge.hs, dist/build/Data/Vector/Algorithms/Merge.o )
[9 of 9] Compiling Data.Vector.Algorithms.Combinators ( Data/Vector/Algorithms/Combinators.hs, dist/build/Data/Vector/Algorithms/Combinators.o )
Data/Vector/Algorithms/Combinators.hs:36:23:
Couldn't match type `forall s1. ST s1 (Mutable v s1 e)'
with `ST s (mv s e)'
In the second argument of `(.)', namely `N.New'
In the expression: new . N.New
In the expression:
(new . N.New)
(M.unstream (stream v) >>= \ arr -> algo arr >> return arr)
cabal: Error: some packages failed to install:
vector-algorithms-0.3.4 failed during the building phase. The exception was:
ExitFailure 1
I also noticed that when I installed cabal-install it installed process-1.0.1.4, random-1.0.0.3, Cabal-1.8.0.6,
and the time-1.2.0.3 packages which were already present in the global package database.
For example, trying to install darcs and other packages I receive the following:
Resolving dependencies...
<command line>: cannot satisfy -package Cabal-1.10.0.0:
Cabal-1.10.0.0-30b3f082077a2793c432ea426276c8f9 is unusable due to missing or recursive dependencies:
process-1.0.1.4-b476e45706840d55749b12ebe18dc835
(use -v for more information)
cabal: Error: some packages failed to install:
I tried ghc-pkg unregister for all the dups, but that didn't help.
I also tried ghc-pkg check and that doesn't return anything, ever.
I tried starting over, removing all the local databases including $HOME/.cabal/, then reinstalling cabal-install and this is where I'm currently at.
This is the result after removing everything, and reinstalling cabal-install:
$ ghc-pkg list
/usr/local/lib/ghc-7.0.1/package.conf.d:
Cabal-1.10.0.0
array-0.3.0.2
base-4.3.0.0
bin-package-db-0.0.0.0
bytestring-0.9.1.8
containers-0.4.0.0
directory-1.1.0.0
extensible-exceptions-0.1.1.2
ffi-1.0
filepath-1.2.0.0
(ghc-7.0.1)
(ghc-binary-0.5.0.2)
ghc-prim-0.2.0.0
(haskell2010-1.0.0.0)
haskell98-1.1.0.0
hpc-0.5.0.6
integer-gmp-0.2.0.2
old-locale-1.0.0.2
old-time-1.0.0.6
pretty-1.0.1.2
process-1.0.1.4
random-1.0.0.3
rts-1.0
template-haskell-2.5.0.0
time-1.2.0.3
unix-2.4.1.0
/home/moisei/.ghc/x86_64-linux-7.0.1/package.conf.d:
Cabal-1.8.0.6
HTTP-4000.1.0
ListLike-1.1.0
MonadCatchIO-transformers-0.2.2.2
PSQueue-1.1
attoparsec-0.8.2.0
attoparsec-iteratee-0.1.2
binary-0.5.0.2
bytestring-mmap-0.2.1
bytestring-nums-0.3.2
bytestring-show-0.3.4
cere containers-0.3.0.0
deepseq-1.1.0.2
directory-1.0.1.2
directory-tree-0.9.1
dlist-0.5
filepath-1.1.0.4
haskell98-1.1.0.0
iteratee-0.3.6
monads-fd-0.1.0.2
mtl-1.1.1.0
mtl-2.0.1.0
murmur-hash-0.1.0.2
network-2.2.1.10
network-2.3
network-bytestring-0.1.3.2
parsec-2.1.0.1
primitive-0.3.1
process-1.0.1.4
random-1.0.0.3
template-haskell-2.5.0.0
text-0.10.0.0
time-1.1.4
transformers-0.2.2.0
unix-compat-0.2
vector-0.7.0.1
zlib-0.5.2.0

These aren't cabal errors. The vector package doesn't build out of the box with GHC 7 (yet). You're an early adopter, jumping on GHC 7 before the Haskell Platform version is released.
As an early adopter, your duty is to report build errors to package maintainers.

Related

Cannot install linear library

I am on Ubuntu and this is the error message that I keep getting. This library is a dependency for sdl2. Is there some other external library I need to install?
ghc version: 8.0.2
cabal version: 1.24.2.0
$ cabal install linear
Resolving dependencies...
Configuring linear-1.21...
Building linear-1.21...
Failed to install linear-1.21
Build log ( /home/dagon/.cabal/logs/linear-1.21.log ):
cabal: Entering directory '/tmp/cabal-tmp-19434/linear-1.21'
[1 of 1] Compiling Main ( /tmp/cabal-tmp-19434/linear-1.21/dist/setup/setup.hs, /tmp/cabal-tmp-19434/linear-1.21/dist/setup/Main.o )
Linking /tmp/cabal-tmp-19434/linear-1.21/dist/setup/setup ...
Configuring linear-1.21...
Building linear-1.21...
Preprocessing library linear-1.21...
[ 1 of 22] Compiling Linear.Instances ( src/Linear/Instances.hs, dist/build/Linear/Instances.o )
[ 2 of 22] Compiling Linear.Vector ( src/Linear/Vector.hs, dist/build/Linear/Vector.o )
[ 3 of 22] Compiling Linear.Epsilon ( src/Linear/Epsilon.hs, dist/build/Linear/Epsilon.o )
[ 4 of 22] Compiling Linear.Metric ( src/Linear/Metric.hs, dist/build/Linear/Metric.o )
[ 5 of 22] Compiling Linear.V ( src/Linear/V.hs, dist/build/Linear/V.o )
[ 6 of 22] Compiling Linear.V0 ( src/Linear/V0.hs, dist/build/Linear/V0.o )
src/Linear/V0.hs:118:26: error:
• Can't find interface-file declaration for variable Language.Haskell.TH.Lib.conE
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
• In the expression:
Language.Haskell.TH.Lib.conE
(Language.Haskell.TH.Syntax.mkNameG_d
"linear-1.21-3KFkhfsxDISEWxZYTrwhrX" "Linear.V0" "V0")
In an equation for ‘lift’:
lift V0
= Language.Haskell.TH.Lib.conE
(Language.Haskell.TH.Syntax.mkNameG_d
"linear-1.21-3KFkhfsxDISEWxZYTrwhrX" "Linear.V0" "V0")
When typechecking the code for ‘Language.Haskell.TH.Syntax.lift’
in a derived instance for ‘Lift (V0 a)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Lift (V0 a)’
cabal: Leaving directory '/tmp/cabal-tmp-19434/linear-1.21'
cabal: Error: some packages failed to install:
linear-1.21 failed during the building phase. The exception was:
ExitFailure 1
This is possibly a problem with your (very old) versions of cabal and GHC. Notice how things progress when using newer versions:
% docker run --rm -it haskell bash
... downloading image ...
# ghc --version && cabal --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3
cabal-install version 3.0.1.0
compiled using version 3.0.2.0 of the Cabal library
# cabal update && cabal install --lib linear
... lots of download/build/install steps...
Starting linear-1.21 (all, legacy fallback)
Building linear-1.21 (all, legacy fallback)
Installing linear-1.21 (all, legacy fallback)
Completed linear-1.21 (all, legacy fallback)
# ghci
Prelude> import Linear
Prelude Linear>

Can't install 'ihaskell-diagrams' using Cabal

When I try to
cabal install ihaskell-diagrams
I get the error
The pkg-config package 'glib-2.0' is required but it could not be
found.
What is glib and how do I install it so that it is available for Cabal?
Resolving dependencies...
Configuring cairo-0.13.1.0...
Configuring glib-0.13.2.1...
Failed to install cairo-0.13.1.0
Build log ( /Users/Rax/.cabal/logs/cairo-0.13.1.0.log ):
[1 of 2] Compiling SetupWrapper ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/SetupWrapper.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/setup.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/Main.o )
Linking /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57646/cairo-0.13.1.0/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring cairo-0.13.1.0...
setup: The pkg-config package 'cairo' version >=1.2.0 is required but it could
not be found.
Failed to install glib-0.13.2.1
Build log ( /Users/Rax/.cabal/logs/glib-0.13.2.1.log ):
[1 of 2] Compiling SetupWrapper ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/SetupWrapper.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/setup.hs, /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/Main.o )
Linking /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/cabal-tmp-57647/glib-0.13.2.1/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.13.2.1...
setup: The pkg-config package 'glib-2.0' is required but it could not be
found.
cabal: Error: some packages failed to install:
cairo-0.13.1.0 failed during the configure step. The exception was:
ExitFailure 1
diagrams-cairo-1.3.0.5 depends on glib-0.13.2.1 which failed to install.
glib-0.13.2.1 failed during the configure step. The exception was:
ExitFailure 1
ihaskell-diagrams-0.3.1.0 depends on glib-0.13.2.1 which failed to install.
pango-0.13.1.0 depends on glib-0.13.2.1 which failed to install.
The confusion here results from the perhaps unclear error message: the missing components are not Cabal packages, but libraries that need to be separately installed.
Some of these libraries have their own dependencies, or installing them may reveal additional missing packages, so that the specific requirements on your system my be different; but in general, when you get an error that a "pig-config package" is missing, you will need to install it with your package manager (not Cabal).
For example,
brew install glib
brew install cairo
brew install pango
work for me and allow me to
cabal install ihaskell-diagrams
without further errors.

System.IO.UTF8 not found (installing PureScript)

I'm trying to install PureScript on Ubuntu 14.04. I have the latest version of Haskell-Platform and have run cabal update. During cabal install purescript I get an error saying that the module System.IO.UTF8 is not found. Googling reveals that this is part of utf8-string and should be one of the exposed modules when that package is installed.
However, when I install it, no such package is available:
ely#eschaton:~$ cabal update
Downloading the latest package list from hackage.haskell.org
ely#eschaton:~$ cabal --reinstall install utf8-string
Resolving dependencies...
In order, the following will be installed:
utf8-string-1 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring utf8-string-1...
Building utf8-string-1...
Preprocessing library utf8-string-1...
[1 of 5] Compiling Codec.Binary.UTF8.String ( Codec/Binary/UTF8/String.hs, dist/build/Codec/Binary/UTF8/String.o )
[2 of 5] Compiling Codec.Binary.UTF8.Generic ( Codec/Binary/UTF8/Generic.hs, dist/build/Codec/Binary/UTF8/Generic.o )
[3 of 5] Compiling Data.String.UTF8 ( Data/String/UTF8.hs, dist/build/Data/String/UTF8.o )
[4 of 5] Compiling Data.ByteString.UTF8 ( Data/ByteString/UTF8.hs, dist/build/Data/ByteString/UTF8.o )
[5 of 5] Compiling Data.ByteString.Lazy.UTF8 ( Data/ByteString/Lazy/UTF8.hs, dist/build/Data/ByteString/Lazy/UTF8.o )
In-place registering utf8-string-1...
Installing library in /home/ely/.cabal/lib/utf8-string-1/ghc-7.6.3
Registering utf8-string-1...
Installed utf8-string-1
ely#eschaton:~$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> import System.IO.UTF8
<no location info>:
Could not find module `System.IO.UTF8'
It is not a module in the current program, or in any known package.
You can see that only 5 of the stated proposed libraries are compiled.
The PureScript source definitely makes use of System.IO.UTF8.
But System.IO.UTF8 looks like a pretty old package that has not undergone changes in a long time (2+ years), so it's unlikely that this was a significant change in a recent version. To boot, PureScript is very new, and so would surely be based on newer versions of utf8-string if they were available.
So the question is: why isn't PureScript able to install this dependency on its own ... and why does the cabal installation of utf8-string fail to expose the System.IO.UTF8 module as it suggests it should.
Looks like utf-string was updated today (Jan 23) to version 1 which doesn't have System.IO.UTF8 module anymore. That one is present in previous version 0.3.8 of utf-string.
And the purescript doesn't specify the upper bound for utf-string.
EDIT I made a PR to workaround the issue.
There is more proper fix WIP too.

Windows 8 ghc-mod installation fails

I'm trying to work on Haskell in IntelliJ IDEA on Windows 8.
I installed the latest Haskell plugin, and found that it requires ghc.exe, cabal.exe and ghc-mod.exe prepared. Haskell Platform (x64) originally contains ghc.exe and cabal.exe, so what I need in order to make the plugin work is ghc-mod.exe.
Just as many guides say, I tried installing it through cabal like this:
cabal install ghc-mod
It failed installing haskell-src-exts in the middle of the process, so I installed happy and tried the same command again. Then it succeeded to install src-exts, yet not ghc-mod. Cabal produced this error log:
Building ghc-mod-0.3.0...
Preprocessing executable 'ghc-mod' for ghc-mod-0.3.0...
[1 of 6] Compiling Param ( Param.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Param.o )
[2 of 6] Compiling Lang ( Lang.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Lang.o )
[3 of 6] Compiling List ( List.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\List.o )
[4 of 6] Compiling Check ( Check.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Check.o )
[5 of 6] Compiling Browse ( Browse.hs, dist\dist-sandbox-67612b7f\build\ghc-mod\ghc-mod-tmp\Browse.o )
Browse.hs:41:72:
Not in scope: data constructor `ExplicitForall'
Perhaps you meant `ExplicitForAll' (imported from Language.Haskell.Exts.Extension)
This doesn't make sense to me at all. What can I do?

Installing gtk2hs

I've installed gtk2hs-buildtools with no problem, but here's the output when I try to install gtk using 'cabal install gtk':
[gautam#gautam ~]$ cabal install gtk
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/cairo-0.12.213784/cairo-0.12.2/SetupWrapper.hs, /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/cairo-0.12.213784/cairo-0.12.2/Setup.hs, /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/Main.o )
Linking /tmp/cairo-0.12.213784/cairo-0.12.2/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).
[1 of 2] Compiling SetupWrapper ( /tmp/glib-0.12.213784/glib-0.12.2/SetupWrapper.hs, /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/glib-0.12.213784/glib-0.12.2/Setup.hs, /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/Main.o )
Linking /tmp/glib-0.12.213784/glib-0.12.2/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Cannot find gtk2hsC2hs
Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin).
cabal: Error: some packages failed to install:
cairo-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gio-0.12.2 depends on glib-0.12.2 which failed to install.
glib-0.12.2 failed during the configure step. The exception was:
ExitFailure 1
gtk-0.12.2 depends on glib-0.12.2 which failed to install.
pango-0.12.2 depends on glib-0.12.2 which failed to install.
[gautam#gautam ~]$
This problem occurs on both my Mac and in my Fedora VM. Does anybody know how to fix this? Thanks!
You need to add the path in which the Gtk2Hs build tools are stored to your $PATH environment variable, so that the build process can find them. On Linux, it's $HOME/.cabal/bin. On OS X, it's $HOME/Library/Haskell/bin (although that might just be if you're using the Haskell Platform — if that doesn't work, try $HOME/.cabal/bin).
To add a directory to your $PATH, run export PATH=directory:$PATH. You should probably add this to your shell's startup file (it depends on your shell and OS — probably either ~/.bashrc, ~/.profile or ~/.bash_profile). (You'll need to do so if you want to run any programs you install with cabal directly, anyway.)

Resources