Error while trying to set up ocaml project on windows 10 via cygwin terminal

Trying to run make deps results in the following errors:

I have tried several fixes and nothing seems to be working, please let me know if you have any idea on how I can fix this.

I think that you need to install a cygwin package which provides a file libssl.pc (or similar). In Debian-based GNU operation systems it is called libssl-dev.

Also, in 2021 I would recommend to use WSL instead of cygwin on Windows

1 Like

It seems that the some system dependencies are not installed correctly with depext. Could you raise an issue to GitHub - fdopen/opam-repository-mingw: windows package repository for OPAM (mingw and msvc) when you have time?

1 Like

This looks like an OCaml.org build. It is currently being documented, but the recommended way for building the ocaml.org site on a Windows machine right now is using WSL. See the related issues:

There are a lot of scripts and Makefiles so it seems this is the quickest way to contribute is to use WSL. It also seems @YASHI_VIJAY has already managed to build the site this way so it is a little more tried and tested :))

2 Likes

It seems that the some system dependencies are not installed correctly with depext.

Just missing depexts informations:

opam update
opam pin add -n ssl 0.5.9 [*]

And try it again.

([*] The libssl package shipped by cygwin is not longer maintained and incompatible with the latest release of ocaml-ssl. Don’t use it for anything except local testing.)

2 Likes

That was many times faster response than I expected.

1 Like

Thank you everyone, this fixed that issue but now I am getting another error when I run make

Thank you. For some reason WSL isn’t responding on my laptop so I had to look for an alternative.

Currently facing this error on my ubuntuOS while trying to build the project again, and I was wondering if this is related to the current issue discussed here.

I have successfully built the ocaml.org before now on my system, but I want to redo the whole process again for the sake of documenting my journey to help others when needed.

3 Likes

/usr/x86_64-w64-mingw32/sys-root/mingw/bin (or /usr/i686-w64-mingw32/sys-root/mingw/bin) is probably not in your $PATH (or at a wrong position, so that ssleay32.dll is hidden by another file with the same name).
Add it with eval $(ocaml-env cygwin)

Thank you @fdopen got a new error after running that command

That’s an error at the source code level. The code is not compatible with Windows.
Somewhere, it uses open_in/open_out, but should have used open_in_bin/open_out_bin. Or set_binary_mode_out stdout / set_binary_mode_in stdin is missing.

2 Likes

Thank you once again @fdopen
Now installed on an Ubuntu system and I get the error below after I run make deps

Have you encountered this before? If yes, please how do I get it solved.

It says that bwrap should be installed. I recommend

  1. to check if it is installed
  2. if it is and error still happens, you can comment wrap-* lines in ~/.opam/config to disable it

@Goodiec can you check if replacing open_in and open_out in the script/http.ml files at lines 93 and 104 fixes your issue?

I paste the diff below:

--- a/script/http.ml
+++ b/script/http.ml
@@ -93,7 +93,7 @@ let get ?(cache_secs=cache_secs) url =
   let fn = Filename.concat (Filename.get_temp_dir_name ()) ("ocamlorg-" ^ md5) in
   eprintf "Downloading %s ... %!" url;
   let get_from_cache () =
-    let fh = open_in fn in
+    let fh = open_in_bin fn in
     let data = input_value fh in
     close_in fh;
     eprintf "done.\n  (using cache %s, updated %s ago).\n%!"
@@ -104,7 +104,7 @@ let get ?(cache_secs=cache_secs) url =
     try
       let data = http_get url in
       eprintf "done %!";
-      let fh = open_out fn in
+      let fh = open_out_bin fn in
       output_value fh data;
       close_out fh;
       eprintf "(cached).\n%!";
1 Like

Thank you @Kakadu was able to successfully run make deps but I get the error below when I run make

Thank you @mseri but I have already started the process again on Ubuntu.

Ran eval $(opam config env) and that got rid of the ocamlfind : Command not found error.