Reputation: 125
I am trying to use the Quantum Programming language Quipper, and I am running into issues due to the version of GHC I am using:
root@ubuntu:~$ apt-show-versions ghc
ghc:amd64/xenial 7.10.3-7 uptodate
ghc:i386 not installed
As it turns out, 7.10 is the only version that Quipper cannot compile with.
I then discovered that apparently the only way to install Haskell 8.0 was using haskell-stack. Ok, I've never installed something on a stack, so this will go over well.
So I used the instructions on this website to install haskell-stack, then ran the commands:
root@ubuntu:~$ stack setup
root@ubuntu:~$ stack update
root@ubuntu:~$ stack install ghc
The last command returned the following:
Didn't see ghc-8.0.2 in your package indices.
Updating and trying again.
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc Selected mirror https://s3.amazonaws.com/hackage.fpcomplete.com/
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc Downloading timestamp
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc Downloading snapshot
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc Updating index
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc Updated package list downloaded
Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpc Populated index cache.
The following package identifiers were not found in your indices: ghc-8.0.2
Perhaps you meant AAI, AAI, AAI, AES, AES, AES, AES, AES, AES, or AES?
So, a quick check again:
root@ubuntu:~$ apt-show-versions ghc
ghc:amd64/xenial 7.10.3-7 uptodate
ghc:i386 not installed
Nope, still 7.10. Tried also to download the package from this website. The package failed to be extracted, so that's a good sign. Rinsed and repeated the above commands, and still nothing. Then I edited the stack.yaml file to say:
resolver: lts-9.14
resolver: ghc-8.0.2
Did absolutely nothing. What step am I missing? Its frustrating when people basically say "the stack does everything for you" and I'm like "what exactly am I supposed to do?"
EDIT
As I said above, downloading the package for 8.0.2 from haskell.org gives fails to extract the archive:
Upvotes: 1
Views: 6261
Reputation: 2040
Don't jump into installing the binaries directly. While, as others mentioned, stack isn't the only way, it is certainly one of the easier ones.
So first thing, stack setup
actually downloads GHC for you based on the resolver it finds. If you are not in a stack project, it'll default to the global stack config. On the other hand stack install
is used for installing packages. That means doing stack install ghc
is trying to look for a package on stackage that's called ghc, of which I don't think there are any.
To run the GHC that stack installed, you'll do stack ghc
and to get a GHCi session, stack ghci
(generally just prefix with stack).
You could also run the general stack exec -- ..
to run a command with stack's path variables. E.g. stack exec -- ghci
will work here as well, or stack exec -- ghc --version
to get the GHC version.
Upvotes: 2
Reputation: 64740
Binary distributions of GHC can be obtained from GHC HQ:
Any suggestion that any one tool is necessary to obtain GHC is wrong.
EDIT: On a nix computer, for example, one can do the following (approx, not tested):
wget https://downloads.haskell.org/~ghc/8.2.2/ghc-8.2.2-x86_64-deb8-linux.tar.xz
tar xJf ghc-8.2.2*
cd ghc*
./configure --prefix=$HOME
make install
If you don't like portable shell and really want to use apt then consider using hvr's PPA which is pretty darn popular.
Upvotes: 1