cabal-dev
cabal-dev copied to clipboard
cabal-dev ghci won't start
I'm having trouble starting an interactive session with cabal-dev ghci
. Here's a minimal way to reproduce:
$ mkdir bug
$ cd bug
$ echo 'name: bug
version: 0.1.0.0
build-type: Simple
cabal-version: >=1.8
library
exposed-modules: Bug
build-depends: base >= 4' > bug.cabal
$ echo 'module Bug where' > Bug.hs
$ cabal-dev configure
$ cabal-dev ghci
cabal-dev: user error (Warning: The 'license-file' field refers to the file 'LICENSE' which does not
exist.
Warning: cannot determine version of /u/afoltzer/.cabal/bin/fake-ghc-cabal-dev
:
"== GHC Arguments: Start ==\n--numeric-version\n== GHC Arguments: End ==\n"
/usr/bin/ar: dist/build/Bug.o: No such file or directory
)
Here are the relevant versions:
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.4.1
$ cabal --version
cabal-install version 0.13.3
using version 1.14.0 of the Cabal library
$ cabal-dev --version
cabal-dev 0.9.1
built with Cabal 1.14.0
ah, cabal-dev configure is a dangerous, deep, ugly hole in most cases.
We need to do something about that :(.
The workaround is to forget about configure entirely, and just use install:
$ cabal-dev install
Resolving dependencies...
Configuring bug-0.1.0.0...
Preprocessing library bug-0.1.0.0...
Building bug-0.1.0.0...
[1 of 1] Compiling Bug ( Bug.hs, dist/build/Bug.o )
[1 of 1] Compiling Bug ( Bug.hs, dist/build/Bug.p_o )
Registering bug-0.1.0.0...
Installing library in
/home/creswick/tmp/cabal-dev-ticket50/cabal-dev//lib/bug-0.1.0.0/ghc-7.4.1
Registering bug-0.1.0.0...
|creswick on creswick |99% |11:47:18|~/tmp/cabal-dev-ticket50|
$ cabal-dev ghci
on the commandline:
Warning: -O conflicts with --interactive; -O ignored.
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Ok, modules loaded: Bug.
Prelude Bug>
This seems to have the unfortunate requirement that one must first have a project that successfully installs. I'm in the middle of trying to fix a buggy commit, and so the best I can do is a cabal-dev install --only-dependencies
, which works out like so:
$ cabal-dev install --only-dependencies
Resolving dependencies...
No packages to be installed. All the requested packages are already installed.
If you want to reinstall anyway then use the --reinstall flag.
$ cabal-dev ghci
cabal-dev: user error (cabal: Run the 'configure' command first.
)
So I have to try with cabal-dev install
, and if I put the following into Bug.hs
:
bad :: Int
bad = True
Then I'm back around the block again:
$ cabal-dev install
Resolving dependencies...
Configuring bug-0.1.0.0...
Building bug-0.1.0.0...
Preprocessing library bug-0.1.0.0...
[1 of 1] Compiling Bug ( Bug.hs, dist/build/Bug.o )
Bug.hs:4:7:
Couldn't match expected type `Int' with actual type `Bool'
In the expression: True
In an equation for `bad': bad = True
cabal: Error: some packages failed to install:
bug-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1
$ cabal-dev ghci
cabal-dev: user error (Warning: cannot determine version of /u/afoltzer/.cabal/bin/fake-ghc-cabal-dev
:
"== GHC Arguments: Start ==\n--numeric-version\n== GHC Arguments: End ==\n"
/usr/bin/ar: dist/build/Bug.o: No such file or directory
)
If cabal-dev configure
is slated to be improved, it might not be worth too much effort to figure out this edge case. After all, I can in the meantime just make sure to initialize the sandbox only with clean commits. Hopefully this information will come in handy, though.
From what I'm reading, is the requirement for cabal-dev ghci
to work that the project build completely with cabal-dev install
? If you are working on a project that uses Snap, and you want to enable rebuilding on load, you have to install snap first with -fhint
and then install.
But aside from that, if, in development or with a broken project, you can't use cabal-dev ghci
, I might as well be dealing with installing everything with straight cabal.
I guess it's time I put on my miners helmet and start reading through the code.
later
I forgot to mention that this is on 7.4.1
Yes, it's the latter issue. It's frustrating primarily because ghci is such a nice way to fix broken projects :3
Only three more weeks of classes, though, so maybe I can take a look soon too.
I /think/ the issues with cabal-dev ghci
are related to the hack we're using to get the ghci command line params. Presumably, cabal ghci
will get around these hacks, but it isn't yet included in cabal-install.
Here's the cabal-ghci ticket to track progress. It looks like cabal-install-0.16
is the target release.
- http://hackage.haskell.org/trac/hackage/ticket/382
My inclination is to wait for that to arrive and delegate to cabal-install
, where ghci can be done correctly, but obviously that doesn't help (a) in the meantime, or (b) for users who can't use 0.16 once it's out.
cabal-install already has version 1.16.0.1 My project builds ok with cabal-dev but cabal-dev ghci fails to load with
<no location info>:
Failing due to -Werror.
on the commandline:
Warning: -O conflicts with --interactive; -O ignored.
though I don't have any warnings for my sources. Omitting -Werror
is the only option at the moment?
With the latests updates from Gentoo repo (it has cabal-dev 0.9.1 and Cabal/cabal-install 1.16). I was forced to switch to cabal as I get the following:
$ cabal-dev ghci
cabal-dev: user error (Warning: cannot determine version of /usr/bin/fake-ghc-cabal-dev :
"== GHC Arguments: Start ==\n--numeric-version\n== GHC Arguments: End ==\n"
cabal: ghcInvocation: the programVersion must not be Nothing
)
Any hints on this issue?
$ cabal-dev ghci ...
Same error for me.
Please mention that last problem was fixed in 3597d608. I have even done same fix before I realized that is was already fixed upstream.