[redirected to g-h-bugs list]
Pablo Andres Mocciola writes:
> I have a problem when I try to compile the following program
>
> >module Main where
> >
> >import Random
> >
> >main = do rs <- randomIO (1,10)
> > print (take 10 rs)
>
> The command line is
> >ghc2.10 -o rand Main.hs
>
> where ghc2.10 is the symbolic link to the compiler itself, and I get the
> following output
>
> >Module version unchanged at 1
> >/usr1/fcional/lib/ghc-2.10/libHS_cbits.a(getCPUTime.o): In function
> >`clockTicks':
> >getCPUTime.o(.text+0x1c): undefined reference to `getrusage'
>
> It is important to note that I have already tried with this well known hack
> >export LD_PRELOAD=/usr1/fcional/lib/ghcfix/getrusage.so
>
> Does someone know how to solve this problem?
Hi,
I'm guessing that you're compiling on a machine running Solaris 2.4
using a ghc-2.10 binary release (which was compiled up on a Solaris
2.5 box.) Here's how I suggest you work around the problem:
- compile the source file
ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/working/getCPUTime.c
with
mar% ghc-2.10 -O -c getCPUTime.c -o getCPUTime.o
which should give you an implementation of getCPUTime() that uses
times() instead of getrusage().
- replace the 2.10 supplied version of getCPUTime.o with the one
you've compiled up, i.e.,
mar% grep '^$libdir' `which ghc-2.10`
$libdir='/local/fp/lib/sparc-sun-solaris2/ghc-2.10';
mar% ar r /local/fp/lib/sparc-sun-solaris2/ghc-2.10/libHS_cbits.a getCPUTime.o
mar% ranlib /local/fp/lib/sparc-sun-solaris2/ghc-2.10/libHS_cbits.a
- try relinking your example.
Hope that helps,
--Sigbjorn