* [Caml-list] Mingw OCaml + emacs + tuareg on windows
@ 2016-11-04 11:23 Matthieu Dubuget
0 siblings, 0 replies; only message in thread
From: Matthieu Dubuget @ 2016-11-04 11:23 UTC (permalink / raw)
To: Caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-04 11:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-04 11:23 [Caml-list] Mingw OCaml + emacs + tuareg on windows Matthieu Dubuget
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox