Ocaml for Win Env

Hello guys, I started to study ocaml language because i need it for my thesis article. So i have already done all steps from tutorial and i have only one thing to ask:

  1. complete guide how to install ocaml for window environment

i follow this one -> http://ocaml.org/docs/install.html#Windows and i tried all three ways how to install ocaml and when i used OCPWin + Ocaml Top i encountered some issues like “Unbound Module x” or install new package. Hence, i decided to use Cygwin + Ocaml64 (-> https://fdopen.github.io/opam-repository-mingw/installation/) and the question i have now is :
the double terminal i got after installation wizard (cygwin terminal and Ocaml64 terminal) how i should use them? i tried to open Ocaml64 and run “ocaml” so i can easily use interpreter but i don’t know how save files.
So I prefer use Ocaml Top as interface because is really comfortable, but if one of all you good guys could help to explain how use way with Cygwin and OCaml terminal i’ll appreciate so much.

You can install OCaml Top with opam from the cygwin shell:

$ opam install -y depext depext-cygwinports # this will install ocaml-depext and its windows helper
$ eval $(ocaml-env cygwin) # adds external dependencies to your $PATH
$ opam depext -i -y ocaml-top # install ocaml-top and external dependencies

Now you can already start ocaml-top from cygwin:

$ ocaml-top

You can also add an link to the Desktop (or start menu, etc. see mkshortcut --help for other options)

$ mkshortcut --desktop --name='OCaml top' --arguments="exec ocaml-top" /usr/local/bin/ocaml-env.exe
2 Likes

Last question: after i run “ocaml-top” on cygwin terminal, i got this message

C:/OCaml64/home/marco/.opam/4.03.0+mingw64/bin/ocaml-top.exe: error while loading shared libraries: libpango-1.0-0.dll: cannot open shared object file: No such file or directory

So maybe i prefer to reinstall cygwin only and then use your commands written above , but should i install opam first, right?

after downloaded setup here : Cygwin Installation what i should do?
thank you for your time and good answering

The *dll files are either inside C:\OCaml64\usr\x86_64-w64-mingw32\sys-root\mingw\bin or C:\OCaml64\usr\i686-w64-mingw32\sys-root\mingw\bin - depending on your Sys.word_size. And you are free to use libraries provided by somebody else, e.g. msys2.org, or compile them yourself manually. Because of the many different options, they are not added to your PATH automatically. You have to do it manually, either with

$ export PATH="/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH"
# or as mentioned above
$ eval $(ocaml-env cygwin)

thank you, i added manually to my environment variables on “path” file and now it seems all works. Last question and then , i thoguth i’m done :
After downloaded setupx64 from this link https://fdopen.github.io/opam-repository-mingw/installation/ and run it, i got these two terminal, so are they the same or should i just use cygwin terminal and forgot about Ocaml64 terminal?

img

And if i run “ocaml-top” in both of them, program Ocaml top will start at same way.

Yes, you can delete one link. There should be no functional difference between them. I looks like cygwin’s setup.exe ignores the command line parameter, that was intended to prevent the creation of one of the links.

i tried exec this example from tutorial and when i encountered two different error message, could you explain that?
first:

img2

you can find example here http://ocaml.org/learn/tutorials/introduction_to_gtk.html

I promise, this is last one :smiley:

second: