So I'd like to set up a linux machine for Haskell development with one huge caveat -- no root privs on this machine. We could of course get the admins to install GHC for us, eventually. However, in the long-term then we need to hassle them when we want to upgrade, etc. So much better to do everything in userland. Which also means that we'll want to install c libs we link to in userland as well, etc. to keep everything as hassle-free as possible.
So, the question is, how, soup-to-nuts, would I go about doing a purely userland install of GHC? The machine will have gcc, and the usual toolchain. If necessary, we can start with a typical ghc install to get the ball rolling, but it would be nice not to.
Additionally, any tips on managing an environment like this would be appreciated, especially involving how such a setup can be manageable with multiple devs/accounts.
Installation. The following commands will download the ghcup binary into ~/. ghcup/bin (or C:\ghcup\bin on windows) and then run it to interactively install the Haskell Toolchain.
On Windows, all of GHC's files are installed in a single directory. You can override it, but by default this directory is c:/ghc/ghc- version . The executable binary for GHC will be installed in the bin/ sub-directory of the installation directory.
I did this too. I created a directory ~/usr
and passed --prefix=$HOME/usr
to all configure scripts. Using the Haskell Platform makes this process even smoother.
You obviously need a directory that all pertinent users have at least read permission on. Say /home/foo, with subdirectories bin, lib, share, .cabal. Then ./configure --prefix=/home/foo
and make && make install, and make sure that /home/foo/* is before /usr/* in everybody's PATH, LIBRARY_PATH etc. You should probably start with installing gcc and c-libs there, and when everything C is installed, install ghc.
I managed to install ghc through stack by following these instructions. It worked like a charm; the only additional thing I had to do was to install the GMP library and to add it to the LD_LIBRARY_PATH
.
If you want to use stack to install ghc
or ghci
, follow this offical manual:
tar.gz
file from the release link (curl
/wget
/even scp
can upload your local file to a remote server)tar xvzf
and enter the folder test if ./stack
run properlyexport PATH="<stack_path>:$PATH"
to ~/.bashrc
Every time you start the terminal, do source ~/.bashrc
ghci
locallystack ghci
It will install ghci
automatically and launch it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With