How does one install Haskell from source (on Red Hat) now?
The current page has broken links and conflicting advice.
From http://www.haskell.org/platform/linux.html
Get and install GHC 7.6.3 prior to building the platform
From http://www.haskell.org/ghc/download_ghc_7_6_3
For most users, we recommend installing the Haskell Platform instead of GHC. The current Haskell Platform release includes a recent GHC release as well as some other tools (such as cabal), and a larger set of libraries that are known to work together.
(the link to cabal-install is broken).
The broken link should be pointing to http://www.haskell.org/haskellwiki/Cabal-Install instead. If you want to install from source, you're first going to have to compile and install GHC from source, then you can install the Haskell Platform from its source.
I'm not really sure what conflicting information you're seeing, if you want to build from source you have to install GHC first. Alternatively, you can just install the Haskell Platform from the distributable (might not be possible on Red Hat) and it'll install GHC for you. Both are pretty straightforward.
Related
I'm trying to install the accelerate library from hackage, but it keeps giving me an error saying that my version of base package (4.15.1.0) is too new. Is there a way to force it to ignore the base package that's installed as a system-wide package, and instead download the correct version of the base package?
I'm using Manjaro Linux, ghc version 9.0.2, and cabal version 3.4.0.0. I can't seem to find any documentation on how to force it to ignore a system package. I've tried searching on https://cabal.readthedocs.io/en/3.6/ , but it doesn't seem to mention it anywhere.
The base package is always hard-fixed to the compiler version. The only way to switch base is to switch to a different GHC. That's easier with Stack than it is with Cabal-install – just select a snapshot that has a suitable base version (lts-18.24 would do), and Stack will automatically install the corresponding compiler.
But it could well be that you can actually use base-4.15, and just accelerate has conservative dependency bounds. Try installing it with --allow-newer=base. If that works, give the maintainers a PR that the version bounds can be relaxed.
I've just spent about an hour going in circles trying to get version 2 of Cabal. Initially I found that the version that came with my LinuxMint install was version 1, so I tried cabal update, didn't do it. So I found instructions which said to use cabal install Cabal cabal-install. Did it, got an error. Found that the error apparently had to do with using the most current version of Haskell. So I installed version 7 to get Cabal. Seemed to work, looked like I finally got Cabal version 2. But I also want the most current version of Haskell so I downloaded the binaries for it and installed that again--now it seems like Cabal is set back to version 1. Is it not possible to have both version 8 of Haskell and version 2 of Cabal?
Along the lines of danidiaz's comments, I suggest directly installing cabal-install in your home directory.
Begin by making sure you are actually using the 8.x version of GHC you want (use which ghc and ghc --version if need be). Also, get rid of any other cabal-install versions you might have installed, so that there is less margin for confusion.
The [directory] ~/.cabal/bin is not in my PATH variable, should I put it in toward the front of its definition?
Exactly. ~/.cabal/bin is the default location for executables locally installed with cabal-install, which includes cabal-install itself, and so it must be in the PATH. Putting it towards the front of the PATH will give it priority over any system-wide installation of cabal-install installed with your package managers. (Note that that won't be an issue if you remove said system-wide installation beforehand.)
Once the terrain is clear, you can download a suitable binary tarball from Cabal's download page, extract the executable and put it in ~/.cabal/bin. As danidiaz notes, the binaries there aren't necessarily at the latest stable version (as I write this, the Linux binaries are 2.2.0.0 rather than 2.4.0.0), but that likely won't matter, as once you have some version of cabal-install available you can simply run...
cabal new-update # For version 2.4 or above; if not, use cabal update instead.
cabal new-install cabal-install
... which will update your cabal-install to the latest stable version.
(Note that I'm using the new-* cabal-install commands. I strongly advise you to do the same.)
Also, looking through the Cabal folder, I don't see binaries. The only folders present are Distribution, Language, tests, and doc.
It sounds like you downloaded the sources of Cabal, the library, rather than the ones of cabal-install, the tool. The cabal-install sources are also available from the download page linked above (as I write this, their version is 2.4.0.0). If you are getting them from GitHub instead, you should look into the cabal-install directory, rather than the Cabal one. Either way, once yo are in the appropriate directory, to install from source run...
./bootstrap.sh --sandbox
... which only requires GHC (as opposed to a pre-existing cabal-install). Once it finishes building cabal-install, the script will tell you the location of the executable (presumably in a .cabal-sandbox/bin subdirectory). Copy the executable to ~/.cabal/bin and proceed as before.
I've installed the Haskell platform which came with the 7.10.2 version of ghc and the 1.22.6.0 version of cabal. My favorite editor is Atom, so I've installed the ide-haskell and haskell-ghc-mod. Since the ghc-mod has some problems with cabal>=1.22, I need to downgrade cabal. Haskel platform came with an activate-hs script to switch versions but I didn't understand how it works.
The ./activate-hs script only switches between different already installed platform versions. So if you don't have a prior version of the platform installed it won't help. More generally, you should not probably not downgrade cabal versions, as often compilers are coupled to particular releases of cabal.
But if you did want to, the correct way would just be to create a sandbox and then run cabal-install cabal-install-1.20.2.0 or the like. You can then take the resultant binary and move it into your path directly.
I am kind of new Eclipse user, and Haskell too. I keep trying to understand what is wrong and what to do, as my Eclipse after I installed Haskell platform keeps me saying following
Configuring Test1-0.1...
buildwrapper: Left over temporary directory not removed: /tmp/dynamic-cabal.23
<command line>: cannot satisfy -package Cabal-1.22.0.0
I tried it on Ubuntu and Archlinux. Same behaviour. I have also read a lot of forums, and there is kind of information about GHC versions, cabal versions, and buildwrapper versions issues, but I could not figure how to fix that thing...
For example like here https://github.com/JPMoresmau/BuildWrapper/issues/18
I tried cabal install cabal-install Eclipse started to behave a little different, cycling this over and over and over...
configuring because setup_config not present
Resolving dependencies...
Configuring Test1-0.1...
Any help please...
I do not know if it qualify for answer, I hope so.
The problem was that when I install GHC from standard ubuntu and arch repository, it installs Cabal-1.18.1.5 and Cabal-Install-1.22.0.0 system wide. And this causing EclipseFP plugin to install buidwrapper version which was supposed to work with 1.22 Cabal, while I actually had 1.18. Eclipse setting for Haskell said I had Cabal 1.22 (which was wrong).
What I did is added ArchHaskell repository, and installed everything from there, which got me 1.18 combo of Cabal and Cabal-install. EclipseFP worked it OK, finally.
I think there was a way to move local install up in hierarchy so EclipseFP would pick it up. But I understood it may be too late.
I have installed the Haskell Platform through MacPorts. Although many Haskell libraries are available as MacPorts packages, some are not. What is the proper way to install them? (without inconsistencies or duplications)
Use cabal
cabal install <packagename>
One nice thing about cabal is, by default, it puts stuff in ~/.cabal/, so you won't have to worry about it conflicting with your system files.