simultaneous ghc versions

Herbert Valerio Riedel hvriedel at gmail.com
Fri Jul 31 18:42:58 UTC 2015


On 2015-07-31 at 20:32:43 +0200, Evan Laforge wrote:
> On Fri, Jul 31, 2015 at 11:26 AM, Herbert Valerio Riedel
> <hvriedel at gmail.com> wrote:
>> Btw, I simply prepend to the $PATH env variable, or pass the appropriate
>> executable name to `cabal`'s
>>
>>    -w --with-compiler=PATH            give the path to a particular compiler
>
> I don't understand, aren't they all in /usr/local/bin?  Or do you use
> a version-specific prefix when installing each ghc version?

Sorry, I assumed this w/o saying;

I maintain and use myself

 https://github.com/hvr/multi-ghc-travis

which in fact uses version-specific install prefixes, resulting in the
`bin` folder being

 /opt/ghc/<version>/bin

> Also, ghc is not just the compiler, but also hsc2hs hpc runghc ghci
> ghc-pkg haddock-ghc.  At the least, ghc-pkg has to be the right
> version,

`cabal` is actually clever enough to locate the appropriate executable,
if I pass it a specific ghc executable (iirc it looks in the same folder
where `ghc` was found)

  $ which ghc-pkg
  /opt/ghc/7.10.2/bin/ghc-pkg
  
  $ which hsc2hs
  /opt/ghc/7.10.2/bin/hsc2hs
  
  $ cabal configure -w /opt/ghc/7.6.3/bin/ghc -v2
  ...
  Using ghc version 7.6.3 given by user at: /opt/ghc/7.6.3/bin/ghc
  Using ghc-pkg version 7.6.3 found on system at: /opt/ghc/7.6.3/bin/ghc-pkg
  Using hsc2hs version 0.67 found on system at: /opt/ghc/7.6.3/bin/hsc2hs
  ...


> but all of those are version specific since they'll break if
> you remove their /usr/lib/ghc-version.



More information about the Glasgow-haskell-users mailing list