2

I've got ghc-7.2.2 unknown linux tar.bz2 installed in $HOME on archlinux.

After installing a number of packages successfully with cabal-dev trying to install eg. parsec-numbers, text, ad etc I get:

cabal: cannot configure base-4.4.1.0 It requires ghc-prim -any
integer-simple and rts -any
There is no available version (of each of the above for example)

Is this an obvious fault in my installation or a possible bug?

I have the appropriate $GHC_PACKAGES_PATH set and have run ghc-pkg recache.

Here's my list of installed packages:

/home/jim/cabal-dev/packages-7.2.2.conf:
    QuickCheck-2.4.2
    bmp-1.1.2.1
    comonad-1.1.1.1
    comonad-transformers-2.0.2
    comonads-fd-2.0.2
    contravariant-0.1.3
    data-lens-2.0.2
    data-reify-0.6
    distributive-0.2.0.1
    free-2.0.2
    mtl-2.0.1.0
    primitive-0.4.0.1
    random-1.0.1.1
    repa-2.2.0.1
    repa-algorithms-2.2.0.1
    repa-bytestring-2.2.0.1
    repa-io-2.2.0.1
    semigroupoids-1.2.6
    semigroups-0.8
    transformers-0.2.2.0
    vector-0.9.1

/home/jim/lib/ghc-7.2.2/package.conf.d:
    Cabal-1.12.0
    array-0.3.0.3
    base-4.4.1.0
    bin-package-db-0.0.0.0
    (binary-0.5.0.2)
    bytestring-0.9.2.0
    containers-0.4.1.0
    directory-1.1.0.1
    extensible-exceptions-0.1.1.3
    ffi-1.0
    filepath-1.2.0.1
    (ghc-7.2.2)
    ghc-prim-0.2.0.0
    (haskell2010-1.1.0.0)
    (haskell98-2.0.0.0)
    hoopl-3.8.7.1
    hpc-0.5.1.0
    integer-gmp-0.3.0.0
    old-locale-1.0.0.3
    old-time-1.0.0.7
    pretty-1.1.0.0
    process-1.1.0.0
    rts-1.0
    template-haskell-2.6.0.0
    time-1.2.0.5
    unix-2.5.0.0

Yep, bytestring-0.9.0.2 should have been -0.9.2.0, apologies.

cabal-dev -v3 install bytestring --reinstall produces:

cabal-dev 0.9
built with Cabal 1.12.0
searching for cabal in path.
found cabal at /usr/bin/cabal
("/usr/bin/cabal",["--numeric-version"])
/usr/bin/cabal is version 0.10.2
Using cabal-install 0.10.2 at FoundOnSystem {locationPath = "/usr/bin/cabal"}
No sandbox specified. Using cabal-dev
Using cabal-dev as the relative cabal-dev sandbox
Using /home/jim/cabal-dev as the cabal-dev sandbox
Creating local repo /home/jim/cabal-dev/packages
searching for ghc-pkg in path.
found ghc-pkg at /home/jim/bin/ghc-pkg
("/home/jim/bin/ghc-pkg",["--version"])
/home/jim/bin/ghc-pkg is version 7.2.2
Using ghc-pkg 7.2.2
("/usr/bin/cabal",["--version"])
Complete arguments to cabal-install:
["--config-file=/home/jim/cabal-dev/cabal.config","install","--verbose=3","--reinstall"]
("/usr/bin/cabal",["--config-file=/home/jim/cabal-dev/cabal.config","install","--verbose=3","--reinstall","bytestring"])
searching for ghc in path.
found ghc at /home/jim/bin/ghc
("/home/jim/bin/ghc",["--numeric-version"])
/home/jim/bin/ghc is version 7.2.2
looking for tool "ghc-pkg" near compiler in /home/jim/bin
found ghc-pkg in /home/jim/bin/ghc-pkg
("/home/jim/bin/ghc-pkg",["--version"])
/home/jim/bin/ghc-pkg is version 7.2.2
("/home/jim/bin/ghc",["--supported-languages"])
("/home/jim/bin/ghc",["--info"])
Reading installed packages...
("/home/jim/bin/ghc-pkg",["dump","--global","-v2"])
("/home/jim/bin/ghc-pkg",["dump","--package-conf=/home/jim/cabal-dev/packages-7.2.2.conf","-v2"])
("/home/jim/bin/ghc",["--print-libdir"])
Reading available packages...
Resolving dependencies...
selecting
/usr/bin/cabal returned ExitFailure 1

