Confusion about ghc-update resp. version [solved]

Hi,

right now I am running ghc 8.0.2. This seems to cause a problem I have with atom (no console available). So I was told an update might resolve this issue.

But checking the installed packages I see the following installed:

  • ghc (version 8.0.2)
  • ghc-8.6.4 (as it says: 8.6.4) (so I have it but it does not seem to get used)

Now I thought I just get rid of the package ghc but then synaptic tells me it will also remove cabal-install which came with the Tidal installation (following the userbase article about installation).

So now I am confused. I assume, if I do not have cabal-install I will not be able to update Tidal if necessary. So this somehow seems to be a cat chasing its tail.

Can someone point me into the right direction?

for building from source, see https://github.com/haskell/cabal/blob/master/README.md

you can bootstrap (use your old ghc and cabal to cabal install cabal-install - it will land in $HOME/.cabal/bin and stay there, independent from system packages). but from 8.0.2 (really ancient!) it may need several rounds. you can build current cabal-install from source (there is a bootstrap shell script in the source distro)

or if you have faith in binaries ... you can do the curl | bash thing (ghcup), cf. discussion (on the general method) at https://news.ycombinator.com/item?id=25356757

NB: I am currently experiencing all sorts of interesting installation problems because I use several Haskell packages (csound-expression, Euterpea, Tidal) in teaching. I do have them installed in the computer pool, but since COVID, students have to do all this on their own machines. Unsurprisingly, if you get X people, you get 2*X different machines (including various VMs) ... I am looking into x2go for remote access to said computer pool - this works, and can even transport audio - but only pulse-audio, not jack, at least I haven't figured that out. (I should make a separate topic of this probably.)

1 Like

Hi @jwaldmann,

first, thanks for you help.

I am still confused and might have messed up my (tidal) installation. Although... maybe not.

First thing I wanted to correct was, to use the newer ghci I could install via apt. I noticed, ghc and ghci are symlinks. I changed this and now I have ghci -> /opt/ghc/bin/ghci-8.8.4 and ghc -> ghc-8.0.2. So I get:

$ ghci
GHCi, version 8.8.4: https://www.haskell.org/ghc/  :? for help

That's ok, right?

I then installed cabal like you proposed and do now also have an installation in $HOME/.cabal I could update and install Tidal, which I can see under packages. (If I remember correctly, the rookie that I am, I did remove the cabal folder under /opt which probably was a bad idea.)

But if I check with import Sound.Tidal.Context at the ghci prompt I get:

Prelude> import Sound.Tidal.Context

<no location info>: error:
    Could not find module ‘Sound.Tidal.Context’
    It is not a module in the current program, or in any known package.

So obviously my tidal installation is not found by Haskell. I tried to fix this assuming the problem is that I must tell ghci where to find cabal (GHCi 8.8.4 is installed under /opt and already contained a symlink to cabal as well as /usr/bin did) so I now have all $ whereis cabal-findings /usr/bin//cabal and /opt/ghc/bin/cabal linked to $HOME/.cabal/bin

Now, was that stupid and do I have remove all and start from the beginning (wherever this is) or can I fix this?

ghci version

yes 8.8.4 is fine (8.10.2 would work, too)

I am not used to what I assume is the GUI of (I assume) Ubuntu GNU/Linux - I only trust the command line ... can you do (in the shell where you typed ghci)

which ghci
which ghc-pkg
which cabal
ghc-pkg list -f ~/.cabal/store/ghc-$(ghc --numeric-version)/package.db tidal

For me, the last command shows

/home/waldmann/.cabal/store/ghc-8.8.4/package.db
    tidal-1.6.1

If this works, then ghci should find it. The other commands are just for debugging.

I should add that this is just my way of doing it - based on the exact ghc-pkg command from the emacs mode for Tidal (but maybe not in the current version - https://github.com/tidalcycles/Tidal/issues/706#issuecomment-673609710)

People with more experience in teaching (TIdal for non CS people) may have come to the conclusion that some other way works better.

Hi @jwaldmann,

thanks for the time you put into this.

Sorry, I should have been more clearly, I meant:

ls ~/.cabal/packages/hackage.haskell.org

amongst other lists /tidal; so I thought Tidal must have been installed with my new cabal-installation residing in my home dir.

$ which ghci
/usr/bin/ghci

Which is a link: ghci -> /opt/ghc/bin/ghci-8.8.4

$ which ghc-pkg
/usr/bin/ghc-pkg

Which is a link: ghc-pkg -> /opt/ghc/8.8.4/bin/ghc-pkg

(Actually it was linking to /usr/bin/ghc-pkg-8.0.2, so I changed that a few minutes ago in the hope that this would fix everything. It did not ... yet.)

which cabal                            
/usr/bin/cabal

Which is a link: cabal -> /home/[my home]/.cabal/bin/cabal

And finally I can see that:

ghc-pkg list -f ~/.cabal/store/ghc-$(ghc
ghc            ghci           ghc-pkg                                  
ghc-8.0.2      ghci-8.0.2     ghc-pkg-8.0.2

... does not offer ghci-8.8.4 as option so there is something wrong here.

Another try to install Tidal tells the following:

$ cabal install tidal
cabal: Version mismatch between ghc and ghc-pkg: /usr/bin/ghc is version 8.0.2
/usr/bin/ghc-pkg is version 8.8.4

So now I linked /usr/bin/ghc to / opt/ghc/8.8.4/bin/ghc and at least I have a tidal installation that is found.

Alas ... this is seemingly a longer story. Atom complains but is running tidal code as far as I see; still it does not show the console (which was the one of my initial issues).

Emacs is no longer running tidal code
<interactive>:36:3: error: Variable not in scope: d4 :: t5 -> t4

<interactive>:36:8: error:
    • Variable not in scope: sound :: [Char] -> t5
    • Perhaps you meant ‘round’ (imported from Prelude)

<interactive>:37:6: error:
    Variable not in scope: (#) :: t4 -> t6 -> t3
[...]

... so I will have to investigate this more thoroughly but right now I am just to tired.

Thanks again for your time and patience!

Can't say I knew what I was doing but after some googling a cabal v1-install tidal solved the problem. I still have no console in Atom but Emacs and Tidal are working together again.

@jwaldmann, by the way, have you ever noticed Emacs getting slow and laggy while running tidal-mode? (I know, this can have multiple reasons - and it wasn't this one - but maybe there is an obvious one.)

Hi @mbutz. Well, I'm glad you got it working.

Emacs getting slow - now, haven't noticed that. But I'm not doing any serious Tidal programming these days. I probably never did - just short snippets, mainly for teaching.

The situation with cabal is (or at least appears as) a mess. In particular, the v1 method, which sometimes looks lik the only one to really work, is now officially non-existent, see https://mail.haskell.org/pipermail/haskell-cafe/2020-December/133162.html .

That whole thread shows that the community is aware, but there's no easy solution because the problem (reproducible builds, exact versioning of transitive dependencies, sharing of build artifacts) has a many non-trivial design choices. To me this seems a lot like GHC's type system: it is advanced (appearing complicated) on purpose - because other languages have done "easy" already.

1 Like