Windows 8 ghc-mod installation fails - haskell

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?

Related

Cabal-Install lost the informative qualities of its build output

I suspect this is either a problem with ghc or cabal-install:
I used to get build information in such a format:
Resolving dependencies...
Configuring ltk-0.8.0.6...
Building ltk-0.8.0.6...
Preprocessing library ltk-0.8.0.6...
[ 1 of 12] Compiling Graphics.UI.Frame.Panes ( src/Graphics/UI/Frame/Panes.hs, dist/build/Graphics/UI/Frame/Panes.o )
[ 2 of 12] Compiling Graphics.UI.Editor.Parameters ( src/Graphics/UI/Editor/Parameters.hs, dist/build/Graphics/UI/Editor/Parameters.o )
[ 3 of 12] Compiling Control.Event ( src/Control/Event.hs, dist/build/Control/Event.o )
[ 4 of 12] Compiling MyMissing ( src/MyMissing.hs, dist/build/MyMissing.o )
[ 5 of 12] Compiling Graphics.UI.Editor.Basics ( src/Graphics/UI/Editor/Basics.hs, dist/build/Graphics/UI/Editor/Basics.o )
[ 6 of 12] Compiling Graphics.UI.Editor.MakeEditor ( src/Graphics/UI/Editor/MakeEditor.hs, dist/build/Graphics/UI/Editor/MakeEditor.o )
[ 7 of 12] Compiling Text.PrinterParser ( src/Text/PrinterParser.hs, dist/build/Text/PrinterParser.o )
However, now I get this type of build output:
Configuring binary-shared-0.8.3...
Configuring cairo-0.12.5.1...
Building binary-shared-0.8.3...
Building cairo-0.12.5.1...
Installed binary-shared-0.8.3
Configuring ghc-paths-0.1.0.9...
Building ghc-paths-0.1.0.9...
Installed ghc-paths-0.1.0.9
Configuring glib-0.12.5.0...
As you can see, cabal-install or ghc, whichever is causing the problem, seems to be inducing undesirable laconism now. According to my cabal config, I am running at a default verbosity level of 1. Is there some configuration option that could have caused this particular behavior? In other words, how can I restore the original behavior? Version 1.18.0.2
Thanks to #Michael Snoyman for pointing out that configuring a jobs parameter or explicitly passing it as a -j flag will redirect much of the information that pertains to build output to a text file. More information is available here.

c2hs installation error with Mac OS X 10.7.5