Ha ha. Trying to catch the output with &2>file misses off "cabal: cannot configure bytestring-0.9.2.0. It requires ghc-prim -any...(same as before)"

  • Don't use cabal-dev for that, run cabal directly to have its output capturable. But don't forget the --dry-run. – Daniel Fischer Jan 05 '12 at 19:26
  • Oh, and actually more interesting than why it wouldn't reinstall bytestring is why it believes it should. Which package were you trying to install when these errors appeared? `$ cabal install -v3 --dry-run that-package` would be nice. – Daniel Fischer Jan 05 '12 at 19:34
  • cabal install -v3 --dry-run bytestring => cabal: cannot configure bytestring-0.9.2.0. It requires ghc-prim -any. There is no available version. IPkg ad depends on integer-simple [ – Jim Stuttard Jan 08 '12 at 10:55
  • cabal-install -v3 --dry-run ad => "cabal: cannot configure base-4.4.1.0. It requires ghc-prim -any, integer-simple -any and rts -any. There is no available version.." – Jim Stuttard Jan 08 '12 at 11:05
  • I tried to build ghc-7.2.2 src (using my installed ghc-7.2.2 binary) with integer-simple but. ./configure overwrites the config.mk edit. I now find I cannot install ghc-7.2.2 src with integer-gmp either. – Jim Stuttard Jan 08 '12 at 11:10
  • A second attempt produces the nonsense message: "Configuring Cabal-1.12.0... ghc-cabal: At least the following dependencies are missing base >=4 && <3 && >=2 && <5 filepath >= 1 && <3 unix >= 2 && <=2.6" make clean A third attempt produces: "Cabal-1.12.0... ghc-cabal: Cannot find the program hs-colour at '' or on the path" – Jim Stuttard Jan 08 '12 at 11:11
  • grep -r on the src tree returns config.mk and ghc.mk as the only references to integer-simple or $INTEGER_LIBRARY, ghc.mk has a conditional but I can't see where it's set. – Jim Stuttard Jan 08 '12 at 11:18
  • Don't edit `config.mk`, you must edit `config.mk.in`. The `config.mk` is generated from that. – Daniel Fischer Jan 08 '12 at 12:33
  • Reinstalling ghc-7.2.2-i386-unknown.linux.tar.bz2 produced an Error 2 which I hadn't noticed originally. make install => "utils/ghc-cabal/dist/install/build/tmp/ghc-cabal" install "/home/jim/lib/ghc-7.2.2/ghc" "/home/jim/lib/ghc-7.2.2/ghc-pkg" "strip" "/home/jim/lib/ghc-7.2.2" libraries/ghc-prim dist install (continued..) – Jim Stuttard Jan 08 '12 at 13:18
  • '' '/home/jim' '/home/jim/lib/ghc-7.2.2' '/home/jim/share/doc/ghc/html/libraries' NO Installing library in /home/jim/lib/ghc-7.2.2/package.conf.d/package-cache: openBinaryFile: does not exist (no such file or directory) make [1]*** [install packages] Error 1 make *** [install packages] Error 2 [ – Jim Stuttard Jan 08 '12 at 13:21
  • Despite the error, ghc had installed. I tried ghc-7.2.2-src.tar.bz2 – Jim Stuttard Jan 08 '12 at 14:57
  • Despite the error, ghc had installed. I tried ghc-7.2.2-src.tar.bz2 configure --prefix=$HOME/simple => "configure: building in-tree ghc-pwd \n /home/jim/lib/ghc-7.2.2/package.conf.d/package.cache openBinaryFile: does not exist...configure: Error: Building ghc-pwd failed" Tnx Daniel for the persistence. – Jim Stuttard Jan 08 '12 at 15:03
  • Sorry, I've lost view of the situation. Can you update the question and lay out the situation, what's installed where, what's working, what isn't? – Daniel Fischer Jan 08 '12 at 15:03
  • So the vanilla binary didn't create a package.cache file. – Jim Stuttard Jan 08 '12 at 15:05
  • Sorry if I've missed describing some steps. From wiping my entire ghc installation I installed vanilla ghc-7.2.2-i386-linux-unknown.tar.bz2. I noticed the error messages in 6th and 7th previous comments. This installed a working copy of ghc but not cabal which behaves as per the OP. Ignoring this I tried installing the ghc-7.2.2-src.tar.bz2, configure failed as per the 3rd previous comment. HTH. – Jim Stuttard Jan 08 '12 at 15:20
  • To repeat the experiment: apart from checking that I'd deleted all ghc including $HOME/share and removing $GHC_PACKAGE_PATH from .bashrc the vanilla ghc binary now installs fine. Will try and build an integer-simple version. – Jim Stuttard Jan 08 '12 at 15:48
  • Okay, that should work now, I think. If not, let me know. – Daniel Fischer Jan 08 '12 at 15:56
  • No go I'm afraid. Havin edited config.mk.in to integer-simple, configure --prefix=$HOME/simple then make install gives the same nonsense error message as before: "Configuring Cabal-1.12.0... ghc-cabal: At least the following dependencies are missing base >=4 && <3 && >=2 && <5". I don't know where this should be reported. – Jim Stuttard Jan 09 '12 at 12:32

1 Answers1

3

That message,

cabal: cannot configure base-4.4.1.0

means cabal is trying to reinstall base, or rather, fortunately it's not trying to actually do that (that's impossible, base is too tightly interwoven with the compiler, you absolutely positively cannot reinstall that). But you are trying to install something that would require reinstalling base.

The problem is that one (or more) of the packages you're trying to install depends on integer-simple. base depends on either integer-gmp or integer-simple. Both of these packages provide an implementation of the Integer type and some fundamental operations involving it, so you can have only one of these two. The default is integer-gmp because it's the one with far superior performance, and that's the one you have installed (and all[?] prebuilt binaries are built with that).

If you really need a package depending on integer-simple, you have to build GHC from source yourself (I recommend keeping the one with integer-gmp after the build nevertheless, you'd have to keep them in separate locations, though, if they're the same GHC version, e.g. the normal in ~/bin (and ~/lib), the other in ~/simple/$dir).

Building it from source is not really difficult, it does take a while, though. The procedure is

  1. download the source tarball and unpack it
  2. open mk/config.mk.in in an editor, change INTEGER_LIBRARY to integer-simple there and save
  3. $ cd ghc-7.2.2
  4. $ ./configure --prefix=$HOME/whereever/you/want/it
  5. $ make && make install
Daniel Fischer
  • 181,706
  • 17
  • 308
  • 431
  • Unfortunately cabal-dev install llvm returns: "cabal: cannot configure bytestring-0.9.0.2. It requires ghc-prim -any" but these are both installed There is no available version.."..I get this message with text, hledger and other packages which only depend on base. – Jim Stuttard Jan 05 '12 at 11:58
  • 1. Is that the vanilla binary or a newly built with integer-simple? 2. The error message is not helpful, a frequent problem with cabal, run it with higher verbosity to get more info, in particular, why on earth would it want to install such an ancient version of bytestring, unless you typo'ed the version, in which case, why would it want to reinstall that? Run `$ ghc-pkg check` to look for broken packages. – Daniel Fischer Jan 05 '12 at 12:17
  • The vanilla binary. Trying bytestring with cabal-dev install -v3 bytestring --reinstall produces: "cabal: cannot configure bytestring." and no available ghc-prim etc. As you say, cabal doesn't give any more info, even with -v3. I had just done a ghc reinstall. Tnx v. much for the assistance. – Jim Stuttard Jan 05 '12 at 18:58
  • cabal itself should tell you quite a lot with `-v3`, which package versions it selects and which it discards. To not muck anything up, make it a dry-run: `$ cabal install --reinstall -v3 --dry-run bytestring`. – Daniel Fischer Jan 05 '12 at 19:06
  • Have added the info in the OP. – Jim Stuttard Jan 05 '12 at 19:14
  • ghc-pkg check just lists my usual haddock warnings for missing docs. – Jim Stuttard Jan 05 '12 at 19:29
  • Posted build failure nonsense message to ghc trac as ticket #5765 – Jim Stuttard Jan 12 '12 at 10:13