cabal sdist: tests inappropriate type - haskell

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.

Related

cabal fails to find a library built and installed with cabal install --lib (linux)

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 .

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.

Exit Code 11 installing Persistent (Yesod)

I'm trying to install Yesod on my Mac (running Mavericks), but installation fails because of an error installing Persistent. Specifically, cabal install persistent yields:
Failed to install persistent-1.3.0.2
Updating documentation index /Users/Max/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
persistent-1.3.0.2 failed during the building phase. The exception was:
ExitFailure 11
(The full output is available as a gist)
I don't think this is an issue with conflicts, because I ran rm -rf ~/.ghc ~/.cabal before trying this (though I think 3 globally installed packages might not have been erased—unsure).
I'm using the latest Haskell Platform with the ghc-clang-wrapper script.
Cabal versions:
$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
GHC version:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
Reinstalling Haskell platform allowed me to install Persistent, but the real issue was that I needed to install gcc48. Installing this cleared everything up. https://stackoverflow.com/a/21285413/1176156

runhaskell Setup install Setup error

I am trying to install packages from haskell's Hackage using Cabal.
In particular, I am trying to download the gloss package:
cabal install gloss
Comes up with this error:
binary-0.7.1.0 failed during the building phase.
The exception was:
ExitFailure 1
bmp-1.2.5.2 depends on binary-0.7.1.0 which failed to install.
gloss-1.8.1.1 depends on binary-0.7.1.0 which failed to install.
I also tried binary-0.6.0.0. Because cabal install is not working, I am trying:
runhaskell Setup configure
runhaskell Setup build
runhaskell Setup install
...in the directory of the package, and I get the same error for every package:
Setup: Error: Could not find module: Data.Binary with any suffix: ["hi"] in
the search path: ["dist/build"]
I am also having trouble installing the newest version of Cabal.
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library
The Glorious Glasgow Haskell Compilation System, version 7.6.3
Mac OSX 10.8 on MacBook Pro Retina
The binary package fails to install on latest versions of osx because osx uses clang instead of gcc, and 'gcc' is usually just a symlink to clang. gcc is used in the pre-processor stage (haskell supports c-like macros) but clang does not support all the features for the pre-processor stage that gcc supports.
To know if this is your problem, type 'gcc' in the terminal. If it says 'clang' somewhere, then this is the issue.
The solution is to get gcc, and replace the symlink to gcc with real gcc. Using 'runhaskell' will still have the same issue. For the most part, you should never try to install packages without cabal, it is by far the easiest way.
This is not an answer.
If you have downloaded package binary-0.7.1.0, you can untar it first, and go into that folder, and run
cabal configure
cabal build
cabal install
There must be more error message, such as line number, but I didn't see it.

Why can't cabal build mighttpd2 dynamically?

GHC is too slow when it links my executable statically, so I want to test using "-dynamic" options. The following two commands cause the same error although cabal install mighttpd2 is ok.
$cabal install --ghc-options=-dynamic mighttpd2
$cabal install --enable-executable-dynamic mighttpd2
Linking dist/build/mkindex/mkindex ...
Preprocessing executable 'mightyctl' for mighttpd2-2.7.1...
Process.hs:11:8:
Could not find module `Data.Conduit.Process'
Perhaps you haven't installed the "dyn" libraries for package `process conduit-0.5.0.2'?
Use Perhaps you haven't installed the "dyn" libraries for package `process-conduit-0.5.0.2'?
Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
mighttpd2-2.7.1 failed during the building phase. The exception was:ExitFailure 1
You need to install the dynamic version of all the libraries that mighttpd2 depends on. cabal-install is rightly complaining that the dynamic version of process-conduit is not available. You will have to reinstall mighttpd2's entire dependency tree with --enable-shared --enable-executable-dynamic passed to cabal-install.

Resources