Find the ghc binary path from libdir

Fendor power.walross at gmail.com
Mon Feb 8 18:35:12 UTC 2021


Hello everyone!

I want to find out the location of the `ghc` (and `ghc-pkg`) executable 
given the `$libdir` (obtained by `ghc --print-libdir`).
Is there a platform independent way of doing that, which we can rely on?

E.g. on windows, we found that the ghc executable's location is:

* `$libdir/../bin/ghc`

For NixOs (or when using ghcup), it works with:

* `$libdir/../../bin/ghc`

but I worry that this is a just an accident that is not guaranteed by 
the installation process.

I also noticed there seems to be a binary in

* `$libdir/bin/ghc`

Is one of these ways documented to be guaranteed by the ghc installation 
process?

(P. S. first time using a mailing list, hope I am doing it correctly)

Best regards,
Fendor



More information about the ghc-devs mailing list