[Unison-hackers] Unison 2.48 won't build in Cygwin

Andrew Schulman andrex at utexas.edu
Wed Jun 3 06:37:57 EDT 2015


For years I've been able to build Unison in Cygwin, by applying this small
patch:

diff -urN a/Makefile.OCaml b/Makefile.OCaml
--- a/Makefile.OCaml  2012-09-21 08:42:17.000000000 -0400
+++ b/Makefile.OCaml  2013-11-27 11:31:12.392086500 -0500
@@ -122,8 +122,7 @@
   ifeq ($(OSARCH),win32gnuc)
     CWD=.
     EXEC_EXT=.exe
-    COBJS+=system/system_win_stubs$(OBJ_EXT) lwt/lwt_unix_stubs$(OBJ_EXT)
-    WINOBJS=system/system_win.cmo
+    WINOBJS=
     SYSTEM=win
     CLIBS+=-cclib win32rc/unison.res.lib
     STATIC=false                      # Cygwin is not MinGW :-(

and running

  make OSCOMP=cygwingnuc SYSTEM=generic UISTYLE=text

That worked up through version 2.45.28.  Beginning with 2.47.4, the build fails
on lwt/win/lwt_unix_impl.ml:


ocamlopt: lwt/win/lwt_unix_impl.ml ---> lwt/win/lwt_unix_impl.cmx
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -c ./lwt/win/lwt_unix_impl.ml
File "./lwt/win/lwt_unix_impl.ml", line 655, characters 35-57:
Error: Unbound module System_impl.Fs.W
Makefile.OCaml:429: recipe for target 'lwt/win/lwt_unix_impl.cmx' failed
make: *** [lwt/win/lwt_unix_impl.cmx] Error 2


If I don't apply the patch, the build fails on system/system_win_stubs.c:


ocamlopt: system/system_win_stubs.c ---> system/system_win_stubs.o
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I
fsmonitor/windows -I system/generic -I lwt/generic -ccopt "-o
"./system/system_win_stubs.o -c ./system/system_win_stubs.c
./system/system_win_stubs.c:19:5: error: unknown type name \u2018SOCKET\u2019
     SOCKET socket;
     ^
./system/system_win_stubs.c: In function \u2018copy_wstring\u2019:
./system/system_win_stubs.c:31:3: warning: implicit declaration of function
\u2018wcslen\u2019 [-Wimplicit-function-declaration]
   len = 2 * wcslen(s) + 2;  /* NULL character included */
   ^
./system/system_win_stubs.c: In function \u2018win_chmod\u2019:
./system/system_win_stubs.c:129:23: error: \u2018_S_IWRITE\u2019 undeclared
(first use in this function)
   if (Int_val(perm) & _S_IWRITE)
                       ^
./system/system_win_stubs.c:129:23: note: each undeclared identifier is reported
only once for each function it appears in
./system/system_win_stubs.c: In function \u2018w_create_process_native\u2019:
./system/system_win_stubs.c:453:10: warning: unused variable \u2018h\u2019
[-Wunused-variable]
   HANDLE h;
          ^
Makefile.OCaml:434: recipe for target 'system/system_win_stubs.o' failed
make: *** [system/system_win_stubs.o] Error 2


I've tried this with various combinations of OSCOMP and SYSTEM, without success.
I confess that I don't know exactly what effect each of those variables has.

I think that a lot of the Cygwin-related logic in Makefile.OCaml is way out of
date.  For example, the logic for OSARCH=win32 seems to be obsolete since it
refers only to beta versions of Cygwin that are 10 years old.

Can anyone suggest a fix so that Unison will compile in Cygwin again?

Thanks,
Andrew



More information about the Unison-hackers mailing list