[darcs-users] MinGW compile problem

Gour gour at mail.inet.hr
Fri Nov 14 14:33:37 UTC 2003


David Roundy (droundy at abridgegame.org) wrote:

> I've moved Peter's win32 mmap into fpstring.c, so the mmap problem should
> go away.  I don't have a cross-ghc, but I do have a mingw cross compiler,
> so I was able to test that fpstring.c would at least compile.

Here is my experience (although I'm quite inexperienced :-)

First I tried with your 2nd hint i.e. define some bogus values, and I put
the following in fpstring.g:

#ifdef _WIN32
#define PROT_READ	0x1
#define MAP_SHARED	0x01
#define MAP_FAILED	0x0
#endif

I was able to compile darcs and even run:

darcs initree

but afterwards darcs was crashing with page fault error.

Then I though about the 1st hint, ie. but I wasn't 100% clear how to achieve it
since the offending code in fpstring.c looks like:

char *my_mmap(int len, int fd) {
  void *maybeok = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
  if (maybeok == MAP_FAILED) return NULL;
  else return (char *)maybeok;
}

while you wrote "Well, mmap isn't required, so you could simply put the call to
mmap in an #ifndef _WIN32 and configure with --disable-mmap.", and it is not 
clear how to avoid and/or re-define char *my_mmap function.

> 
> On zlib_helper.c there's more trouble.  The problem here is that I use
> pthreads to do the writing to disk while reading from the other end of a
> pipe that is written to by haskell.  I can see a couple of solutions.  One
> is to link with the pthreads-win32 library:
> 
> http://sources.redhat.com/pthreads-win32/

Yes, I installed this library for GCC and configure recognizes it, and darcs
was compiled and run :-)

> That would definitely be easiest from the darcs side, but maybe a pain for
> the person who's trying to compile darcs.
> 
> I've made an attempt at converting zlib_helper to use win32 threads (with
> the help of a win32 threads tutorial), so if you have a linux darcs working
> you can try pulling the changes to see if they work under windows.  Note
> that either way, you'll have to have zlib installed.  Also note that I
> don't have windows, so it's completely untested.

Fortunately my Win98 is running under Linux (with win4lin) so there is no
need for a dual-boot and therefore soem testing is not a pain.

Now I'm going to pull changes and see what's happening.

All in all I'm confident that we're close - darcs was initialized my 1st repo
on Win98 :-)

Sincerely,
Gour

ps. I have also tried darcs with gui and it's nice and two days ago Thompson's
book arrived :-) 

-- 
Gour
gour at mail.inet.hr
Registered Linux User #278493





More information about the darcs-users mailing list