Cannot install ghc-mod due to 'happy' cannot be installed? - haskell

On Mac OS X, I'm not able to install ghc-mod due to that a dependency called 'happy' cannot be installed:
bash> cabal install ghc-mod
Resolving dependencies...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log ( /Users/meng/.cabal/logs/haskell-src-exts-1.17.1.log ):
Configuring haskell-src-exts-1.17.1...
setup-Simple-Cabal-1.22.5.0-x86_64-osx-ghc-7.10.3: The program 'happy' version
>=1.19 is required but it could not be found.
cabal: Error: some packages failed to install:
ghc-mod-5.5.0.0 depends on haskell-src-exts-1.17.1 which failed to install.
haskell-src-exts-1.17.1 failed during the configure step. The exception was:
ExitFailure 1
hlint-1.9.31 depends on haskell-src-exts-1.17.1 which failed to install.
Any idea?

For some reason, cabal doesn't install executable dependencies, but you can get around this by installing by hand.
cabal install happy
then proceed with the original installation.
This problem generally doesn't go away with stack either, but the solution is similar
stack install happy
then continue with the installation.

it seems the program happy is not installed in your system, therefore the package haskell-src-exts-1.17.1 (a dependency of a dependency of ghc-mod) which depends on it fails to install.
The common wisdom today, especially for beginners, is to not use the tool cabal-install, but to use stack for everything you need instead. including installing ghc itself. after downloading stack I think all you have to do is run stack install ghc-mod to install ghc-mod.

Related

Issue installing Snap on macOS Sierra

I'm having trouble installing the Haskell framework Snap on macOS Sierra. Whenever I install it, I get the following message:
Resolving dependencies...
Configuring securemem-0.1.9...
Configuring skein-1.0.9.4...
Configuring configurator-0.3.0.0...
Configuring cryptonite-0.24...
Building configurator-0.3.0.0...
Building securemem-0.1.9...
Building skein-1.0.9.4...
Failed to install configurator-0.3.0.0
Build log ( /Users/nicholas/.cabal/logs/ghc-8.2.1/configurator-0.3.0.0-6dySPcNCURWFswtMXJvzho.log ):
cabal: Entering directory '/tmp/cabal-tmp-66175/configurator-0.3.0.0'
Configuring configurator-0.3.0.0...
Preprocessing library for configurator-0.3.0.0..
Building library for configurator-0.3.0.0..
<command line>: cannot satisfy -package-id attoparsec-0.13.2.0-5dp4kBDsiGY4dQpLKbD5rk:
attoparsec-0.13.2.0-5dp4kBDsiGY4dQpLKbD5rk is unusable due to shadowed dependencies:
scientific-0.3.5.1-L0qYzdp0wpz8rO8gircNSR text-1.2.2.2-EGUst8sqNAZCw1xLPcmcMH
(use -v for more information)
cabal: Leaving directory '/tmp/cabal-tmp-66175/configurator-0.3.0.0'
Configuring transformers-base-0.4.4...
Building cryptonite-0.24...
Building transformers-base-0.4.4...
Installed securemem-0.1.9
Installed transformers-base-0.4.4
Installed skein-1.0.9.4
Installed cryptonite-0.24
Updating documentation index
/Users/nicholas/Library/Haskell/share/doc/x86_64-osx-ghc-8.2.1/index.html
cabal: Error: some packages failed to install:
configurator-0.3.0.0-6dySPcNCURWFswtMXJvzho failed during the building phase.
The exception was:
ExitFailure 1
snap-1.0.0.2-5CZKyA9EY4oLgkpHYCVfnv depends on snap-1.0.0.2 which failed to
install.
I'm using the Haskell Platform installed using homebrew (brew cask install haskell-platform), and cabal version 2.0.0.2. I have tried using sudo and deleting my ~/.ghc file
There was an issue with full 8.2.1 binary platform builds that's just been resolved: https://mail.haskell.org/pipermail/haskell-cafe/2017-October/127979.html
This was likely an instance of that.
(see also: GHC cannot find libraries on fresh install of Haskell-Platform)
This looks like a bug in Cabal 2 (or potentially GHC 8.2). See https://github.com/haskell/cabal/issues/4728. I'd recommend sticking to GHC 8.0.2 for the moment with either cabal 1.24 or Stack. I'm the case of Stack, the version won't matter, since it will use the Cabal version shipped with GHC.

When I try to install hlint I get errors surrounding old-time-1.1.0.3

