Haskell glib library wont build - haskell

When I install glib this is the error that I get. I think my problem has to do with the "legacy fallback" part but I have no way to fix that.
ghc version: 8.6.5
cabal version: 3.0.0.0
$ cabal install glib
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- glib-0.13.8.0 (lib:glib) (requires build)
Starting glib-0.13.8.0 (all, legacy fallback)
Building glib-0.13.8.0 (all, legacy fallback)
Failed to build glib-0.13.8.0.
Build log (
/home/dagon/.cabal/logs/ghc-8.6.5/glib-0.13.8.0-83f4ff904d65860d6da22747d08c5e962bdbbd1be59c0e6934c51b56a26d7fa7.log
):
[1 of 1] Compiling Main ( /tmp/cabal-install.-14521/dist-newstyle/tmp/src-14521/glib-0.13.8.0/dist/setup/setup.hs, /tmp/cabal-install.-14521/dist-newstyle/tmp/src-14521/glib-0.13.8.0/dist/setup/Main.o )
Linking /tmp/cabal-install.-14521/dist-newstyle/tmp/src-14521/glib-0.13.8.0/dist/setup/setup ...
Configuring glib-0.13.8.0...
Preprocessing library for glib-0.13.8.0..
c2hs/c/CAST.hs:(1017,5)-(1069,22): Non-exhaustive patterns in function put_
cabal: Failed to build glib-0.13.8.0. See the build log above for details.

$ rm -rf ~/.cabal ~/.ghc
$ cabal upadte
$ cabal install glib

Related

Not able to initialize sandbox using cabal on haskell platform

