Search code examples
windowscygwinocaml

How do I build camlp5-6.11 on Windows 8 under cygwin with OCaml 4.01.0?


I installed OCaml 4.01.0 from http://protz.github.io/ocaml-installer/. I am now trying to build camlp5-6.11. When I run ./configure && make world.opt in cygwin, I get

...
sed -e "s|@VERSION@|6.11|" -e "s|@CAMLP5DIR@|D:\OCaml\lib/camlp5|" META.tpl > META
make[2]: Leaving directory '/cygdrive/d/Downloads/camlp5-6.11/etc'
make[2]: Entering directory '/cygdrive/d/Downloads/camlp5-6.11/top'
ocamlrun.exe ../boot/camlp5r.exe -nolib -I ../boot -mode S -o camlp5_top.ppo camlp5_top.ml
ocamlc.opt -warn-error A -I ../main -I ../boot -I ../ocaml_stuff/4.01.0/utils -I ../ocaml_stuff/4.01.0/parsing -I D:OCamllib/compiler-libs -c -impl camlp5_top.ppo
File "camlp5_top.ml", line 51, characters 14-32:
Error: Unbound module Toploop
../config/Makefile:20: recipe for target 'camlp5_top.cmo' failed
make[2]: *** [camlp5_top.cmo] Error 2
make[2]: Leaving directory '/cygdrive/d/Downloads/camlp5-6.11/top'
Makefile:26: recipe for target 'out' failed
make[1]: *** [out] Error 2
make[1]: Leaving directory '/cygdrive/d/Downloads/camlp5-6.11'
Makefile:141: recipe for target 'world.opt' failed
make: *** [world.opt] Error 2

How do I fix this?


Solution

  • I suspect the Makefile of Camlp5 hasn't been tested on Windows. It probably doesn't deal properly with backslashes: indeed, in your output, I can see D:OCamllib/compiler-libs which leads me to think that the error lies on the Camlp5 side: the path should obviously be D:\OCaml\lib....

    Little-known fact about windows: / works as a path separator just as well, so if that's an option, you could probably try to hardcode d:/ocaml/ somewhere in the Makefile as the root dir for your OCaml installation, but you'd also have to fix the Makefile to generate d:/ocaml/lib as the library directory.