[darcs-devel] Problem building darcs 2 on WinXP

Simon Marlow simonmarhaskell at gmail.com
Mon Dec 17 15:55:20 UTC 2007

Claus Reinke wrote:
>> I've installed MinGW, MSYS (with msysDTK, autoconf and automake), GHC,
>> zlib, libcurl and OpenSSL. I can run ./configure --target=mingw and
>> compile the source, but I get this linking error:
>> 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
> 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.


More information about the darcs-devel mailing list