dependenacy libraries when installing svgcairo - linux

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.

Related

Cabal install (Cabal cabal-install) fails due to missing zlib library

I want to install Cabal 3.4.0.0 on Ubuntu 20.04.
$ sudo apt install cabal-install
$ cabal --version
cabal-install version 2.4.0.0
$ sudo cabal update
$ sudo cabal install Cabal cabal-install
...
Starting zlib-0.6.2.3
Failed to install zlib-0.6.2.3
Build log ( /root/.cabal/logs/ghc-8.6.5/zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF.log ):
cabal: Entering directory '/tmp/cabal-tmp-126381/zlib-0.6.2.3'
Configuring zlib-0.6.2.3...
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: zlib.h
* Missing (or bad) C library: z
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
...
cabal: Error: some packages failed to install:
cabal-install-3.4.0.0-3glzV3hM64DLoOfz3dHKsn depends on cabal-install-3.4.0.0
which failed to install.
hackage-security-0.6.0.1-KiAyVYLxooJAP3ckeQHnBD depends on
hackage-security-0.6.0.1 which failed to install.
zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF failed during the configure step. The
exception was:
ExitFailure 1
The error says:
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version).
How can I install this package on Ubuntu 20.04?
You aim to install the cabal-install package. This package has a dependency that here produces a problem: the zlib package.
This zlib package is essentially a thin wrapper around the zlib C library [wikipedia]. As the error says however, you did not install the zlib library, or at least not its package where one can develop with the zlib library.
We can install this by installing the libghc-zlib-dev software package, for example with:
sudo apt-get install libghc-zlib-dev
If we inspect the package details on Debian, we see that essentially this is a package that will install the zlib1g-dev package, the package to develop software with the zlib library. We can thus decide to install libghc-zlib-dev, or zlib1g-dev with:
sudo apt-get install zlib1g-dev
Nixos Users append pkgs.haskellPackages.zlib to environment.systemPackages

Can't install "System.Random" by cabal

I try to install "System.Random" by cabal through Powershell & Git Bash.
getting this result.
PS C:\Users\xxx> cabal install random
Resolving dependencies...
Up to date
Warning: You asked to install executables, but there are no executables in
target: random. Perhaps you want to use --lib to install libraries instead.
And then I try to input like this
cabal install --lib random
Resolving dependencies...
and
cabal install random --lib
both output Resolving dependencies... Up to date without warning.
but ghci Could not find module `System.Random'
input cabal install random still having the same result with warning.
It is a bad idea to install packages globally, so cabal install doesn't do that. The package is built and placed into the Cabal package database, but GHC won't find it unless you specifically tell Cabal to point GHC at it:
cabal repl -b random # -b is short for --build-depends
# Note that cabal install isn't really necessary: the above command would have installed random if it wasn't there already
I think your Cabal/GHC installation might be outdated, however. When you do cabal install --lib random, recent versions of Cabal should write out an "environment file" at %APPDATA%\ghc\arch-os-ghcversion\environments\default, which GHC should then automatically read (GHCi should say something like Loaded package environment from ...), and it should then find the installed package. If you are using the latest version of everything,
cabal install --lib random
ghci
should work.

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.

install gtk2hs with Darcs

I'm having some existing code that I'm not able to run without gtk2hs. But I can't get it installed. I tried with cabal before but found out that the correct solution for now is to build from darcs. So I do :
darcs get --lazy http://code.haskell.org/gtk2hs
cd gtk2hs
export PATH=$HOME/Library/Haskell/bin:$PATH
sh bootstrap.sh
And get this :
Resolving dependencies...
Configuring gio-0.12.4.1...
setup: The pkg-config package gio-2.0 version >=2.16.4 is required but it
could not be found.
Resolving dependencies...
Configuring cairo-0.12.4.1...
setup: The pkg-config package cairo version >=1.2.0 is required but it could
not be found.
Resolving dependencies...
Configuring pango-0.12.4.1...
setup: At least the following dependencies are missing:
cairo >=0.12.0 && <0.13
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring gtk-0.12.4.1...
setup: At least the following dependencies are missing:
cairo >=0.12.0 && <0.13, pango >=0.12.0 && <0.13
setup: Run the 'configure' command first.
setup: Run the 'configure' command first.
setup: Run the 'configure' command first.
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring gtk3-0.12.4.1...
setup: At least the following dependencies are missing:
cairo >=0.12.0 && <0.13, pango >=0.12.0 && <0.13
setup: Run the 'configure' command first.
setup: Run the 'configure' command first.
setup: Run the 'configure' command first.
I'm on osx with most recent versions of cabal and darcs.
You must install the gtk C libraries before you install the Haskell bindings to them. Visit the installation instructions and check the section for your operating system if you need instructions on how to do this.

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