GHC 6.8.1 on Mac OS X 10.5 (Leopard)
Simon Marlow
simonmarhaskell at gmail.com
Mon Nov 19 04:35:20 EST 2007
Christian Maeder wrote:
> Ian Lynagh wrote:
>> On Sat, Nov 17, 2007 at 03:02:55PM +0000, C.M.Brown wrote:
>>>> Is there a way for GHC on OS X to find where it was run from, so that it
>>>> can find package.conf?
>>> The command:
>>>
>>> ghc --print-libdir
>>>
>>> should do it.
>> But the way that knows what to print on unix machines is that ghc is a
>> shell script wrapper which passes -B<libdir> to the real GHC binary. If
>> you want to be able to move GHC around then the wrapper can't have the
>> path hardcoded.
>
> The wrapper could call `pwd` to find out the current path.
pwd gives you the directory that the script was invoked *from*, not the
directory in which the script resides. This is a common problem on Unix:
there's no general way to find out the location of a binary.
Well that's not entirely true. On Linux you have /proc/<pid>/exe, and on
Solaris you have getexecname(). Does MacOS X have anything?
Cheers,
Simon
More information about the Glasgow-haskell-users
mailing list