<div dir="ltr">I went through the same pain of building 2.48 for Windows a couple months ago. And what a struggle it was!<div><br></div><div>For various reasons, I ended up using my build that wasn't reliant on Cygwin's DLL, but I did get it working both ways.<div><br></div><div>I only have my notes for building the non-DLL version (see below). But I believe the same changes allowed me to build the Cygwin version using simply "make clean && make UISTYLE=text". (You should perhaps omit the OSARCH=win32 below, I don't remember for sure.)</div><div><br></div><div>Windows build instructions for Unison 2.48.3:<br></div><div><div>* Install the Protz version of OCaml. (<a href="http://protz.github.io/ocaml-installer/">http://protz.github.io/ocaml-installer/</a>)</div><div> - If planning cross-platform use, be warned that apps built using OCaml 4.01 and 4.02 are binary incompatible!</div><div>* Start a Cygwin shell (even when not linking against the Cygwin DLL).</div><div>* Update PATH so that the Protz /bin dir is first.</div><div>* 'cd' into the Unison source directory.</div><div>* Edit Makefile.OCaml to use "-Fo" instead of "/Fo".</div><div>* export OSARCH=win32</div><div>* make clean && make UISTYLE=text STATIC=false</div><div> - Need STATIC=false because STATIC=true passes unrecognized "-static" argument to OCaml's 'flexdll'.</div><div>* Upon link error, change the failed 'ocamlopt' command line as follows, and run manually:</div><div> - REMOVE this trailing part: -cclib "-link [...].res" shell32.lib</div><div> - FIX .obj filenames: change ".obj" to ".o" and remove any DIR/ prefixes from those files</div><div><br></div><div><div>Hope this helps.</div><div><br></div></div><div>--Chris</div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 3, 2015 at 3:37 AM, Andrew Schulman <span dir="ltr"><<a href="mailto:andrex@utexas.edu" target="_blank">andrex@utexas.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">For years I've been able to build Unison in Cygwin, by applying this small<br>
patch:<br>
<br>
diff -urN a/Makefile.OCaml b/Makefile.OCaml<br>
--- a/Makefile.OCaml 2012-09-21 08:42:17.000000000 -0400<br>
+++ b/Makefile.OCaml 2013-11-27 11:31:12.392086500 -0500<br>
@@ -122,8 +122,7 @@<br>
ifeq ($(OSARCH),win32gnuc)<br>
CWD=.<br>
EXEC_EXT=.exe<br>
- COBJS+=system/system_win_stubs$(OBJ_EXT) lwt/lwt_unix_stubs$(OBJ_EXT)<br>
- WINOBJS=system/system_win.cmo<br>
+ WINOBJS=<br>
SYSTEM=win<br>
CLIBS+=-cclib win32rc/unison.res.lib<br>
STATIC=false # Cygwin is not MinGW :-(<br>
<br>
and running<br>
<br>
make OSCOMP=cygwingnuc SYSTEM=generic UISTYLE=text<br>
<br>
That worked up through version 2.45.28. Beginning with 2.47.4, the build fails<br>
on lwt/win/<a href="http://lwt_unix_impl.ml" target="_blank">lwt_unix_impl.ml</a>:<br>
<br>
<br>
ocamlopt: lwt/win/<a href="http://lwt_unix_impl.ml" target="_blank">lwt_unix_impl.ml</a> ---> lwt/win/lwt_unix_impl.cmx<br>
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I<br>
fsmonitor/windows -I system/generic -I lwt/generic -c ./lwt/win/<a href="http://lwt_unix_impl.ml" target="_blank">lwt_unix_impl.ml</a><br>
File "./lwt/win/<a href="http://lwt_unix_impl.ml" target="_blank">lwt_unix_impl.ml</a>", line 655, characters 35-57:<br>
Error: Unbound module System_impl.Fs.W<br>
Makefile.OCaml:429: recipe for target 'lwt/win/lwt_unix_impl.cmx' failed<br>
make: *** [lwt/win/lwt_unix_impl.cmx] Error 2<br>
<br>
<br>
If I don't apply the patch, the build fails on system/system_win_stubs.c:<br>
<br>
<br>
ocamlopt: system/system_win_stubs.c ---> system/system_win_stubs.o<br>
ocamlopt -g -I lwt -I ubase -I system -I fsmonitor -I fsmonitor/linux -I<br>
fsmonitor/windows -I system/generic -I lwt/generic -ccopt "-o<br>
"./system/system_win_stubs.o -c ./system/system_win_stubs.c<br>
./system/system_win_stubs.c:19:5: error: unknown type name \u2018SOCKET\u2019<br>
SOCKET socket;<br>
^<br>
./system/system_win_stubs.c: In function \u2018copy_wstring\u2019:<br>
./system/system_win_stubs.c:31:3: warning: implicit declaration of function<br>
\u2018wcslen\u2019 [-Wimplicit-function-declaration]<br>
len = 2 * wcslen(s) + 2; /* NULL character included */<br>
^<br>
./system/system_win_stubs.c: In function \u2018win_chmod\u2019:<br>
./system/system_win_stubs.c:129:23: error: \u2018_S_IWRITE\u2019 undeclared<br>
(first use in this function)<br>
if (Int_val(perm) & _S_IWRITE)<br>
^<br>
./system/system_win_stubs.c:129:23: note: each undeclared identifier is reported<br>
only once for each function it appears in<br>
./system/system_win_stubs.c: In function \u2018w_create_process_native\u2019:<br>
./system/system_win_stubs.c:453:10: warning: unused variable \u2018h\u2019<br>
[-Wunused-variable]<br>
HANDLE h;<br>
^<br>
Makefile.OCaml:434: recipe for target 'system/system_win_stubs.o' failed<br>
make: *** [system/system_win_stubs.o] Error 2<br>
<br>
<br>
I've tried this with various combinations of OSCOMP and SYSTEM, without success.<br>
I confess that I don't know exactly what effect each of those variables has.<br>
<br>
I think that a lot of the Cygwin-related logic in Makefile.OCaml is way out of<br>
date. For example, the logic for OSARCH=win32 seems to be obsolete since it<br>
refers only to beta versions of Cygwin that are 10 years old.<br>
<br>
Can anyone suggest a fix so that Unison will compile in Cygwin again?<br>
<br>
Thanks,<br>
Andrew<br>
<br>
_______________________________________________<br>
Unison-hackers mailing list<br>
<a href="mailto:Unison-hackers@lists.seas.upenn.edu">Unison-hackers@lists.seas.upenn.edu</a><br>
<a href="http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers" target="_blank">http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers</a><br>
</blockquote></div><br></div></div></div></div></div>