Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Haskell program that I want to run on my school's cluster, but their version of GHC is too old and they won't update it. I want to somehow package it with my source code, but by default it requires running an install script. Is there a way for me to get an up-to-date Haskell compiler executable that will still work if I send it to another machine?

I could just cross-compile my code locally and send the executable over, but I'd rather it be buildable on the cluster itself.

share|improve this question
add comment

migrated from stackoverflow.com Sep 28 '12 at 5:23

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 10 down vote accepted

When I had this problem, I just installed GHC in my home directory:

$ wget http://www.haskell.org/ghc/dist/7.6.1/ghc-7.6.1-i386-unknown-linux.tar.bz2
$ tar xjvf ghc-7.6.1-i386-unknown-linux.tar.bz2
$ cd ghc-7.6.1-i386-unknown-linux
$ ./configure --prefix=/home/user/bin/ghc-7.6.1
$ make install
$ export PATH=/home/user/bin/ghc-7.6.1/bin:$PATH

After that you'll be able to use the latest GHC on your account.

share|improve this answer
2  
Until recently, I had roughly ten GHCs installed on my system, most of them under my home directory. :] –  camccann Sep 28 '12 at 0:28
    
Thank you! Ideally, I'd like for it to be possible for any user to compile my program through make in my source directory, but this is a step up! –  Matthew Piziak Sep 28 '12 at 0:30
2  
@MatthewPiziak if you make your local ghc install globally readable (and executable where appropriate), any user would be able to use it as long as they have the path. –  John L Sep 28 '12 at 1:44
    
Oh! How would I do that? chmod on the executable? –  Matthew Piziak Sep 28 '12 at 2:23
1  
Precisely, and also the libraries. Using the install directory from this answer, the quick-and-dirty solution is chmod -R o+rX /home/user/bin/ghc-7.6.1. Of course /home/user/bin also needs to be readable. You'll probably want to adjust your cabal preferences to install libraries to the global db by default as well, since the "global db" is actually local to each ghc install. Then when you install a package to your local ghc's global db, everyone else using your ghc will have access also. –  John L Sep 28 '12 at 4:42
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.