[darcs-devel] Running darcs in GHCi
Wim Lewis
wiml at hhhh.org
Fri Feb 9 21:20:22 PST 2007
On Feb 8, 2007, at 8:13 PM, Zachary P. Landau wrote:
> That being said, I still wouldn't mind if I could load darcs through
> ghci when testing. Is that just a pipe dream, given the dependencies
> that darcs pulls in and whatnot, or have others gotten it to work with
> recent versions?
Well, it seemed to me that it should work, since ghci does
dynamically load ffi objects (as well as ghc-compiled haskell
modules). After fiddling with it a little bit I've managed to run
darcs in ghci. It works well enough to do a "darcs pull", incorporate
some patches from darcs-unstable, then :reload to rerun darcs half-
compiled-half-interpreted. I haven't tried anything more complicated.
The key seems to be to specify all the C extension modules on the
command-line along with darcs.lhs. (But not rts.o.) The other haskell
modules will get pulled in automatically.
On my system (MacOSX-ppc) it's also necessary to add a compiler flag
to modify some bizarre behavior of Apple's gcc port. Adding CFLAGS='-
mmacosx-version-min=10.4' when running ./configure will transform
some symbols from _snprintf$LDBLStub (which statically-links OK, but
breaks ghci's dynamic linking) into _snprintf$LDBL128 (which works
fine either statically or dynamically).
After configuring with that flag added, I run 'make' to produce .o
files for all the C modules (as well as the Haskell modules, of
course... ghci seems happy to use them) and then
ghci -cpp -I. -DHAVE_CURSES -DHAVE_CURL -package parsec -optl-
lcurl -optl-lssl -optl-lcrypto -optl-lz -optl-lcurses darcs.lhs
maybe_relink.o atomic_create.o hscurl.o umask.o c_compat.o fpstring.o
will load everything into ghci and leave you at the *Main> prompt.
More information about the darcs-devel
mailing list