I have done the below steps to install cabal . I have already installed haskell platform using sudo apt-get install haskell-platform
http://coldwa.st/e/blog/2013-08-20-Cabal-sandbox.html
Building Cabal from git
Assuming you already have a previous version of cabal installed:
$ git clone git://github.com/haskell/cabal.git /path/to/cabal
$ cd /path/to/cabal
$ cabal install Cabal/ cabal-install/
However when I try to initialize a sandbox, it throws error as below.
vagrant#vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help
cabal: unrecognised command: sandbox (try --help)
Adding more details:
vagrant#vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
vagrant#vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ which cabal
/home/vagrant/.cabal/bin/cabal
vagrant#vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal --help
This program is the command line interface to the Haskell Cabal infrastructure.
See http://www.haskell.org/cabal/ for more information.
Usage: cabal COMMAND [FLAGS]
or: cabal [GLOBAL FLAGS]
Global flags:
-h --help Show this help text
-V --version Print version information
--numeric-version Print just the version number
Commands:
install Installs a list of packages.
update Updates list of known packages
list List packages matching a search string.
info Display detailed information about a particular package.
fetch Downloads packages for later installation.
unpack Unpacks packages for user inspection.
check Check the package for common mistakes
sdist Generate a source distribution file (.tar.gz).
upload Uploads source packages to Hackage
report Upload build reports to a remote server.
init Interactively create a .cabal file.
configure Prepare to build the package.
build Make this package ready for installation.
copy Copy the files into the install locations.
haddock Generate Haddock HTML documentation.
clean Clean up after a build.
hscolour Generate HsColour colourised code, in HTML format.
register Register this package with the compiler.
test Run the test suite, if any (configure with UserHooks).
bench Run the benchmark, if any (configure with UserHooks).
upgrade (command disabled, use install instead)
help Help about commands
For more information about a command use:
cabal COMMAND --help
To install Cabal packages from hackage use:
cabal install foo [--dry-run]
Occasionally you need to update the list of available packages:
cabal update
You can edit the cabal configuration file to set defaults:
/home/vagrant/.cabal/config
vagrant#vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal COMMAND --help
cabal: unrecognised command: COMMAND (try --help)
vagrant#vagrant-ubuntu-trusty-32:/usr/lib/haskell-packages$ cabal sandbox --help
cabal: unrecognised command: sandbox (try --help)
The Cabal installed by apt is a little older and this is likely the one in your PATH. It gets installed to /usr/bin. You can check with:
which cabal
And to see the version:
cabal -v
You should put the one in ~/.cabal/bin in your PATH first with:
export PATH="$HOME/.cabal/bin:$PATH
(Probably best to put this in your ~/.bash_profile or similar)
On my system:
.whogan:~$ which cabal
/home/whogan/.cabal/bin/cabal
.whogan:~$ cabal -V
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library
.whogan:~$ /usr/bin/cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
Edit: Tried with a new Vagrant box, ran apt-get install haskell-platform and install from git:
[vagrant#vagrantbox:~] $ git clone git://github.com/haskell/cabal.git cabal-wip
Cloning into 'cabal-wip'...
remote: Counting objects: 48926, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 48926 (delta 16), reused 0 (delta 0), pack-reused 48876
Receiving objects: 100% (48926/48926), 26.39 MiB | 10.37 MiB/s, done.
Resolving deltas: 100% (29033/29033), done.
Checking connectivity... done.
[vagrant#vagrantbox:~] $ cd cabal-wip
[vagrant#vagrantbox:~/cabal-wip][master] $ cabal install Cabal/ cabal-install/
Config file path source is default config file.
Config file /home/vagrant/.cabal/config not found.
Writing default configuration to /home/vagrant/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
Configuring Cabal-1.23.0.0...
Building Cabal-1.23.0.0...
Preprocessing library Cabal-1.23.0.0...
[ 1 of 85] Compiling Distribution.Lex ( Distribution/Lex.hs, dist/build/Distribution/Lex.o )
..
[85 of 85] Compiling Distribution.Simple ( Distribution/Simple.hs, dist/build/Distribution/Simple.o )
In-place registering Cabal-1.23.0.0...
Installing library in /home/vagrant/.cabal/lib/Cabal-1.23.0.0/ghc-7.6.3
Registering Cabal-1.23.0.0...
Installed Cabal-1.23.0.0
[1 of 1] Compiling Main ( cabal-install/Setup.hs, cabal-install/dist/setup/Main.o )
Linking cabal-install/dist/setup/setup ...
Configuring cabal-install-1.23.0.0...
Building cabal-install-1.23.0.0...
Preprocessing executable 'cabal' for cabal-install-1.23.0.0...
[ 1 of 81] Compiling Distribution.Client.Utils.LabeledGraph ( Distribution/Client/Utils/LabeledGraph.hs, dist/build/cabal/cabal-tmp/Distribution/Client/Utils/LabeledGraph.o )
...
[81 of 81] Compiling Main ( Main.hs, dist/build/cabal/cabal-tmp/Main.o )
Linking dist/build/cabal/cabal ...
Generating manual page dist/build/cabal/cabal.1 ...
Installing executable(s) in /home/vagrant/.cabal/bin
Installed cabal-install-1.23.0.0
It's installed 1.23.0.0 to ~/.cabal/bin, but after this the PATH is still pointing to the system one:
[vagrant#vagrantbox:~/cabal-wip][master] $ which cabal
/usr/bin/cabal
[vagrant#vagrantbox:~/cabal-wip][master] $ cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
So I modify to put the user/git version first:
[vagrant#vagrantbox:~/cabal-wip][master] $ export PATH="~/.cabal/bin:$PATH"
[vagrant#vagrantbox:~/cabal-wip][master] $ which cabal
/home/vagrant/.cabal/bin/cabal
[vagrant#vagrantbox:~/cabal-wip][master] $ cabal -V
cabal-install version 1.23.0.0
compiled using version 1.23.0.0 of the Cabal library
It seems OK after that:
[vagrant#vagrantbox:~/cabal-wip][master] $ mkdir ~/tmp && cd ~/tmp
[vagrant#vagrantbox:~/tmp] $ cabal sandbox init
Writing a default package environment file to
/home/vagrant/tmp/cabal.sandbox.config
Creating a new sandbox at /home/vagrant/tmp/.cabal-sandbox
I used trusty64 rather than trusty32 but I would hope that's not significant in this case.

cabal sdist: tests inappropriate type

I just completed my first executable + library + tests in Haskell.
Unfortunately I can't create the tar-ball with the cabal sdist command.
cabal install --enable-tests && cabal build && cabal test are working without problems
cabal check returns only the warning for -O2
>> cabal sdist --verbose
creating dist/src
creating dist/src/sdist.-15440/UTFTConverter-0.1.0.0
Distribution quality warnings:
'ghc-options: -O2' is rarely needed. Check that it is giving a real benefit
and not just imposing longer compile times on your users.
Building source dist for UTFTConverter-0.1.0.0...
Preprocessing library UTFTConverter-0.1.0.0...
Preprocessing executable 'UTFTConverter' for UTFTConverter-0.1.0.0...
Preprocessing test suite 'library-tests:' for UTFTConverter-0.1.0.0...
creating dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src
creating dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Format
creating dist/src/sdist.-15440/UTFTConverter-0.1.0.0/tests
creating dist/src/sdist.-15440/UTFTConverter-0.1.0.0
Installing src/Format.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Format.hs
Installing src/Format/C.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Format/C.hs
Installing src/Format/Converter.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Format/Converter.hs
Installing src/Format/Raw.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Format/Raw.hs
Installing src/Format/RGB565.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Format/RGB565.hs
Installing src/Main.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/src/Main.hs
Installing tests/Tests.hs to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/tests/Tests.hs
Installing LICENSE to dist/src/sdist.-15440/UTFTConverter-0.1.0.0/LICENSE
Installing Setup.lhs to dist/src/sdist.-15440/UTFTConverter-0.1.0.0/Setup.lhs
Installing ./UTFTConverter.cabal to
dist/src/sdist.-15440/UTFTConverter-0.1.0.0/./UTFTConverter.cabal
creating dist/src/sdist.-15440/UTFTConverter-0.1.0.0
Installing tests to dist/src/sdist.-15440/UTFTConverter-0.1.0.0/tests
cabal: tests: inappropriate type
My cabal version is
>> cabal -V
cabal-install version 1.18.1.0
using version 1.18.1.3 of the Cabal library
My GHC version is
>> ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.8.3
Here is the github page to the project, maybe somebody can reproduce this error. >> Link <<
Remove tests from your extra-source-files section. You can't put directories in that section.

Unable to upgrade cabal to the latest version in Linux

I'm trying to upgrade cabal to the latest version because the current version has a bug:
cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
which cabal
/usr/bin/cabal
curl http://hackage.haskell.org/package/cabal-install-1.22.3.0/cabal-install-1.22.0.3.tar.gz
tar xvfz cabal-install-1.22.3.0.tar.gz
cd cabal-install-1.22.3.0
cabal install
It seems to install cabal 1.22.3.0 in ~/.cabal but there's no bin directory in it, there're only share, packages, logs, lib directories and I can't find executable in the folder.
So can I find the new cabal which I've just installed?
UPDATE:
cabal update
cabal install cabal-install
...................
checking for sendfile in sys/socket.h... no
checking for gethostent... yes
checking for accept4... yes
configure: creating ./config.status
config.status: creating network.buildinfo
config.status: creating include/HsNetworkConfig.h
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
Building network-2.6.2.0...
Preprocessing library network-2.6.2.0...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install network-2.6.2.0
Configuring old-locale-1.0.0.7...
Building old-locale-1.0.0.7...
Preprocessing library old-locale-1.0.0.7...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install old-locale-1.0.0.7
Configuring random-1.1...
Building random-1.1...
Preprocessing library random-1.1...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install random-1.1
Configuring stm-2.4.4...
Building stm-2.4.4...
Preprocessing library stm-2.4.4...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install stm-2.4.4
Configuring text-1.2.1.1...
Building text-1.2.1.1...
Preprocessing library text-1.2.1.1...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install text-1.2.1.1
Configuring zlib-0.5.4.2...
Building zlib-0.5.4.2...
Preprocessing library zlib-0.5.4.2...
ghc: ghc no longer supports single-file style package databases (dist/package.conf.inplace) use 'ghc-pkg init' to create the database with the correct format.
Failed to install zlib-0.5.4.2
cabal: Error: some packages failed to install:
HTTP-4000.2.19 depends on text-1.2.1.1 which failed to install.
cabal-install-1.22.4.0 depends on zlib-0.5.4.2 which failed to install.
mtl-2.2.1 failed during the building phase. The exception was:
ExitFailure 1
network-2.6.2.0 failed during the building phase. The exception was:
ExitFailure 1
network-uri-2.6.0.3 depends on text-1.2.1.1 which failed to install.
old-locale-1.0.0.7 failed during the building phase. The exception was:
ExitFailure 1
old-time-1.1.0.3 depends on old-locale-1.0.0.7 which failed to install.
parsec-3.1.9 depends on text-1.2.1.1 which failed to install.
random-1.1 failed during the building phase. The exception was:
ExitFailure 1
stm-2.4.4 failed during the building phase. The exception was:
ExitFailure 1
text-1.2.1.1 failed during the building phase. The exception was:
ExitFailure 1
zlib-0.5.4.2 failed during the building phase. The exception was:
ExitFailure 1
Currently in ghc-7.10 there seems to be no way to upgrade cabal-install from 1.16 (which it is shipped with and reverts to when deleting .ghc).
Workaround:
install ghc-7.8 and
upgrade cabal-install
switch back to ghc-7.10
https://mail.haskell.org/pipermail/haskell-cafe/2014-December/117512.html
Luckily for me, I already had a script ready for switching versions globally:
#!/bin/bash -e
if [ $# -ne 1 ]; then
echo "usage: $0 <version> \# e.g.: $0 7.8.3 - being run for example in /usr/local/bin"
exit 1
fi
VERSION=$1
sudo rm ghc
sudo ln -s ghc-${VERSION} ghc
sudo rm ghci
sudo ln -s ghci-${VERSION} ghci
sudo rm ghc-pkg
sudo ln -s ghc-pkg-${VERSION} ghc-pkg
sudo rm haddock
sudo ln -s haddock-ghc-${VERSION} haddock
sudo rm runghc
sudo ln -s runghc-${VERSION} runghc
(May need adjustment depending on your ghc install.)
Try installing it using cabal itself:
cabal update
cabal install cabal-install
After running either cabal install or cabal build, look in ./dist/build/cabal/ for the built cabal binary.
You can also use this recipe:
cabal get cabal-install
cd cabal-install-1.22.4.0 # or whatever the get command says
cabal build
# binary resides in dist/build/cabal

cabal dependency resolution fail for 'lens'

I just did a cabal update and tried to install 'lens' from hackage. That gave me the following error -
$ cabal install -j lens
Resolving dependencies...
Configuring dlist-0.7.0.1...
... <snip>
Configuring mtl-2.0.1.0...
Building mtl-2.0.1.0...
Failed to install mtl-2.0.1.0
Last 10 lines of the build log ( /home/aj/.cabal/logs/mtl-2.0.1.0.log ):
Building mtl-2.0.1.0...
Preprocessing library mtl-2.0.1.0...
[ 1 of 21] Compiling Control.Monad.Writer.Class (
Control/Monad/Writer/Class.hs, dist/build/Control/Monad/Writer/Class.o )
[ 2 of 21] Compiling Control.Monad.State.Class ( Control/Monad/State/Class.hs,
dist/build/Control/Monad/State/Class.o )
[ 3 of 21] Compiling Control.Monad.Reader.Class (
Control/Monad/Reader/Class.hs, dist/build/Control/Monad/Reader/Class.o )
[ 4 of 21] Compiling Control.Monad.RWS.Class ( Control/Monad/RWS/Class.hs,
dist/build/Control/Monad/RWS/Class.o )
[ 5 of 21] Compiling Control.Monad.Identity ( Control/Monad/Identity.hs,
dist/build/Control/Monad/Identity.o )
[ 6 of 21] Compiling Control.Monad.Error.Class ( Control/Monad/Error/Class.hs,
dist/build/Control/Monad/Error/Class.o )
Control/Monad/Error/Class.hs:93:18: Not in scope: `catch'
... <snip>
cabal: Error: some packages failed to install:
aeson-0.7.0.3 depends on mtl-2.0.1.0 which failed to install.
exceptions-0.6 depends on mtl-2.0.1.0 which failed to install.
free-4.7.1 depends on mtl-2.0.1.0 which failed to install.
lens-4.1.2 depends on mtl-2.0.1.0 which failed to install.
mtl-2.0.1.0 failed during the building phase. The exception was:
ExitFailure 1
So looks like mtl-2.0.1.0 is broken. However some more dependency tracking reveals that nothing in the lens package definition actually depends on that version of mtl. Infact, the next thing I tried was -
$ cabal install -j aeson
$ cabal install -j free
$ cabal install -j lens
And that succeeds without problems.
So why would cabal try to install mtl-2.0.1.0 when installing lens directly? I've tried removing my .ghc and .cabal directories and repeating the steps, with the same results. The cabal version I'm using is 1.16 -
$ cabal -V
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
The workaround that I am using is to first install transformers-compat with the transformers 3 flag
$ cabal install -ftransformer3 transformers-compat
and then install lens with the transformers 0.3.0.0 constraint
$ cabal install --constraint="transformers==0.3.0.0" lens
I hit this error too. I think I've managed to fix it by manually unpacking mtl-2.0.1.0, explicitly adding catch to the import list of Control.Exception in Control/Monad/Error/Class.hs (L:55), then running cabal install.
After that I was able to run cabal install lens. I'd be interested to know if that works for you too!

cabal install hangs installing yesod-platform

The cabal install of yesod-platform hangs downloading xss-sanitize. NetHogs shows no network activity related to this download.
$ cabal install yesod-platform
Resolving dependencies...
Downloading xss-sanitize-0.3.4...
Other packages download and install without delay.
I'm on Fedora 18. The haskell-platform and cabal-install are up-to-date from the repos.
$ cabal --version
cabal-install version 0.14.0
using version 1.14.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1
Edit
I left it run overnight it seemed to give up on xss-sanitizer, and continued installing the other dependencies. Here is the tail.
...
Configuring yesod-test-1.2.1...
Building yesod-test-1.2.1...
Preprocessing library yesod-test-1.2.1...
[1 of 3] Compiling Yesod.Test.CssQuery ( Yesod/Test/CssQuery.hs, dist/build/Yesod/Test/CssQuery.o )
[2 of 3] Compiling Yesod.Test.TransversingCSS ( Yesod/Test/TransversingCSS.hs, dist/build/Yesod/Test/TransversingCSS.o )
[3 of 3] Compiling Yesod.Test ( Yesod/Test.hs, dist/build/Yesod/Test.o )
Yesod/Test.hs:113:1:
Warning: In the use of `runFakeHandler'
(imported from Yesod.Core, but defined in yesod-core-1.2.4.2:Yesod.Core.Internal.Run):
"Usually you should *not* use runFakeHandler unless you really understand how it works and why you need it."
Registering yesod-test-1.2.1...
Installing library in /home/smithd/.cabal/lib/yesod-test-1.2.1/ghc-7.4.1
cabal: Error: some packages failed to install:
xss-sanitize-0.3.4 failed while downloading the package. The exception was:
<socket: 4>: hGetBufSome: timeout (Connection timed out)
yesod-1.2.2.1 depends on xss-sanitize-0.3.4 which failed to install.
yesod-auth-1.2.2.1 depends on xss-sanitize-0.3.4 which failed to install.
yesod-form-1.3.2.1 depends on xss-sanitize-0.3.4 which failed to install.
yesod-platform-1.2.4.2 depends on xss-sanitize-0.3.4 which failed to install.
[smithd#lin2900 ~]$ cabal install yesod-platform
My companies internet filter was blocking the haskell-xss-sanitize package as a possible XSS threat. Specifically the test modules. Have your admin white-list hackage if possible.

Resources