cabal-dev icon indicating copy to clipboard operation
cabal-dev copied to clipboard

cabal-dev ghci error

Open jaccokrijnen opened this issue 11 years ago • 1 comments

When running cabal-dev ghci on a cabal library project that has no source code (or does not export any modules) the following error message appears:

$cabal-dev ghci
FAILED:
Failed to extract GHC Build arguments
--------------------------------------------------------------
...

To me this message was not very helpful (keep in mind that I am completely new to cabal and cabal-dev). Also, running the normal ghci command would work, which almost convinced me there would be something wrong with cabal-dev. Obviously, this should not happen to more experienced cabal users, but I was stuck at this point, google did not help either.

Could the error message perhaps be a bit more informative?

Kind regards, Jacco

jaccokrijnen avatar Jul 22 '13 19:07 jaccokrijnen

Ah, that's a good point, and a situation we don't run into often.

The reason this happens (as far as I know...) is because we're using a hack to get the ghc arguments that cabal uses to do a build. Basically, we can configure cabal to use sandboxes more easily than we can configure ghc -- and cabal already does that, so we cheat and tell cabal to invoke a different ghc (which we built) just to get the arguments to pass to ghci.

However, cabal doesn't bother invoking ghc if there is no source, or if there are no exposed modules, so this hack fails with the cryptic parse error you've seen.

Since the hack fails, it's hard for us to recover and "do the right thing" (that's also a little hard to define, but it seems like it should load ghci with the package dependencies in the sandbox, at least).

Clearly, the error message leaves something to be desired, and we can probably fix that.

creswick avatar Jul 22 '13 21:07 creswick