Windows 7 - Can't compile OCaml 3.10.2

Hello,

I’m trying to compile OCamL 3.10.2 on Windows 7 (64-bit) using migw but it’s failing with these errors. Please advise.
Thanks

In file included from ocaml.c:33:
ocaml.c: In function ‘GotoEOF’:
inria.h:69:19: error: ‘DWL_USER’ undeclared (first use in this function); did you mean ‘DWLP_USER’?
#define DWLP_USER DWL_USER
^~~~~~~~
inria.h:69:19: note: in definition of macro ‘DWLP_USER’
#define DWLP_USER DWL_USER
^~~~~~~~
inria.h:69:19: note: each undeclared identifier is reported only once for each function it appears in
#define DWLP_USER DWL_USER
^~~~~~~~
inria.h:69:19: note: in definition of macro ‘DWLP_USER’
#define DWLP_USER DWL_USER
^~~~~~~~
ocaml.c: In function ‘GotoPrompt’:
inria.h:69:19: error: ‘DWL_USER’ undeclared (first use in this function); did you mean ‘DWLP_USER’?
#define DWLP_USER DWL_USER

That release is well over a decade old, and long out of support. Please try OCaml 4.08.1 instead.

1 Like

I’m trying to compile a legacy code which is known to work with 3.10.2 so wasn’t sure if it would work with latest version. I tried to compile 4.08.1 but failed with flexdll error. I would like to compile OCamL without cygwin. Is it possible and how ?

Please advice.

Thanks

As far as know, this is up to date. Unless you’re willing to use WSL, you basically have to use cygwin.

That’s a reasonable concern, but we can help you make it work. There will probably be lots of complaints from the compiler, especially about writable strings and Pervasives, but they’re not actually frightening; it should be quite fast to make everything work. I’m a new OCamler as things go and I’ve done this successfully several times. People will also help you if you ask.

1 Like

It shouldn’t be that hard to compile 3.10 on Windows tho.

is a standard definition.

Says:

What I found particularly interesting about this error is that
the DWL_USER window long was specifically
renamed to DWLP_USER in 64-bit Windows in order to force
a build break.

So try to build on x32 Windows, or use a contemporary compiler.

I think there should be a way to compile 32 bit code specifically, I didn’t use windows for many years, so I can’t say how. Maybe @dra27 knows?

1 Like

It’s not clear what you’ve done - did you try running configure?

OCaml 3.10 requires this patch from my slightly neglected ocaml-legacy repo to build with mingw-w64.

Note that mingw-w64 amd64 support wasn’t added until OCaml 4.00 (only the Microsoft C compiler was supported for amd64 prior to that), so while you can compile on 64-bit Windows, you can only use the x86 mingw-w64 compilers.

The error message you have above hints that you may not have followed the instructions in README.win32 properly!

Incidentally, unless you really need them, I’d suggest editing config/Makefile and removing labltk from the OTHERLIBRARIES definition - although the ocaml-legacy repo has the patches necessary for some more recent TCL/TK Windows distros.

If you don’t need ocamldoc, you can edit the root Makefile.nt to remove the references to ocamldoc.byte and ocamldoc.opt, or alternatively apply this small patch.

I have just built the 3.10 branch (so approximately 3.10.2) on Windows 7 x64, although the Cygwin installation on the machine is itself a bit old (Cygwin 2.10 and i686-w64-mingw32-gcc 6.4.0)

Sorry I away for a while. Looks like I need to use Cygwin which I was avoiding it. I’m gonna give a try and see if I get that working for me.

Thank you guys much appreciated !

In my opinion it’s better to just setup a VM with Linux. Will save you a lot of the time. Windows support in OCaml is still far from being good for the end user, IMHO.

Out of curiosity, is there any reason not to prefer WSL over Cygwin those days? (I’m asking in general, I’ve seen that the OP uses Windows 7 for which WSL is not available.)

The first reason is that WSL2 is coming out, which is a full VM, rather than a compatibility layer over NT’s kernel. WSL2 provides much better compatibility with Linux because it is Linux.

The second reason is that in both WSL and WSL2, you’re dealing with a system that isn’t 100% integrated into Windows (yet). The main example right now is the lack of a fast graphics system, or really any decent graphics system. You have to use an X server like X-ming to send graphics from the WSL side to display in the Windows side. This is fine for development - I’m ok with the graphics being a little slow and blurry - but it’s not good enough for native apps that should perform like other apps.

Also, you can’t really distribute WSL apps, since you can’t be sure a user will have activated the WSL/WSL2 elements of their Windows system. By contrast, developing using cygwin allows you to build fully native windows apps.