
[colin@susannah ghc]$ ghc-pkg list /usr/local/lib/ghc-6.11.20090319/./package.conf: Cabal-1.7.0, array-0.2.0.1, base-3.0.3.0, base-4.0.0.0, bytestring-0.9.1.4, containers-0.2.0.1, directory-1.0.0.2, (dph-base-0.4.0), (dph-par-0.4.0), (dph-prim-interface-0.4.0), (dph-prim-par-0.4.0), (dph-prim-seq-0.4.0), (dph-seq-0.4.0), editline-0.2.1.0, ffi-1.0, filepath-1.1.0.1, gconf-0.10.0, (ghc-6.11.20090319), ghc-prim-0.1.0.0, gio-0.10.0, glib-0.10.0, haskell98-1.0.1.0, hpc-0.5.0.2, integer-0.1.0.0, old-locale-1.0.0.1, old-time-1.0.0.1, packedstring-0.1.0.1, pretty-1.0.1.0, process-1.0.1.1, random-1.0.0.1, rts-1.0, syb-0.1.0.0, template-haskell-2.3.0.0, unix-2.3.1.0 /home/colin/.ghc/x86_64-linux-6.11.20090319/package.conf: EdisonAPI-1.2.1, EdisonCore-1.2.1.3, HUnit-1.2.0.3, QuickCheck-1.2.0.0, cairo-0.10.0, game-tree-0.1.0.0, gconf-0.10.0, gio-0.10.0, glade-0.10.0, glib-0.10.0, gnomevfs-0.10.0, gstreamer-0.10.0, gtk-0.10.0, gtkglext-0.10.0, mozembed-0.10.0, mtl-1.1.0.2, parallel-1.1.0.0, parsec-2.1.0.1, parsec-3.0.0, soegtk-0.10.0, sourceview-0.10.0, svgcairo-0.10.0, time-1.1.2.3 [colin@susannah ghc]$ su -c 'cabal install parsec --global' Password: Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it. cabal: There is no package named parsec [colin@susannah ghc]$ su -c 'cabal install parsec-2.0.0 --global' Password: Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it. cabal: There is no package named parsec [colin@susannah ghc]$ cabal update Downloading the latest package list from hackage.haskell.org [colin@susannah ghc]$ su -c 'cabal install parsec-2.0.0 --global' Password: Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it. cabal: There is no package named parsec [colin@susannah ghc]$ cabal update --global unrecognized option `--global' Why does cabal install nearly everything in the user repository rather than the global repository? -- Colin Adams Preston Lancashire

Colin Paul Adams
Why does cabal install nearly everything in the user repository rather than the global repository?
uh... because you're a mere user and don't have the rights to do so? try "su -", then "cabal update" to fill root's $HOME/.cabal with the needed info, then proceed as usual. TBH, though, I wouldn't use cabal as root, directly, use your distro's package management system instead. Installing programs with your user account, inside your home directory, is perfectly acceptable (and traditional) under unix. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

"Achim" == Achim Schneider
writes:
Achim> Colin Paul Adams

Colin Paul Adams
Achim> uh... because you're a mere user and don't have the rights Achim> to do so?
No, I own the machine.
Well, but it neither knows nor cares, unless you log in as root. "colin" isn't allowed to write to /usr/local/lib/ghc-6.11.20090319/ . root's and colin's home directories are distinct, as well, that's why both need to do cabal update to install stuff: Users can't read root (or any other user's) home directories; root could read colin's home directory, but musn't trust any data in it, as colin could use that trust to weasel root access.
I can't. It doesn't provide up-to-date ghc and things.
<insert snappy switch-to-gentoo comment here>
Achim> programs with your user account, inside your home Achim> directory, is perfectly acceptable (and traditional) under Achim> unix.
But it means I have to install everyhting twice - once as --user, once as --global.
No, you don't, the database ghc uses to compile stuff is a union of both databases, user installs overriding global installs. Assuming that you're the machine's only user, you only ever need to install stuff as that user: ksf@solaris ~ % ghc-pkg list /usr/lib64/ghc-6.10.1/./package.conf: Cabal-1.6.0.1, HTTP-3001.1.4, QuickCheck-1.2.0.0, QuickCheck-2.1.0.1, X11-1.4.4, X11-xft-0.3, array-0.2.0.0, base-3.0.3.0, base-4.0.0.0, binary-0.4.4, bytestring-0.9.1.4, cairo-0.10.0, containers-0.2.0.0, directory-1.0.0.2, editline-0.2.1.0, filepath-1.1.0.0, filepath-1.1.0.1, gconf-0.10.0, (ghc-6.10.1), ghc-paths-0.1.0.5, ghc-prim-0.1.0.0, glade-0.10.0, glib-0.10.0, gtk-0.10.0, gtkglext-0.10.0, gtksourceview2-0.10.0, haddock-2.4.1, haskell-src-1.0.1.3, haskell98-1.0.1.0, hpc-0.5.0.2, html-1.0.1.2, integer-0.1.0.0, mozembed-0.10.0, mtl-1.1.0.2, network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1, packedstring-0.1.0.1, parsec-3.0.0, pretty-1.0.1.0, process-1.0.1.0, random-1.0.0.1, readline-1.0.1.0, regex-base-0.93.1, regex-compat-0.92, regex-posix-0.93.2, rts-1.0, soegtk-0.10.0, stm-2.1.1.2, svgcairo-0.10.0, syb-0.1.0.0, template-haskell-2.3.0.0, unix-2.3.1.0, utf8-string-0.3.3, zlib-0.5.0.0 /home/ksf/.ghc/x86_64-linux-6.10.1/package.conf: MemoTrie-0.4.3, bytestring-mmap-0.2.0, bytestring-trie-0.1.4, extensible-exceptions-0.1.1.0, ipprint-0.3, iteratee-0.1.1, mmap-0.2, regex-posix-0.72.0.3 I basically did emerge cabal-install to bootstrap my installation, then emerge gtk2hs as it's not available via hackage. Then, I install what I need to hack as user using cabal install. (I recently nuked my ~/.cabal and ~/.ghc, that's why the user database is that small). Installing ghc as user works equally well. -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

So why doesn't it find packages then, when they are installed? -- Colin Adams Preston Lancashire

Colin Paul Adams
So why doesn't it find packages then, when they are installed?
I've got no idea, what exactly are you trying to do, and how? -- (c) this sig last receiving data processing entity. Inspect headers for copyright history. All rights reserved. Copying, hiring, renting, performance and/or quoting of this signature prohibited.

"Achim" == Achim Schneider
writes:
Achim> Colin Paul Adams

On Sun, Mar 22, 2009 at 12:51 PM, Colin Paul Adams
"Achim" == Achim Schneider
writes: Achim> Colin Paul Adams
wrote: >> So why doesn't it find packages then, when they are installed? >> Achim> I've got no idea, what exactly are you trying to do, and Achim> how? I'm trying to re-compile ghc 6.11 and it doesn't find parsec.
when cabal is invoked by root, like in su -c "cabal ..." or su -c "runghc Setup ...", it won't see the user packagedb, but there's rarely a reason to do so. Usually only the install phase needs to be done as root, while building and configuring can be done as user. For ghc you'd want to run ./configure and make as user and make install as root. For normal packages, if you want to install them system wide, you'd use something like cabal install --global --root-cmd=sudo foo You can make those flags the default with user-install: False root-cmd: sudo in ~/.cabal/config If you still have problems it'd be interesting to see what are the initial commands that were failing in your attemt to build ghc-6.11.

I should clarify that cabal install --global won't see the packages installed in the user db, even if not run as root. But it at least will take into consideration the available packages' cache and the config file in ~/.cabal/

"Andrea" == Andrea Vezzosi
writes:
Andrea> On Sun, Mar 22, 2009 at 12:51 PM, Colin Paul Adams
Andrea>

On Sun, 2009-03-22 at 11:51 +0000, Colin Paul Adams wrote:
"Achim" == Achim Schneider
writes: Achim> Colin Paul Adams
wrote: >> So why doesn't it find packages then, when they are installed? >> Achim> I've got no idea, what exactly are you trying to do, and Achim> how? I'm trying to re-compile ghc 6.11 and it doesn't find parsec.
The ghc build system is fairly self contained. I'm not sure if it cares if your bootstrapping compiler has parsec or not. If the ghc build system is looking for the parsec modules then I very much doubt it is going to be looking in any parsec package that your bootstrapping compiler might have registered (either globally or per-user). It'll be looking for the sources that it comes bundled with. A quick look in my ghc source tree reveals: ghc/utils/ext-core/Language/Core/ParsecParser.hs ghc/libraries/parsec/Text/ParserCombinators/Parsec.hs The first one, utils/ext-core is importing parsec. Is that what you're trying to build? The parsec package is an extralib so wouldn't be present unless you did ./darcs-all --extra get If you can't get the ghc build going try asking on the ghc users mailing list. Give as much detail as you can about what you did so people can give you more helpful advice. Duncan

"Duncan" == Duncan Coutts
writes:
Duncan> On Sun, 2009-03-22 at 11:51 +0000, Colin Paul Adams wrote:
>> >>>>> "Achim" == Achim Schneider
So why doesn't it find packages then, when they are installed? >> >> Achim> I've got no idea, what exactly are you trying to do, and Achim> how? >> >> I'm trying to re-compile ghc 6.11 and it doesn't find parsec.
Duncan> The ghc build system is fairly self contained. I'm not Duncan> sure if it cares if your bootstrapping compiler has parsec Duncan> or not. If the ghc build system is looking for the parsec Duncan> modules then I very much doubt it is going to be looking Duncan> in any parsec package that your bootstrapping compiler Duncan> might have registered (either globally or per-user). It'll Duncan> be looking for the sources that it comes bundled with. Duncan> A quick look in my ghc source tree reveals: Duncan> ghc/utils/ext-core/Language/Core/ParsecParser.hs Duncan> ghc/libraries/parsec/Text/ParserCombinators/Parsec.hs Duncan> The first one, utils/ext-core is importing parsec. Is that Duncan> what you're trying to build? The parsec package is an No. I assumed that would be built anyway. Duncan> extralib so wouldn't be present unless you did ./darcs-all Duncan> --extra get Duncan> If you can't get the ghc build going try asking on the ghc Duncan> users mailing list. Give as much detail as you can about Duncan> what you did so people can give you more helpful advice. -- Colin Adams Preston Lancashire
participants (4)
-
Achim Schneider
-
Andrea Vezzosi
-
Colin Paul Adams
-
Duncan Coutts