I'm trying to install c2hs with cabal install c2hs.
I created ~/.cabal/bin to install the binary beforehand.
With the command cabal install c2hs to get the errors.
src/Control/StateTrans.hs:77:1: Warning:
Module `Prelude' does not export `catch'
[ 3 of 26] Compiling Data.Errors ( src/Data/Errors.hs, dist/build/c2hs/c2hs-tmp/Data/Errors.o )
[ 4 of 26] Compiling Data.Attributes ( src/Data/Attributes.hs, dist/build/c2hs/c2hs-tmp/Data/Attributes.o )
[ 5 of 26] Compiling Text.Lexers ( src/Text/Lexers.hs, dist/build/c2hs/c2hs-tmp/Text/Lexers.o )
[ 6 of 26] Compiling Control.StateBase ( src/Control/StateBase.hs, dist/build/c2hs/c2hs-tmp/Control/StateBase.o )
[ 7 of 26] Compiling Data.NameSpaces ( src/Data/NameSpaces.hs, dist/build/c2hs/c2hs-tmp/Data/NameSpaces.o )
[ 8 of 26] Compiling C2HS.C.Attrs ( src/C2HS/C/Attrs.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Attrs.o )
[ 9 of 26] Compiling C2HS.C.Builtin ( src/C2HS/C/Builtin.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Builtin.o )
[10 of 26] Compiling Paths_c2hs ( dist/build/autogen/Paths_c2hs.hs, dist/build/c2hs/c2hs-tmp/Paths_c2hs.o )
dist/build/autogen/Paths_c2hs.hs:21:13: Not in scope: `catch'
dist/build/autogen/Paths_c2hs.hs:22:13: Not in scope: `catch'
dist/build/autogen/Paths_c2hs.hs:23:14: Not in scope: `catch'
dist/build/autogen/Paths_c2hs.hs:24:17: Not in scope: `catch'
cabal: Error: some packages failed to install:
c2hs-0.16.5 failed during the building phase. The exception was:
ExitFailure 1
What is wrong with the installation? The ghc version is 7.6.3.
The install worked for me right now, on my Ubuntu box, so I can say for sure that c2hs isn't broken for everyone right now.
I think you might have version issues.... Try
cabal update
and try the install again.
In particular-
The function Prelude.catch was moved to Control.Exception.catch recently, see https://ghc.haskell.org/trac/ghc/ticket/4865. I downloaded the c2hs sources (using cabal unpack c2hs), and looked at what headers Paths_c2hs.hs needs (this seems to be the file with the import problems). This is what the imports section contained-
import qualified Control.Exception as Exception
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
(Paths_c2hs.hs is autogenerated, so I had to build it first).
Indeed, it was using Control.Exception. Because this is a module in base, you should have it, and probably just have out of date/mismatched packages. (In fact, my file's line numbers don't match your error message line numbers above- This is another indication we are using different versions, and I believe mine is up to date :) .)
Although I think that the "cabal update" will fix the problem, if not, try looking in these two places-
Does Control.Exception.catch exist in your base modules? Just try to compile an empty program with an dummy reference to catch, like this-
import Control.Exception
x = catch
main = undefined
Does your autogenerated Paths_c2hs.hs point to the correct catch function. Just use cabal to unpack, configure and build c2hs and then look at dist/build/autogen/Paths_c2hs.hs. (you will probably hit your error in the build phase, but given what you have shown above, it will happen after the Paths_c2hs.hs creation).
The issue was that I installed two different versions of ghc on my mac: one from brew install ghc and the other from haskell platform.
I had to install the newest version of haskell platform, but before doing that I also needed to uninstall old version uninstall-hs only VERSION and brew unistall ghc.
After reinstalling the newest haskell platform, the compilation works fine.
https://github.com/haskell/cabal/issues/1137
How to install Haskell cabal tool for Haskell 7.6.1 on Mac OSX?
Other method can be using brew brew install haskell-platform.

GUI programming in Haskell - installation problems on Ubuntu

is there a GUI package that is still up-to-date?
I tried installing both wxHaskell and gtk2hs today and both fail on dependencies I just cannot solve (wxHaskell cannot find some wxWidget libs and while trying the glade tutorial gtk2hs fails on a missing pkg-config libglade2-0 I installed too).
I guess it's just some problem with me not understanding the linux/cabal/package install things good enough but is there a up-to-date tutorial how to get started (install) some GUI lib for Haskell somewhere around?
Here are the errors:
carsten#Carsten-VirtualBox:~$ cabal install glade
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/glade-0.12.1-12934/glade-0.12.1/SetupWrapper.hs, /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/glade-0.12.1-12934/glade-0.12.1/Setup.hs, /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/Main.o )
Linking /tmp/glade-0.12.1-12934/glade-0.12.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 glade-0.12.1...
setup: The pkg-config package libglade-2.0 version >=2.0.0 is required but it
could not be found.
cabal: Error: some packages failed to install:
glade-0.12.1 failed during the configure step. The exception was:
ExitFailure 1
and
carsten#Carsten-VirtualBox:~$ cabal install wxc
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/Setup.hs, /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/dist/setup/Main.o )
Linking /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/dist/setup/setup ...
Configuring wxc-0.90.0.4...
Warning: No config found to match: /usr/bin/wx-config --version=2.9 --version-full
in /usr/lib/x86_64-linux-gnu/wx/config
If you require this configuration, please install the desired
library build. If this is part of an automated configuration
test and no other errors occur, you may safely ignore it.
You may use wx-config --list to see all configs available in
the default prefix.
setup: failed
cabal: Error: some packages failed to install:
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
This is really frustrating me - maybe someone can help me here - thank you!
I am running 12.04 and everything works fine for me.
Are you sure you have libglade2-dev installed ? That should fix it.
Coming from ArchLinux i had the same problem at first when i didn't know there were separate dev libraries, i don't remember having to do this in arch.

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.)

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

$ 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.

Resources