Cabal configure can't find an installed package inside a cabal sandbox - haskell

I've made a cabal sandbox, installed a package to it, yet runhaskell Setup configure complains that the package dependency that I just installed is missing.
I verified the package name and version and that's okay.
Running cabal install --dependencies-only says "all the requested packages are already installed".
What's going on & how can I fix it?
If relevant I've encountered this with QuickCheck-2.7.5 on Windows 7 with cabal-install 1.20.0.3 using cabal 1.20.0.1 and ghc 7.6.3.
Configuring through runhaskell Setup configure outputs:
Configuring MyPackage-0.1.0.0...
Setup.hs: At least the following dependencies are missing:
QuickCheck ==2.7.5

Instead of running runhaskell Setup configure, you should do cabal configure. runhaskell doesn't know about sandboxes.

Related

Haskell - Cabal Install parsec errors

I've been trying to install the parsec library for haskell but I'm running in to a lot of errors. Im very new to haskell & cabal and i don't quite understand the output of the log file.
the output of the log file is here:
http://pastebin.com/6hPQN1W4
I tried installing the packages that the log file said that it could not find, but i keep getting errors when trying to install the packages.
I reinstalled cabal and also ran cabal update, but this did not resolve the issue
any help will be appreciated?
I suggest using stack tool with its stackage infrastructure. Please see http://haskellstack.org for more details.
You could try installing parsec in a sandbox.
$ mkdir asdf
$ cd asdf
$ cabal sandbox init
cabalWriting a default package environment file to
/Users/steshaw/Projects/asdf/cabal.sandbox.config
Creating a new sandbox at /Users/steshaw/Projects/asdf/.cabal-sandbox
$ cabal install parsec
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/steshaw/Projects/steshaw/asdf/.cabal-sandbox
Configuring mtl-2.2.1...
Configuring text-1.2.2.1...
Building text-1.2.2.1...
Building mtl-2.2.1...
Installed mtl-2.2.1
Installed text-1.2.2.1
Configuring parsec-3.1.11...
Building parsec-3.1.11...
Installed parsec-3.1.11

dependenacy libraries when installing svgcairo

I want to run a Setup.hs file to install svgcairo library, So I run first the command runhaskell Setup.hs configure --prefix=/usr/local but it's give me the following error :
Configuring svgcairo-0.13.0.1...
setup: At least the following dependencies are missing:
cairo >=0.13.0.0 && <0.14, glib >=0.13.0.0 && <0.14
This is confused me, since both cairo and glib are installed with the correct versions !
to make it convince, I have run the commands cabal install cairo and cabal install glib, and the following output appear:
Resolving dependencies...
All the requested packages are already installed:
cairo-0.13.0.6
Use --reinstall if you want to reinstall anyway.
Resolving dependencies...
All the requested packages are already installed:
glib-0.13.0.7
Use --reinstall if you want to reinstall anyway.
Note : I tried to run the Setup.hs file with runhaskell Setup.hs but its tell me that no command given (try --help)
cabal install defaults to installing to the local package database. Setup.hs defaults to installing to the global package database (hence will ignore anything installed in the local package database when trying to satisfy dependencies). You can change the behavior of either by passing --local or --global to the appropriate stage -- configure for Setup.hs, and configure or install for cabal.

Cabal install reports package as installed, but Setup configure reports it as missing

