diagrams / diagrams-haddock

Preprocessor for including inline diagrams in Haddock documentation
Other
10 stars 4 forks source link

Failure to find setup-config #21

Closed idontgetoutmuch closed 10 years ago

idontgetoutmuch commented 10 years ago
~/Dropbox/Private/diagrams-contrib $ ls -ltr dist/dist-sandbox-79e8b561/setup-config 
-rw-------  1 dom  staff  449364 Apr 11 16:31 dist/dist-sandbox-79e8b561/setup-config

~/Dropbox/Private/diagrams-contrib $ diagrams-haddock -d=dist/dist-sandbox-79e8b561
No setup-config found in ./dist/dist-sandbox-79e8b561, please run 'cabal configure' first.
byorgey commented 10 years ago

I am not sure, but I think this error message can also be caused by GHC version mismatches. (It's a bad error message by cabal---it says "no setup-config" when actually the problem is that it can't parse the one that's there.) Can you paste the contents of the setup-config file and also the output of cabal sandbox hc-pkg list?

idontgetoutmuch commented 10 years ago
~/Dropbox/Private/diagrams-contrib $ ~/.cabal/bin/cabal sandbox hc-pkg list
/usr/local/lib/ghc-7.6.2/package.conf.d:
    Cabal-1.16.0
    array-0.4.0.1
    base-4.6.0.1
    bin-package-db-0.0.0.0
    binary-0.5.1.1
    bytestring-0.10.0.2
    containers-0.5.0.0
    deepseq-1.3.0.1
    directory-1.2.0.1
    filepath-1.3.0.1
    (ghc-7.6.2)
    ghc-prim-0.3.0.0
    (haskell2010-1.1.1.0)
    (haskell98-2.0.0.2)
    hoopl-3.9.0.0
    hpc-0.6.0.0
    integer-gmp-0.5.0.0
    old-locale-1.0.0.5
    old-time-1.1.0.1
    pretty-1.1.1.0
    process-1.1.0.2
    rts-1.0
    template-haskell-2.8.0.0
    time-1.4.0.1
    unix-2.6.0.1

/Users/dom/Dropbox/Private/diagrams-contrib/.cabal-sandbox/x86_64-osx-ghc-7.6.2-packages.conf.d:
    Boolean-0.2.1
    MemoTrie-0.6.2
    MonadRandom-0.1.13
    NumInstances-1.3
    active-0.1.0.12
    aeson-0.7.0.2
    ansi-terminal-0.6.1.1
    ansi-wl-pprint-0.6.7.1
    arithmoi-0.4.0.4
    attoparsec-0.11.2.1
    bifunctors-4.1.1
    circle-packing-0.1.0.3
    colour-2.3.3
    comonad-4.0.1
    contravariant-0.4.4
    data-default-0.5.3
    data-default-class-0.0.1
    data-default-instances-base-0.0.1
    data-default-instances-containers-0.0.1
    data-default-instances-dlist-0.0.1
    data-default-instances-old-locale-0.0.1
    diagrams-contrib-1.1.1.4
    diagrams-core-1.1.0.2
    diagrams-lib-1.1.0.6
    distributive-0.4.3.1
    dlist-0.7.0.1
    dual-tree-0.2.0.2
    exceptions-0.5
    fingertree-0.1.0.0
    force-layout-0.3.0.3
    free-4.6.1
    groups-0.4.0.0
    hashable-1.2.1.0
    intervals-0.7
    lens-4.1.2
    monoid-extras-0.3.3.2
    mtl-2.1.3.1
    nats-0.1.2
    newtype-0.2
    optparse-applicative-0.8.0.1
    parallel-3.2.0.4
    parsec-3.1.5
    primitive-0.5.2.1
    profunctors-4.0.3
    random-1.0.1.1
    reflection-1.4
    safe-0.3.4
    scientific-0.2.0.2
    semigroupoids-4.0.1
    semigroups-0.13.0.1
    split-0.2.2
    syb-0.4.1
    tagged-0.7.1
    text-1.1.0.1
    transformers-0.3.0.0
    transformers-compat-0.1.1.1
    unordered-containers-0.2.3.3
    utf8-string-0.3.7
    vector-0.10.9.1
    vector-space-0.8.6
    vector-space-points-0.2
    void-0.6.1
    zlib-0.5.4.1
idontgetoutmuch commented 10 years ago

setup-config: http://lpaste.net/102570

byorgey commented 10 years ago

I think the problem might be that your cabal-install seems to be compiled with Cabal-1.19, but your package database contains Cabal-1.16 (which is therefore what diagrams-haddock and its dependencies are being compiled against). I think fryguybob's comments on IRC are relevant:

(09:34) < fryguybob> cinimod: Unfortunately with diagrams-haddock we link in GHC so which has a required cabal version.  If it doesn't match your cabal-install version of the cabal lib it gets confused.
(09:34) < fryguybob> I have to keep around an older version of cabal-install that matches the one linked into GHC inorder to build for diagrams-haddock :(

In a bit more detail, the problem is that your cabal-install writes the setup-config file (using Cabal-1.19), but then diagrams-haddock tries to parse it (using Cabal-1.16). Version mismatch = parse failure = error.

Sorry, I know this is a pain. =( One solution would be to reinstall cabal-install in the sandbox (so it builds against Cabal-1.16) and then use that instead of your global cabal-install.

idontgetoutmuch commented 10 years ago

I'll try that tomorrow - I appreciate you taking the time to look at this.

idontgetoutmuch commented 10 years ago

Hmmmm for some reason this picked up Cabal-1.18. And then I still get the error message that setup-config is missing. I'll try and force cabal to pick up 1.16.

~/.cabal/bin/cabal install cabal-install
~/Dropbox/Private/diagrams-contrib $ ./.cabal-sandbox/bin/cabal --version
cabal-install version 1.18.0.3
using version 1.18.1.3 of the Cabal library 
idontgetoutmuch commented 10 years ago
~/Dropbox/Private/diagrams-contrib $ ~/.cabal/bin/cabal install cabal-install --constraint=Cabal==1.16.0
$ ./.cabal-sandbox/bin/cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 
$ ./.cabal-sandbox/bin/cabal configure

and now diagrams-haddock finds setup-config. Sadly I then get

~/Dropbox/Private/diagrams-contrib $ diagrams-haddock 
[ ] diaLogo!
./src/Diagrams/Example/Logo.hs: diaLogo:
Interpreter error: Couldn't match type `Diagrams.Core.Types.QDiagram
                       b0 Diagrams.TwoD.Types.R2 Data.Monoid.Any'
              with `GHC.Types.IO
                      (Diagrams.Core.Types.QDiagram
                         Diagrams.Backend.SVG.SVG Diagrams.TwoD.Types.R2 Data.Monoid.Any)'
Expected type: GHC.Types.IO
                 (Diagrams.Core.Types.QDiagram
                    Diagrams.Backend.SVG.SVG Diagrams.TwoD.Types.R2 Data.Monoid.Any)
  Actual type: Diagrams.Core.Types.Diagram
                 b0 Diagrams.TwoD.Types.R2
byorgey commented 10 years ago

Hmm, I'll look into that. I've seen error messages like that in the past but I don't remember what the cause was. Note we are currently in the middle of updating diagrams-contrib and diagrams-doc to correspond to some big refactorings so things might be slightly broken.

idontgetoutmuch commented 10 years ago

I just started over with a fresh git clone. I am using a sandbox. I am using revision 8eca0c0 of diagrams-contrib and it has pulled in

    diagrams-contrib-1.1.1.4
    diagrams-core-1.1.0.2
    diagrams-lib-1.1.0.6
    diagrams-svg-1.0.2.1

I have

~/Dropbox/Private/diagrams-contrib $ ./.cabal-sandbox/bin/cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library 

and I get

~/Dropbox/Private/diagrams-contrib $ diagrams-haddock 
[ ] diaLogo!
./src/Diagrams/Example/Logo.hs: diaLogo:
Interpreter error: Couldn't match type `Diagrams.Core.Types.QDiagram
                       b0 Diagrams.TwoD.Types.R2 Data.Monoid.Any'
              with `GHC.Types.IO
                      (Diagrams.Core.Types.QDiagram
                         Diagrams.Backend.SVG.SVG Diagrams.TwoD.Types.R2 Data.Monoid.Any)'
Expected type: GHC.Types.IO
                 (Diagrams.Core.Types.QDiagram
                    Diagrams.Backend.SVG.SVG Diagrams.TwoD.Types.R2 Data.Monoid.Any)
  Actual type: Diagrams.Core.Types.Diagram
                 b0 Diagrams.TwoD.Types.R2

and a lot more similar errors.

byorgey commented 10 years ago

Can you paste the output of ghc-pkg list and of cabal sandbox hc-pkg list? One thing to note is that I don't think diagrams-haddock supports cabal sandboxes (yet).

idontgetoutmuch commented 10 years ago

I unregistered the copy of diagrams-contrib in my user package-db and now get the less alarming

~/Dropbox/Private/diagrams-contrib $ diagrams-haddock src/Diagrams/TwoD/Grid.hs
[ ] example1!
src/Diagrams/TwoD/Grid.hs: example1:
Interpreter error: Could not find module `Diagrams.TwoD.Grid'
Perhaps you meant
  Diagrams.TwoD.Arc (from diagrams-lib-1.1.0.4)
  Diagrams.TwoD.Arc (needs flag -package diagrams-lib-1.0.1)
  Diagrams.TwoD.Arc (needs flag -package diagrams-lib-1.0)
Use -v to see a list of the files searched for.

Now the mystery is: why isn't diagrams-haddock finding the package it is actually in. I will look at the documentation again.

Also

~/Dropbox/Private/diagrams-contrib $ diagrams-haddock
[ ] diaLogo!
./src/Diagrams/Example/Logo.hs: diaLogo:
Interpreter error: Could not find module `Diagrams.Example.Logo'
Use -v to see a list of the files searched for.
byorgey commented 10 years ago

By the way, I think that last error was caused by not having diagrams-contrib itself installed. But that might itself be because diagrams-haddock doesn't yet support cabal sandboxes. (It shouldn't be hard to add support, someone just needs to do it.)

Since we've worked around this for now I'm going to close this ticket---there's nothing wrong per se but obviously there are still things we could do to improve the situation/make contributing easier.

pnutus commented 10 years ago

After a lot of trouble with cabal hell and wonky sandboxes, I finally managed to install diagrams-haddock and set up a shared sandbox, only to stumbled onto Failure to find setup-config instead. Am I right in guessing the solution is to use hsenv instead?

I would appreciate if you added support for cabal sanboxes.

byorgey commented 10 years ago

Hard to say. "Failure to find setup-config" sometimes also means there is a setup-config but it was generated by a different version of Cabal than the one being used to read it (that's a terrible error message but unfortunately there's not a lot we can do about it).

What would cabal sandbox support look like? (I thought we already did support them --- am I wrong?)

pnutus commented 10 years ago

I have a shared sandbox for all the different diagrams libraries, so I can work on the git version. diagrams-haddock is installed globally (because cabal sandbox doesn't support dynamically changing the path, AFAIK). When I run diagrams-haddock on the git version, it uses the Hackage version of diagrams (installed globally), which is incompatible with the git version.

byorgey commented 10 years ago

Ah, I see. In that case, yes, using hsenv would probably work better. Though I'm still curious to think about what better cabal sandbox support would look like. On Aug 20, 2014 12:51 PM, "Pontus Granström" notifications@github.com wrote:

I have a shared sandbox for all the different diagrams libraries, so I can work on the git version. diagrams-haddock is installed globally (because cabal sandbox doesn't support dynamically changing the path, AFAIK). When I run diagrams-haddock on the git version, it uses the Hackage version of diagrams (installed globally), which is incompatible with the git version.

— Reply to this email directly or view it on GitHub https://github.com/diagrams/diagrams-haddock/issues/21#issuecomment-52807071 .

pnutus commented 10 years ago

Being able to run the diagrams-haddock version installed in the sandbox would be nice. It's probably more of a cabal feature, though.