
Hi, I can run the following program in the interpreter ghci but can't compile it. The program I am trying to compile is a simple copy using the lazy bytestrings. I have been working out exercises from Real World haskell and I was benchmarking this version which is supposed to be optimum. ,---- | import qualified System as S | import qualified Data.ByteString.Lazy as L | | main = do | [from, to ] <- S.getArgs | file <- L.readFile from | L.writeFile to file `---- While trying to compile this i get the following errors. ,---- | mitra@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': | (.text+0xe1): undefined reference to `bytestringzm0zi9zi1zi4_DataziByteStringziLazzy_readFile_closure' | cp.o: In function `sB5_info': | (.text+0x30f): undefined reference to `__stginit_bytestringzm0zi9zi1zi4_DataziByteStringziLazzy_' | cp.o: In function `sB5_srt': | (.data+0x4): undefined reference to `bytestringzm0zi9zi1zi4_DataziByteStringziLazzy_readFile_closure' | cp.o: In function `sB5_srt': | (.data+0x8): undefined reference to `bytestringzm0zi9zi1zi4_DataziByteStringziLazzy_writeFile_closure' | collect2: ld returned 1 exit status | mitra@ravan:~/laptop/haskell/learn$ rm cp.o | mitra@ravan:~/laptop/haskell/learn$ /opt/ghc-6.10.1/bin/ghc cp.hs | cp.o: In function `sB0_info': | (.text+0xab): undefined reference to `bytestringzm0zi9zi1zi4_DataziByteStringziLazzy_writeFile_closure' | cp.o: In function `sAV_info': `---- But this program is not syntactically or otherwise flawed since I can run it under ghci. ,---- | mitra@ravan:~/laptop/haskell/learn$ /opt/ghc-6.10.1/bin/ghci | GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help | Loading package ghc-prim ... linking ... done. | Loading package integer ... linking ... done. | Loading package base ... linking ... done. | Prelude> :l cp.hs | Ok, modules loaded: Main. | Prelude Main> :main /etc/passwd /tmp/xyz | Loading package bytestring-0.9.1.4 ... linking ... done. | Loading package unix-2.3.1.0 ... linking ... done. | Loading package filepath-1.1.0.1 ... linking ... done. | Loading package old-locale-1.0.0.1 ... linking ... done. | Loading package old-time-1.0.0.1 ... linking ... done. | Loading package directory-1.0.0.2 ... linking ... done. | Loading package process-1.0.1.0 ... linking ... done. | Loading package syb ... linking ... done. | Loading package array-0.2.0.0 ... linking ... done. | Loading package random-1.0.0.1 ... linking ... done. | Loading package haskell98 ... linking ... done. | Prelude Main> `---- Since I suspect that this might be a problem with the way I have installed gch-6.10.1 I will explain how I have installed it.