[Haskell-beginners] can run in ghci but can't compile.

Anand Mitra mitra at kqinfotech.com
Mon Mar 30 13:54:28 EDT 2009

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

| find /opt/ghc-6.10.1/ -type f |grep \\.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-
-lHSbytestring- cp.hs

Anand Mitra

On Mon, Mar 30, 2009 at 10:45 PM, Brandon S. Allbery KF8NH <
allbery at ece.cmu.edu> wrote:

> On 2009 Mar 30, at 13:12, Anand Mitra wrote:
> ,----
> | mitra at ravan:~/laptop/haskell/learn$ /opt/ghc-6.10.1/bin/ghc cp.hs
> | cp.o: In function `sB1_info':
> | (.text+0xab): undefined reference to
> `bytestringzm0zi9zi1zi4_DataziByteStringziLazzy_writeFile_closure'
> | cp.o: In function `sAW_info':
> Use "ghc --make".  ghci does this automatically.
> --
> brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
> system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
> electrical and computer engineering, carnegie mellon university    KF8NH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090330/d84382e8/attachment-0001.htm

More information about the Beginners mailing list