[Haskell-beginners] can run in ghci but can't compile.
Daniel Fischer
daniel.is.fischer at web.de
Mon Mar 30 14:13:24 EDT 2009
Am Montag 30 März 2009 19:54:28 schrieb Anand Mitra:
> That does the job, Thanks !!
>
> Just to understand what is happening under the hood I tried to resolve this
> to the exact steps. The problem I faced seems to be equivalent of missing a
> -L and -l in gcc. Looking at the man for ghc I did find it had the -l and
> -L flags. Now I had to find the path and the name of the library. Did a
> find over the location I have installed ghc I was able to short list the
> likely candidates.
>
> ,----
>
> | find /opt/ghc-6.10.1/ -type f |grep \\.a$
> | ....
>
> /opt/ghc-6.10.1/lib/ghc-6.10.1/bytestring-0.9.1.4/libHSbytestring-0.9.1.4.a
>
> /opt/ghc-6.10.1/lib/ghc-6.10.1/bytestring-0.9.1.4/libHSbytestring-0.9.1.4_p
>.a
>
> | ....
>
> `----
>
> and as expected adding the -l and -L in the ghc command line does the
> trick.
>
> /opt/ghc-6.10.1/bin/ghc
> -L/opt/ghc-6.10.1/lib/ghc-6.10.1/bytestring-0.9.1.4/ -lHSbytestring-0.9.1.4
> cp.hs
>
> regards
Or, simpler:
ghc -package bytestring -o anfile anand.hs
but I strongly recommend using --make for every compilation unless you know
that you really do *not* want it.
More information about the Beginners
mailing list