I'm trying to install Haskell Platform 2014.2.0.0, but running platform.sh script gives me dependency error, which I am not able to resolve. Error message is:
cabal: Could not resolve dependencies:
trying: alex-3.1.3 (user goal)
next goal: QuickCheck (dependency of alex-3.1.3)
rejecting: QuickCheck-2.7.6 (global constraint requires ==2.6)
I tried to ghc-pkg unregister QuickCheck-2.7.6 and cabal install QuickCheck-2.6, but it still fails due to same reason. Besides that I tried to install alex-3.1.3 manually and when that failed too I cleared all packages from my home directory.
I have Haskell Platform 2013 installed but I also installed Cabal 1.18 manually.
Any ideas how I can resolve this?
I've searched a web and StackOverflow a bit just to find out that HP installation script is broken on many systems. Eventually I gave up on installing whole HP and went for newest binary distribution of GHC and Cabal which seems to be the simplest way of getting most recent Haskell for my Linux.
Related
I am building a Haskell library with Cabal,
and want to use this library in some other Cabal projects.
The problem is that after installing the library (with Cabal),
my library is not available to the other Cabal projects.
Neither ghc-pkg list nor cabal list shows my library
(and also does not show packages that my library depends on but
was downloaded by cabal as part of the build of my library).
How do I make cabal find my library when building the dependent projects?
I am using Linux, but the same problem has been reported for
Windows.
My setup:
Linux (Debian 11.5)
Haskell installed by ghcup:
ghc 8.0.2
cabal 3.6.2
(My library and the other projects need this version of ghc.)
My library builds and installs without problems using
$ cabal build
$ cabal install --lib
But ghc-pkg list and cabal list --installed both show only the
"predefined" libraries that was installed before the build.
These are found in ~/.ghcup/ghc/8.0.2/lib/ghc-8.0.2/package.conf.d/.
My library, and the libraries that it depends on, are installed in
~/.cabal/store/ghc-8.0.2/package.db/. But cabal doesn't find them
when building my other dependent projects.
I have tried different options for building, all with the same
result of
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: <PRJ-USING-LIB> (user goal)
[__1] unknown package: wilde (dependency of <PRJ-USING-LIB>)
[__1] fail (backjumping, conflict set: <PRJ-USING-LIB>, <MY-LIB>)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: <PRJ-USING-LIB>, <MY-LIB>
The options I tried are:
cabal build --global
cabal build --user
cabal build --package-db=~/.cabal/store/ghc-8.0.2/package.db
Interestingly, when adding ghc-options: -L<PATH-TO-MY-LIB-SRC> to the
dependent projects cabal file, cabal build says that my library is hidden:
...
Warning: Instead of 'ghc-options: -L<PATH-TO-MY-LIB-SRC>' use
'extra-lib-dirs: <PATH-TO-MY-LIB-SRC>'
...
app/Main.hs:3:1: error:
Failed to load interface for ‘<MODULE-IN-MY-LIB>’
It is a member of the hidden package ‘<MY-LIB>-0.5’.
Perhaps you need to add ‘<MY-LIB>’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
But trying to ghc-pkg expose <MY-LIB>, it says that
it cannot find .
I am trying to install a Haskell program (itself a compiler for another programming language) from the Github repository.
The Elm compiler is itself a Haskell program and I would like to compile it from source:
$ cabal configure
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
trying: elm-0.19.1 (user goal)
next goal: zip-archive (dependency of elm-0.19.1)
Dependency tree exhaustively searched.
Trying configure anyway.
Configuring elm-0.19.1...
cabal: Encountered missing dependencies:
SHA -any,
ansi-terminal ==0.8.*,
ansi-wl-pprint >=0.6.8 && <0.7,
containers >=0.5.8.2 && <0.6,
If I try to use a different command the computer searches for a different version of the Elm programming language.
$ cabal install elm
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: Elm-0.13 (user goal)
trying: base-4.12.0.0/installed-4.1... (dependency of Elm-0.13)
next goal: transformers (dependency of Elm-0.13)
rejecting: transformers-0.5.6.2/installed-0.5..., transformers-0.6.0.2,
transformers-0.5.6.2, transformers-0.5.5.2, transformers-0.5.5.0,
transformers-0.5.4.0, transformers-0.5.2.0, transformers-0.5.1.0,
transformers-0.5.0.1, transformers-0.5.0.0 (conflict: Elm => transformers>=0.2
&& <0.5)
rejecting: transformers-0.4.3.0, transformers-0.4.2.0 (conflict:
I already have Elm installed globally and I would like to install a local copy that I cloned from Github. The cabal documentation doesn't say much.
Helpful information:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library
Trying different things possibly at risk:
$ cabal install --only-dependencies
Resolving dependencies...
internal error: could not construct a valid install plan.
The proposed (invalid) plan contained the following problems:
Package time is required by several packages, but they require inconsistent
versions:
package zip-archive-0.3.3 requires time-1.10
package snap-server-1.1.2.0 requires time-1.10
package snap-core-1.0.4.2 requires time-1.10
package io-streams-1.5.2.1 requires time-1.10
package http-client-0.6.4.1 requires time-1.10
package elm-0.19.1 requires time-1.10
package directory-1.3.6.2 requires time-1.10
package cookie-0.4.5 requires time-1.10
package HTTP-4000.3.16 requires time-1.10
package unix-2.7.2.2 requires time-1.8.0.2
Proposed plan:
Configured HTTP-4000.3.16 (.fake.HTTP-4000.3.16)
Configured SHA-1.6.4.4 (.fake.SHA-1.6.4.4)
Configured ansi-terminal-0.8.2 (.fake.ansi-terminal-0.8.2)
Configured ansi-wl-pprint-0.6.8.2 (.fake.ansi-wl-pprint-0.6.8.2)
Configured asn1-encoding-0.9.6 (.fake.asn1-encoding-0.9.6)
Configured asn1-parse-0.9.5 (.fake.asn1-parse-0.9.5)
Configured asn1-types-0.3.4 (.fake.asn1-types-0.3.4)
Your cabal is very old, and I strongly recommend you upgrade.
That said... with cabal-1, the invocation is simply
cabal install
with no elm at the end. Run it from within the directory you cloned from github that has a file named elm.cabal or similar -- it will automatically look for a file with extension .cabal and install the package described inside. cabal install will also take care of installing the missing dependencies.
With modern cabal, and assuming the executable named in the .cabal file is called elm, I would use
cabal run elm -- --args --for --elm --compiler
to run the compiler during testing, and then
cabal install --exe
when you are satisfied with your changes and want to make the executable available more widely.
I have a problem when I work with cabal sandbox, I created a sandbox for a 'hello world' application but when I try to run cabal install --only-dependencies I get the following error:
$ cabal install --only-dependencies
Resolving dependencies... cabal: Could not resolve dependencies:
trying: haskeline-0.7.2.1/installed-dad... (user goal) next goal:
helloworld (user goal) rejecting: helloworld-0.1.0.0 (conflict:
haskeline => base==4.7.0.2/installed-918..., helloworld => base>=4.8
&& <4.9) Dependency tree exhaustively searched.
Note: when using a sandbox, all packages are required to have
consistent dependencies. Try reinstalling/unregistering the offending
packages or recreating the sandbox.
I want to mention that if I try to run on this sandbox cabal repl I get the error.
$ cabal repl
Package has never been configured. Configuring with default flags. If
this fails, please run configure manually. Resolving dependencies...
Configuring helloworld-0.1.0.0... cabal: At least the following
dependencies are missing: base ==4.8.*
If I run cabal repl outside of sandbox everything is working ok.
If any of you have an idea pls share with me :),
thanks
sorin
It looks like your version constraints want you to use GHC 7.10- which bundles base version 4.8- while you're using GHC 7.8 and base 4.7. You could:
Modify the cabal file and its base version bounds
Switch to a different version of GHC
Try building with stack, which will automatically detect those kinds of things during stack init and then offer to install the appropriate GHC for you.
I tried to set up a yesod project as follows:
mkdir sample_blog
curl -o cabal.config www.stackage.org/nightly/cabal.config
cabal install alex happy yesod-bin
However, I got the following error:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: Cabal (user goal)
rejecting: Cabal-1.18.1.4/installed-d6c... (global constraint requires
==1.18.1.3)
trying: Cabal-1.18.1.3/installed-476...
trying: yesod-bin-1.4.2 (user goal)
next goal: ghc (dependency of yesod-bin-1.4.2)
rejecting: ghc-7.8.3/installed-1d5... (conflict:
Cabal==1.18.1.3/installed-476..., ghc => Cabal==1.18.1.4/installed-d6c...)
Dependency tree exhaustively searched.
Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.
I've install GHC and cabal-install using homebrew.
Versions:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
$ cabal --version
cabal-install version 1.20.0.4
using version 1.20.0.3 of the Cabal library
It appears that homebrew has patched the standard GHC installation, as it's shipping with a different version of the Cabal library than the official GHC. I don't know why that is occurring. A quick workaround would be to remove the Cabal line from your cabal.config. Can you open up an issue against Stackage about this? I'd like to get to the bottom of why this is occurring.
I am trying to install Elm and the instructions are to install Haskell and then
sh> cabal update
sh> cabal install cabal-install
sh> cabal install -j Elm elm-repl elm-reactor elm-get
When I do, the cabal-install installation installs text-1.2.0.0 which conflicts with the text-1.1.0.0 which uniplate requires so uniplate and its dependents fail to install. Text-1.1.0.0 is installed and present but is rejected in favour of text-1.2.0.0, even though the target needs text-1.1.0.0.
Is there a way to insist that cabal use text-1.1.0.0?
Is there a way to get text-1.1.0.0 and text-1.2.0.0 to co-exist?
Is there a way to convince uniplate that it can accept text-1.2.0.0?
Or a way to make uniplate (or cabal) believe that version text-1.1.0.0 is actually installed? Would that even work?
When I explicitly try to install version 1.1.0.0 of text, I am told that a reinstall would break other packages. Apparently it is a downgrade and not a co-installation. cabal does not seem to have an option to allow to me install two versions of the same library at the same time.
If I uninstall Haskell and all the libraries and then re-install Elm (without installing cabal-install so I don't get text-1.2.0.0 installed so there is no clash), I get 100 or so lines of
package aeson-0.7.0.4-8f84b14cc682e4c9b009352420076a45 is unusable due to missing or recursive dependencies:
attoparsec-0.10.4.0-ec2d0a330db1f6e3a6a3b79471a403ef hashable-1.2.2.0-45bd22df8c4ead6b3a7fb1d08bb07f7d mtl-2.1.3.1-8bcc0591131896cfc8761a93703d4c61 scientific-0.2.0.2-5e275f5d96527da6dc1f05642692a484 syb-0.4.1-be94ebe67c3607f5df1dfcc1906f5d5c text-1.1.0.0-9bd69e9ace700e05fb08e463086bc383 unordered-containers-0.2.4.0-69836b34d13649bcfacc8fb0c9f53e64 vector-0.10.9.1-c550551354bc7c2b5a1d261f39b2f3f4
package aeson-pretty-0.7.1-5dc26d5a4560afe110e90283479a1251 is unusable due to missing or recursive dependencies:
aeson-0.7.0.4-8f84b14cc682e4c9b009352420076a45
text-1.1.0.0-9bd69e9ace700e05fb08e463086bc383
unordered-containers-0.2.4.0-69836b34d13649bcfacc8fb0c9f53e64
vector-0.10.9.1-c550551354bc7c2b5a1d261f39b2f3f4
package asn1-encoding-0.9.0-94e9066cccf7ead73bee5ae4aa982071 is unusable due to missing or recursive dependencies:
mtl-2.1.3.1-8bcc0591131896cfc8761a93703d4c61
package asn1-parse-0.9.0-af4efc4777a8a0d9d19a626d5e4b08ff is unusable due to missing or recursive dependencies:
asn1-encoding-0.9.0-94e9066cccf7ead73bee5ae4aa982071
mtl-2.1.3.1-8bcc0591131896cfc8761a93703d4c61
text-1.1.0.0-9bd69e9ace700e05fb08e463086bc383
I have no idea at all how in resolve this or where to even try. Has anybody trod this path before and do you have any advice or pointers?
Thank you.
Edit
Installing in a sandbox changes the outcome only by degrees: text-1.1.0.0 does not clash with text-1.1.0.0 but still can not be loaded (despite being installed) and still remains the unsatisfied dependency.
blaze-builder is first to fail with cannot satisfy -package-id text-1.1.0.0-9bd69e9ace700e05fb08e463086bc383 yet the same log earlier stated [_12] trying: text-1.1.0.0/installed-9bd... (dependency of Elm-0.13) without apparent error or complaint.
cabal list shows both text-1.1.0.0 and text-1.2.0.0 as installed.
Installing blaze-builder separately looks the same. Dependency resolution shows
[_56] trying: blaze-builder-0.3.3.4 (user goal)
[_57] next goal: text (dependency of blaze-builder-0.3.3.4)
[_57] trying: text-1.1.0.0/installed-9bd...
[_58] done
All looks good but later, same log has
<command line>: cannot satisfy -package-id text-1.1.0.0-9bd69e9ace700e05fb08e463086bc383
(use -v for more information)
The ghc command line already had the -v flag and trying to re-run the command line copied from the log, with more -vs, gives an error with "can't find a package database at
dist/dist-sandbox-ad0bcd57/package.conf.inplace".
No package.conf.inplace seems to exist.
Further edit
On the Elm install page is a link to a BuildFromSource.hs script that is also supposed to work installing Elm. In the time that it took for that script to run and fail to work, I managed to install leiningen, node, npm, grunt and Clojure. I am now further along the road to getting Clojurescript installed in about 20 minutes than I am in getting Elm installed in nearly a week.
Elm looked really interesting but it is playing way too hard to get.
Thanks again to everyone who tried to help.
* Edit *
I finally got it.
Every executable installed by the installer at http://elm-lang.org/Install.elm caused a segfault.
The "Build from source" option at the same page did not work because the dependencies either stepped all over each other or could not get themselves straight in the first place.
The ghc at http://new-www.haskell.org/downloads/osx needs a later version of Mac OS than I have. (A link to older versions would not have gone astray.)
The solution (and it is obvious in retrospect) was to port install haskell-platform and port install hs-cabal-install and cabal install Elm .... I did have to run one of those installers twice because it could not find hackage.haskell.org (How is that a 'user' error?) but my hello-world.elm now compiles.
Thank you all again.
It looks like some dependency issues with elements you already have installed. You will probably need to install it in a sandbox.
First, update to the latest version of cabal:
$ cabal update
$ cabal install cabal cabal-install
Next, make sure you have the installed version of cabal on your $PATH.
$ which cabal
> /path/to/cabal/bin/cabal
If it says something like /usr/bin/cabal you will need to export cabal to be on your $PATH. For me this is `/home/username/.cabal/bin
$ export PATH=/path/to/cabal/bin/cabal;$PATH
Run which cabal again and ensure it is pointing to that path.
Now that you have the latest version of cabal. Run the following:
$ mkdir elm
$ cd elm
$ cabal sandbox init
This will initialize a sandbox where dependencies are completely independent of your other installs. Within this directory, you should be able to install the elm platform by running:
$ cabal install Elm elm-repl elm-reactor elm-get
These will be installed in a sub-directory called .cabal-sanbox/bin/ For convenience, you will probably want to add this to your $PATH so you can run the executables from any directory.
Hope this helps!