I first tried to install Hlint. cabal install hlint but then I got the error:
cabal: Error: some packages failed to install:
cpphs-1.20.2 depends on old-time-1.1.0.3 which failed to install.
haskell-src-exts-1.18.2 depends on old-time-1.1.0.3 which failed to install.
hlint-1.9.37 depends on old-time-1.1.0.3 which failed to install.
old-time-1.1.0.3 failed during the configure step. The exception was:
ExitFailure 77
Then I tried to install ghc-mod since I read that hlint is a dependency of that package(?). Thinking that it might resolve the problem. So i did cabal install ghc-mod which gave me the error.
cabal: Error: some packages failed to install:
cpphs-1.20.2 depends on old-time-1.1.0.3 which failed to install.
ghc-mod-5.6.0.0 depends on old-time-1.1.0.3 which failed to install.
haskell-src-exts-1.17.1 depends on old-time-1.1.0.3 which failed to install.
hlint-1.9.35 depends on old-time-1.1.0.3 which failed to install.
old-time-1.1.0.3 failed during the configure step. The exception was:
ExitFailure 77
So it seems to be the same problem, around my the package old-time-1.1.0.3.
The best way to know where it fails is to go through each failed package and install them one after the other.
I had issue with haskell-src-exts in which showed up in hlint and when I tried to cabal install haskell-src-exts it was happythat wasn't properly installed.
There are lots of variables that could be at play to explain what's going on, including cabal-install and ghc versions. It would be useful if you included the cabal --version and ghc --version output in your question.
That said: I'd recommend trying out the installation using Stack. Once you have Stack installed (on POSIX systems, usually sufficient to run curl -sSL https://get.haskellstack.org/ | sh), you can install with stack --resolver lts-6.16 --install-ghc --no-system-ghc install hlint.
Are you on Windows or Linux? What does ghc --version say? What about ghc-pkg old-time? I recommend trying to run cabal install old-time directly, which should reproduce the error directly.
Solution by OP.
Modify your cabal config file (you can verify the location by running "cabal user-config init") to contain the following lines:
extra-prog-path: C:\Program Files\Haskell Platform\8.0.1\msys\usr\bin
extra-lib-dirs: C:\Program Files\Haskell Platform\8.0.1\mingw\lib
extra-include-dirs: C:\Program Files\Haskell Platform\8.0.1\mingw\include

Haskell cabal-install errors

