[darcs-devel] [darcs-users] Problem building darcs 2 on WinXP

Rob Moss rgm at csse.unimelb.edu.au
Mon Dec 17 22:20:22 UTC 2007


On 18/12/2007, David Roundy <droundy at darcs.net> wrote:
> On Mon, Dec 17, 2007 at 03:55:20PM +0000, Simon Marlow wrote:
> > Claus Reinke wrote:
> > >> Linking darcs ...
> > >> src/win32/System/Posix.o(.text+0x550):fake: undefined reference to `SleepEx'
> > >> collect2: ld returned 1 exit status
> > >> make: *** [darcs] Error 1
> > >
> > > it might be a case of adding -fvia-C (used to be the default
> > > until recently). if that is true, you might want to file a ticket
> > > for ghc (change in default route gives failures and unhelpful
> > > error messages).
> > >
> > > also, as a naive ffi user, i'd have expected
> > >
> > >     foreign import ccall "winbase.h SleepEx" c_SleepEx :: DWORD -> BOOL -> IO DWORD
> > >
> > > to match the
> > >
> > >     WINBASEAPI DWORD WINAPI SleepEx(DWORD,BOOL);
> > >
> > > in winbase.h, rather than the current
> > >
> > >     foreign import ccall "winbase.h SleepEx" c_SleepEx :: CULong -> CUInt -> IO CInt
> > >
> > > but i don't know whether that is any issue at all.
> >
> > Looks like it should be
> >
> > foreign import stdcall "winbase.h SleepEx" c_SleepEx ...
> >
> > (i.e. stdcall rather than ccall)
> >
> > this would cause it to work with -fvia-C but fail with -fasm, because the C
> > compiler can see the prototype.  Arguably a bug in -fvia-C, but it's been
> > that way for a very long time.
>
> I'm not sure I understand what's gone wrong here.  Do either of you have a
> recommendation for something our fearless user can try? or a patch for us
> to apply?

Thanks a lot everybody! By changing the import from ccall to stdcall,
I was able to successfully compile darcs! The HTML manual is also
compiled, although there must be some small problem (maybe in the
makefile?) as make rebuilds the manual every time I run it. That
doesn't matter at all to me, but if you'd like I can try to figure out
what the problem might be.

Anyway, I'm off to test darcs 2! Thanks again for your help :)

cheers,
Rob


More information about the darcs-devel mailing list