I am using ghc-7.6.3 with cabal-install version 1.18.0.5 using version 1.18.1.3 of the Cabal library. My operating system is Debian Wheezy 7.5.
I have a fresh cabal install, and that I have removed the .ghc from my home directory.
After that I have changed the cabal config file and set:
remote-repo: stackage-nightly-2014-12-15:http://www.stackage.org/snapshot/nightly-2014-12-15
After that I did (following this documentation)
$ cabal update
$ cabal install alex happy yesod-bin
and the build complained that it cannot build package system-filepath-0.4.12.
So, I am trying to build package system-filepath-0.4.12 manually. After unpacking the archive, I cd-ed to the unpacked folder and entered:
$ ghc -o Setup Setup.hs
$ ./Setup configure
which gives:
Configuring system-filepath-0.4.12...
Setup: At least the following dependencies are missing:
text >=0.7.1
But
$ cabal install text
gives:
Resolving dependencies...
All the requested packages are already installed:
text-1.1.1.3
Use --reinstall if you want to reinstall anyway.
How is it possible that a package is reported as installed and missing at the same time?
Should I look for a more stable remote-repo configuration, is there something I can check that might fix the missing text package? Note that I am not using a sandbox.
EDIT
Thanks for pointing out that there are two package databases.
I have now tried both
$ cabal configure
$ cabal build
and
$ Setup configure --user
$ Setup build
Both give no error during configuration, but give the following error during the build phase:
Building system-filepath-0.4.12...
Preprocessing library system-filepath-0.4.12...
/usr/bin/ld: cannot find -lHStext-1.1.1.3-ghc7.8.3
collect2: error: ld returned 1 exit status
Try this instead
cd system-filepath--0.4.12
cabal configure
I am not sure why, but this works for me, whereas Setup.hs gave me the same error (truth be told, I always do it the cabal configure way, and am not sure if your way should also work).
There are (at least) two package databases: a global one available to all users, and a user-specific one. By default, Setup.hs looks in (and installs to) the global one, and cabal-install looks in (and installs to) the user-specific one. You can manually choose one or the other with --user and --global; so, you could fix this either by using
./Setup configure --user
or by
cabal install text --global
You can see the current state of the package databases with ghc-pkg, which will report information about both by default.

Error in cabal-installing hspec

I'm trying to install hspec, but I'm getting this:
$ cabal install hspec
Resolving dependencies...
cabal: dependencies conflict: ghc-7.2.2 requires containers ==0.4.2.0 however
containers-0.4.2.0 was excluded because ghc-7.2.2 requires containers
==0.4.1.0
What does this even mean?
Also, using ghc 7.2.2, cabal 10.2.
It sounds like you somehow broke your GHC install. GHC 7.2.2 comes with containers-0.4.1.0 (the version of which is the same as for GHC 7.2.1). It might be possible to fix it, but if the global package setup is broken then it would probably be easiest to re-install GHC.
What does ghc-pkg list containers say?
If containers-0.4.2.2 is found only in the per-user install (i.e. the /home/clark/.ghc/${arch}-${os}-7.2.2/package.conf.d output), then rm'ing /home/clark/.ghc/ and re-installing all the packages you installed with cabal install will fix it.

How do you install packages/libraries without Cabal or Cabal-Install?

I'm trying to set up Haskell from scratch, on Ubuntu 11.04, without using the outdated Debian repository or Haskell-Platform.
I've installed GHC-7.0.4 from source with no problem, and now need to install Cabal (which appears to already be included in GHC in /usr/local/lib/ghc-7.0.4/Cabal-1.10.2.0) and Cabal Install.
The latter specifies several dependencies (parsec and network), each of which has several dependencies of their own (mtl, text, etc).
What's the command to install these packages, that I downloaded from hackage in tar.gz form?
Unpack, then runhaskell doesn't work.
I see Setup.lhs, but it's not clear what that's for or how to use it.
Most of the Haskell documentation I've found assumes you've installed from a repo or Haskell-Package and doesn't really explain this well.
cabal-install has a shell script that does this. If you download it from hackage and install it, you can start bootstrap.sh to install cabal-install. You can then use it to install other packages.
There are two different packages: Cabal and cabal-install. Cabal is a library, and cabal-install is an executable named cabal.
To install a package, cabal-install is an optional convenience wrapper around Cabal, but Cabal is required.
According to http://hackage.haskell.org/trac/ghc/wiki/Commentary/Libraries , Cabal is a 'zero-boot' package, so when you build GHC, Cabal and its dependencies are built for you automatically.
You can use ghc-pkg executable to check which packages are already installed:
# ghc-pkg list
Check if Cabal is in the list after you build GHC. If yes, you can install more packages without cabal-install using this documentation:
http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package
I suggest you to install cabal-install first, and then install everything else using cabal-install executable. A usual commandine for global installation is this:
# runhaskell Setup configure
# runhaskell Setup build
# sudo runhaskell Setup install
Unpack a package tarball and run the commands in the folder with Setup.hs or Setup.lhs files. Note that a per-user non-root installation is also supported - Use runhaskell Setup configure --user
When you install cabal executable and its dependencies this way, use cabal install {package-name} to install more packages.
Note that Haskell Platform exists mostly because of the pain of installing cabal-install by yourself.

Resources