I am having lots of problems with cabal-install:
1: Every time I do cabal update, it tells me to do cabal install cabal-install, so I do, and then when I do cabal update again, it says the same thing.
2: When I try to install ghc-mod from hackage, it gives me this error:
[username#arch ~]$ cabal install ghc-mod
In order, the following will be installed:
haskell-src-exts-1.14.0 (reinstall) changes: pretty-1.1.1.1 -> 1.1.1.0
hlint-1.8.55 (reinstall)
ghc-mod-3.1.4
setup: The program happy version >=1.17 is required but it could not be found.
ghc-mod-3.1.4 depends on haskell-src-exts-1.14.0 which failed to install.
haskell-src-exts-1.14.0 failed during the configure step.
hlint-1.8.55 depends on haskell-src-exts-1.14.0 which failed to install.
So the problem was The program happy version >=1.17 is required but it could not be found., so I installed happy 1.19.2 using cabal install happy without problems.
I tried cabal install ghc-mod again, same error, so I tried cabal install haskell-src-exts --reinstall --force-reinstalls. It gave me the following error:
[username#arch ~]$ cabal install haskell-src-exts --reinstall --force-reinstalls
Configuring haskell-src-exts-1.14.0...
setup: The program happy version >=1.17 is required but it could not be found.
Failed to install haskell-src-exts-1.14.0
cabal: Error: some packages failed to install:
haskell-src-exts-1.14.0 failed during the configure step. The exception was:
ExitFailure 1
Basically The program happy version >=1.17 is required but it could not be found.. So happy is the problem again?
I have also tried downloading the tar.gz files from hackage and using cabal install on the
.cabal file, also modified the .cabal file to ignore dependencies, still failed.
cabal install places executables in ~/.cabal/bin.
If you add it to your path, you will be able to use the new executables installed by cabal:
$ PATH=$HOME/.cabal/bin:$PATH
I encountered with same problem and I solved the problem with installing happy package(confusing package name). So install it with your package manager(apt-get, pacman etc) before install package with cabal. This should be fix the problem.

yesod install fails

I generally find that cabal install's for more than half of big packages fail, rather a fatal flaw to new users!
This time I am trying to install yesod, any hints?
> cabal install yesod
...
Loading package time-1.2.0.5 ...
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
_get_current_timezone_seconds
whilst processing object file
C:\Users\guthrie\AppData\Roaming\cabal\time-1.2.0.5\ghc-7.4.1\HStime-1.2.0.5.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
cabal: Error: some packages failed to install:
authenticate-1.3.1.1 depends on http-conduit-1.6.1.1 which failed to install.
http-conduit-1.6.1.1 failed during the building phase. The exception was:
ExitFailure 1
yesod-1.1.1.2 depends on yesod-core-1.1.2.1 which failed to install.
yesod-auth-1.1.1.1 depends on yesod-core-1.1.2.1 which failed to install.
yesod-core-1.1.2.1 failed during the building phase. The exception was:
ExitFailure 1
yesod-form-1.1.3 depends on yesod-core-1.1.2.1 which failed to install.
yesod-json-1.1.0 depends on yesod-core-1.1.2.1 which failed to install.
yesod-persistent-1.1.0 depends on yesod-core-1.1.2.1 which failed to install.
yesod uses a different version of alex package than the Haskell platform. I always install alex and happy from my distro's package manager apart from ghc and then use cabal. Alternatively, you can always use
cabal update && cabal install alex happy
cabal install yesod-platform
This most likely occurs due to trying to install with two versions of the time package simultaneously. Can you try running cabal install yesod-platform and see if the problem persists?
And as #Inaimathi said, this might be due to an older version of cabal. Perhaps also try cabal update && cabal install cabal-install.

installing reactive banana-wx or wx on redhat based linux with ghc 7.0.4

hi i'm trying to install, (without having to update or install the latest compiler),reactive-banana-wx and one of the requirement's are failing
cabal install reactive-banana-wx
and heres the error
Configuring wxc-0.90.0.4...
setup: failed
cabal: Error: some packages failed to install:
reactive-banana-wx-0.6.0.1 depends on wxc-0.90.0.4 which failed to install.
wx-0.90.0.1 depends on wxc-0.90.0.4 which failed to install.
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
wxcore-0.90.0.3 depends on wxc-0.90.0.4 which failed to install
when i try to cabal install wxcore ,wx or wxc they all say failed and point towards wxc being required.
here's the error
cabal install wxc
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/wxc-0.90.0.419410/wxc-0.90.0.4/Setup.hs, /tmp/wxc-0.90.0.419410/wxc-0.90.0.4/dist/setup/Main.o )
Linking /tmp/wxc-0.90.0.419410/wxc-0.90.0.4/dist/setup/setup ...
Configuring wxc-0.90.0.4...
setup: failed
cabal: Error: some packages failed to install:
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
here's my compiler info if it would be useful
ghc -v
Glasgow Haskell Compiler, Version 7.0.4, for Haskell 98, stage 2 booted by GHC version 7.0.4
I've got the same error trying to install phooey with ghc 7.4.1 on Debian tonight. The reason is a bug in the package wxc-0.90.0.4 and it should affect all wxHaskell-based packages. You can fix it, there is no need to downgrade your wxc package...
The easiest way to reproduce it is to do
cabal install wxc
or
cabal install glade
It might be a good idea to make sure that all prerequisites are in place, before you do it. wxc depends on a number of cabal and Linux packages and all of them should be installed and compiled... I did it in the most stupid way possible, just by running
cabal install wxc
and reading error messages which it spills out. This sweetie usually tells you what it wants... For instance, if it complains about cabal package x, just do cabal install x. If it complains about Linux package y, then use your Linux package manager and install the development version of this package, which is called normally lib<y>-dev in Debian. So, for instance, if
cabal install wxc
gives you an error saying that package gtk+2.0 is missing, you want to do
apt-get install libgtk2.0-dev
The same story with cairo, glade2 and other GTK-related libraries
When you are green with all prerequisites, you want to install wxWidgets-2.9, which is currently in the Development stage... so, it doesn't have any binaries for Linux and you should build it yourself. Download the source code from wxWidgets website and build it. It is pretty easy to do, just:
untar/unzip the source code to your favorite directory
run ./config
run ./make
If you are on wxc-0.90.0.4, at this moment you should encounter our little bug... To keep the long story short, it is in the file eljpen.cpp, which you can find in
~/.cabal/packages/hackage.haskell.org/wxc/0.90.0.4/wxc-0.90.0.4.tar.gz
Open the archive, go to the line 159 in the file and replace *_ref = NULL; with _ref = NULL or anything else what makes more sense. Then recreate the archive in the same place with the fixed eljpen.cpp file in it.
run ./make
It should work now.
run sudo make install (normally, you should have root privileges to insatll wxWidgets library...).
after it is done try to do
cabal install wx
again. It should be working now. I guess, after that you can enjoy your reactive-banana-wx, wxHaskell, phooey, etc.
PS http://sourceforge.net/tracker/index.php?func=detail&aid=3576397&group_id=73133&atid=536845. Why didn't I find it earlier? :/
I'v solved this problem on Lubuntu 12.10 so:
sudo cabal info wx
Synopsis: wxHaskell
Versions available: 0.11.1.2, 0.12.1.4, 0.12.1.5, 0.12.1.6, 0.13.2,
0.13.2.1, 0.13.2.3, 0.90, 0.90.0.1 (and 11 others)
I picked out different versions of wxHaskell, but only 0.13.2.3 was right.
sudo cabal install wx-0.13.2.3
...and everything has compiled and installed. Then I could install:
sudo cabal install reactive-banana-wx -fbuildExamples
That's no depends on the version of your Glasgow Haskell Compiler or the sort of your Linux.

Resources