Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GHC Install Without Root

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.

like image 913
sclv Avatar asked Nov 10 '11 18:11

sclv


People also ask

Where does Ghcup install GHC?

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.

Where is GHC installed?

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.


4 Answers

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.

like image 167
fuz Avatar answered Sep 22 '22 01:09

fuz


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.

like image 37
Daniel Fischer Avatar answered Sep 22 '22 01:09

Daniel Fischer


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.

like image 40
Nicole Avatar answered Sep 23 '22 01:09

Nicole


If you want to use stack to install ghc or ghci, follow this offical manual:

  1. download the tar.gz file from the release link (curl/wget/even scp can upload your local file to a remote server)
  2. extract the file with tar xvzf and enter the folder test if ./stack run properly
  3. add
export PATH="<stack_path>:$PATH"

to ~/.bashrc

Every time you start the terminal, do source ~/.bashrc

  1. install ghci locally
stack ghci

It will install ghci automatically and launch it.

like image 34
Xinyi Li Avatar answered Sep 26 '22 01:09

Xinyi Li