Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Matthieu Dubuget <matthieu.dubuget@gmail.com>
To: Caml-list <caml-list@inria.fr>
Subject: [Caml-list] Mingw OCaml + emacs + tuareg on windows
Date: Fri, 4 Nov 2016 12:23:54 +0100	[thread overview]
Message-ID: <cfab344e-332c-8076-c758-388dfdf100e9@gmail.com> (raw)

Hello,

I'm trying to install a "OCaml" windows workstation, but have some
trouble to get everything working together. By "everything", I mean
emacs, tuareg, merlin, and utop.

I'd be glad for some advice.

Here is what I tried.

I used a "Windows 7 Enterprise" computer.

I first installed cygwin with the following powershell script:

```powershell
function Download-File { param ([string]$url, [string]$file)
  Write-Output "Downloading `'$url`' to `'$file`'"
  $downloader = new-object System.Net.WebClient
  $downloader.Proxy.Credentials=[System.Net.CredentialCache]::DefaultNetworkCredentials;
  $downloader.DownloadFile($url, $file)
}

function Ensure-Tempdir {
  if ($env:TEMP -eq $null) {
    $env:TEMP = Join-Path $env:SystemDrive 'temp'
  }
  if (![System.IO.Directory]::Exists($env:TEMP)) {
    [System.IO.Directory]::CreateDirectory($env:TEMP)
  }
}

Ensure-Tempdir

$cygwinSetupFile = Join-Path $env:TEMP "setup-x86.exe"

Download-File "http://cygwin.com/setup-x86.exe" $cygwinSetupFile

$PACKAGES="-P mingw64-i686-binutils,mingw64-i686-gcc-core,mingw64-i686-gcc-g++,mingw64-i686-runtime -P autoconf,make,diffutils,patch,dos2unix,m4 -P p7zip,unzip,zip -P git,emacs-w32,wget,cpio -P libncurses-devel,ncurses -P mingw64-i686-pkg-config,mingw64-i686-libffi -P curl"

Start-Process -Wait $cygwinSetupFile -ArgumentList "-qnNdO -R `"c:/cygwin`" -s `"http://cygwin.uib.no`" $PACKAGES"
```

I then installed opam, ocaml and some tools from the cygwin shell:

```bash
OPAM32="opam32.tar.xz"
[ -e ${OPAM32} ] || curl -Lo ${OPAM32} https://dl.dropboxusercontent.com/s/eo4igttab8ipyle/${OPAM32}
tar xaf ${OPAM32}
bash opam32/install.sh
opam init  --comp 4.03.0+mingw32c --switch 4.03.0+mingw32c -a mingw "https://github.com/fdopen/opam-repository-mingw.git"
opam install tuareg utop merlin
```

Until this point, I would say that things seems to work as expected.
Including `utop` which works fine when started from a real terminal.

My main goal is to have a full emacs-based IDE: ideally, `utop`,
`merlin` and `tuareg` would work in emacs.

Since I'm using emacs-w32 package from cygwin, I downloaded
https://www.emacswiki.org/emacs/download/cygwin-mount.el and
https://www.emacswiki.org/emacs/download/windows-path.el. I put them
in `~/.emacs.d/` and added

```lisp
(require 'cygwin-mount "~/.emacs.d/cygwin-mount.el")
(require 'windows-path "~/.emacs.d/windows-path.el")
(windows-path-activate)
```
in `~/.emacs`.



To enable tuareg in emacs, I appended in `~/.emacs`:

```lisp
(
 let ((opam-share
       (ignore-errors (car (process-lines "opam" "config" "var" "share")))))
  (when (and opam-share (file-directory-p opam-share))
    (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
    (load "tuareg-site-file")
  )
)
```

So far. So good.

Trying to add utop is a failure.

I modified the above code-fragment in `~/.emacs` like this:
```lisp
(
 let ((opam-share
       (ignore-errors (car (process-lines "opam" "config" "var" "share")))))
  (when (and opam-share (file-directory-p opam-share))
    (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
    (load "tuareg-site-file")
    (load "utop")
  )
)
```

First problem. I can start `utop` with `M-x utop`.
But it fails on the first input:
```
Welcome to utop version 1.19.3 (using OCaml version 4.03.0)!

utop.exe: lambda-term(history): failed to lock file 'C:\cygwin\home\vagrant\.utop-history': A requested file lock operation cannot be processed due to an invalid byte range.
utop[0]> let x = 1;;

Process utop exited with code 2
```

Any idea how I could solve this before jumping to merlin configuration?

-- 
Matthieu Dubuget


                 reply	other threads:[~2016-11-04 11:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cfab344e-332c-8076-c758-388dfdf100e9@gmail.com \
    --to=matthieu.dubuget@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox