<div dir="ltr"><div dir="ltr"><div>Hi Simon,</div><div><br></div><div>The direct answer to your particular problem is that cabal-install-3.10.1 (which you're using) does not add `base` in the package environment created by `install --lib` by default. <br></div><div>So, to fix the problem you'd need to say `cabal install --lib base hashtables primitive` instead.</div><div>Better yet, you could upgrade your cabal-install to version 3.10.3 (recommended by GHCup), where this behavior was reversed (base is added by default).</div><div><br></div><div>To add to how brittle `install --lib` is: the 3.10.1 behavior (no base by default) bothered people [1] and was changed in 3.10.3 [2]. But the 3.10.3 behavior (add base by default) also bothers people [3]!</div><div>And note that although you have an easy way to solve your issue (add base in the list of libraries in the call to install --lib), the users of 3.10.3 who don't want base added by default don't have such an easy way.</div><div>(By easy I mean using only cabal CLI and don't edit env files manually, for example.)<br></div><div><br></div><div>More general, I think, it's possible to develop a mental model for today's `install --lib` (either 3.10.1 or 3.10.3, doesn't matter in the grand scheme),</div><div>and use it effectively for "little experiments" as advocated by Richard in the above-mentioned issue [4] (note that the issue was solved since!).</div><div>The prerequisite for that is to understand GHC environment files and that `install --lib` is mostly a (n incomplete) CLI interface to them.<br></div><div><br></div><div>Yet, people argue for a more holistic "environment" experience, see, e.g., the above mentioned [5] (<i>the</i> cabal-env issue)<br></div><div>or a very recent push from the old cabal sandboxes perspective: <a href="https://github.com/haskell/cabal/issues/10098">https://github.com/haskell/cabal/issues/10098</a> <br></div><div>or this thread :-)<br></div><div><br></div><div>Also, (much in the spirit of <i>Carthago delenda est</i>) I try to conclude my every reply about install --lib with what's already mentioned by Tom: <br></div><div><b>always</b> use `cabal install --lib` with `--package-env=.` It will save you a bunch of pain related to the "global state" (not all of it, perhaps).</div><div><br></div><div>--</div><div>Best, Artem<br></div><div><br></div><div>[1]: <a href="https://github.com/haskell/cabal/issues/8894">https://github.com/haskell/cabal/issues/8894</a></div><div><div dir="ltr"><div>[2]: <a href="https://github.com/haskell/cabal/pull/8903">https://github.com/haskell/cabal/pull/8903</a><div dir="ltr"><div>[3]: <a href="https://github.com/haskell/cabal/issues/9672">https://github.com/haskell/cabal/issues/9672</a></div><div>[4]: <a href="https://github.com/haskell/cabal/issues/7832">https://github.com/haskell/cabal/issues/7832</a></div><div>[5]: <a href="https://github.com/haskell/cabal/issues/6481">https://github.com/haskell/cabal/issues/6481</a></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jul 9, 2024 at 4:58 AM Simon Peyton Jones <<a href="mailto:simon.peytonjones@gmail.com">simon.peytonjones@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:tahoma,sans-serif">Friends</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">I'm trying to repro #25064 with my development build of GHC.  The test case depends on packages `primitive` and `hashtables`.  So I try this (see below).</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">Alas, apparently after the `cabal install`, it can't find Prelude.</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">What should I do?  I tried removing the "environments" file, whatever that is, which then meant it could find Prelude -- but the libraries were no longer installed.</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">I lack a decent model of what is going on with installing packages for my development builds.   Is there a write up anywhere?</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">Thanks</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif">Simon</div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif"><br></div><div style="font-family:tahoma,sans-serif"><span style="font-family:monospace">bash$ cabal install --lib hashtables primitive --with-compiler $HOME/code/HEAD/$s2<br>Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.10.1.0 supports<br>'ghc' version < 9.8): /home/simonpj/code/HEAD/_build/stage1/bin/ghc is version<br>9.11.20240517<br>Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.10.1.0 supports<br>'ghc' version < 9.8): /home/simonpj/code/HEAD/_build/stage1/bin/ghc is version<br>9.11.20240517<br>Resolving dependencies...<br></span>
<span style="font-family:monospace">bash$ </span><span style="font-family:monospace"> ~/code/HEAD/$s2 -c T25064.hs<br>Loaded package environment from <br>T25064.hs:1:8: error: [ ]8;;<a href="https://errors.haskell.org/messages/GHC-87110" target="_blank">https://errors.haskell.org/messages/GHC-87110</a> \GHC-87110 ]8;; \]<br>    Could not load module ‘Prelude’.<br>    It is a member of the hidden package ‘base-4.20.0.0’.<br>    Use -v to see a list of the files searched for.<br>  |<br>1 | module Bug where<br>  |        ^^^<br><br>bash$ rm /home/simonpj/.ghc/x86_64-linux-9.11.20240517/environments/default<br>bash$ ~/code/HEAD/$s2 -c T25064.hs<br>T25064.hs:3:1: error: [ ]8;;<a href="https://errors.haskell.org/messages/GHC-61948" target="_blank">https://errors.haskell.org/messages/GHC-61948</a> \GHC-61948 ]8;; \]<br>    Could not find module ‘Control.Monad.Primitive’.<br>    Perhaps you meant Control.Monad.Writer (from mtl-2.3.1)<br>    Use -v to see a list of the files searched for.<br>  |<br>3 | import Control.Monad.Primitive<br>  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br><br>T25064.hs:4:1: error: [ ]8;;<a href="https://errors.haskell.org/messages/GHC-87110" target="_blank">https://errors.haskell.org/messages/GHC-87110</a> \GHC-87110 ]8;; \]<br>    Could not find module ‘Data.HashTable.ST.Basic’.<br>    Use -v to see a list of the files searched for.<br>  |<br>4 | import qualified Data.HashTable.ST.Basic as H<br>  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^<br><br><br></span></div></div>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div></div>