dimanche 11 octobre 2015

Installing OCaml with Eclipse on Windows 10

Introduction

This explains the main lines related to working efficiently with O'Caml on Win 10 with Eclipse, as I  experimented it today.

Credits

This was found mainly from here, which is a bit more complex, refered an older version of Eclipse (while still being appliable), and above all, taking too much time to view as it is a video tutorial. The OcalIDE site was also helpful.

Packages 

One has to download the following:
  1. a JDK from Oracle. Here I took JDK 8.60 for win64 from here.
  2. Eclipse from here. I took the "Eclipse for Java" Installer, Windows 64 bits. The current version is called "Mars" a.k.a 4.5.
  3. Cygwin from here. I took setup-x86_64.exe.
All installers were downloaded to my Download directory.

Installation

  1. Install the JDK:this step is straightforward, just run the installer and accept the default directories.
  2. Install Eclipse:in my experience, one should install one eclipse per application domain. Indeed, mixing Eclipse plugins raises compatibility issues, and Eclipse versions themselves change often. Hence I create a Program Files/Eclipse directory, under which all eclipse/ installations fit with a dedicated name. Eclipse comes as a simple ZIP file, from which the "eclipse" directory can be copied as Program Files\Eclipse\java-mars. Setup a shortcut from Program Files\Eclipse\java-mars\eclipse.exe to the desktop.
  3. Install OcalIDE: start Eclipse by clicking on the desktop shortcut and open menu Help/Install new Software. In the top "Work with" box, enter "http://www.algo-prog.info/ocaide/" and type "Return".  In the middle box, select "OcalIDE", then "Next" and validate all the way.
  4. Install Cygwin: I install to c:\cygwin64 (not to "Program Files" as Cygwin doesn't like blank spaces in directory names). I took a local package directory as a subdir of "Downloads". The following packages are required. Then, create an icon on Desktop
    •  ocaml, ocaml-base, ocaml-p4 and ocaml-compiler-libs
    •  make "the GNU version"

Setup

  •  Environment variables: from a Win10 file explorer, right-click "This PC" and select "Properties". On the left margin, click "Advanced system settings". Then in the "Advanced" tab, click at the bottom "Environment Variables".  On the lower box "System variables", select line "Path" then "Edit...". As value, add "C:\cygwin64\bin;" to the beginning. Click "OK" all the way. To make sure it went well, open a command prompt and run the "ocaml" command. The familiar OCaml shell should start
  • OCalIDE: start Eclipse by clicking on the desktop shortcut and open menu Window/Preferences. On the left, select "OcalIDE" then "Paths". In the top box, enter C:\cygwin64\bin then click on the "Apply" box right next to it. The default values for all ocaml paths should appear. Also enter C:\cygwin64\bin\make.exe for "make" and "C:\cygwin64\lib\ocaml" for OCaml lib path.Click "Apply" and "OK" on the bottom.

First Project

Select  "File/New/Project..." then "OCaml/OCaml project". Enter a name for the project, validate. Accept switching to the OCaml perspective. Check the low "Ocaml Toplevel" tab: it should provide a running OCaml shell (version 4.01.0 as of this writing).
For more help, look at some useful tutorials here.  The full manual is supposed to be found directly in Eclipse under Help/Help Index but it does not work on my installation, so there is still some digging to fix that (maybe starting from Eclipse CDT instead of Java).

Aucun commentaire:

Enregistrer un commentaire