I’m pleased to announce the release 1.1.0 of DKML (Diskuv OCaml) at https://github.com/diskuv/dkml-installer-ocaml/releases/tag/v1.1.0_r2. As usual the DKML distribution supports the Visual Studio compiler on Windows. After the 90-minute installer finishes you will have a working environment where dune build
and utop
work immediately. The installed OCaml language server works in VS Code using the installed dkml
switch with a single VS Code option change (see Full docs). Creating a new local opam switch with an ocaml-system
compiler takes about 90 seconds with dkml init
. Full docs are at Getting Started with Diskuv OCaml — Diskuv OCaml 1.1.0 documentation.
Scroll below for related announcements about setup-dkml
(CI for MSVC) and winget
.
There are many new features and changes, so please browse the following release notes:
Quick Links:
Upgrading from 1.0.1?
- Uninstall the old version first with the uninstaller above!
- After uninstalling the old version, run the following in PowerShell:
if (Test-Path "$env:LOCALAPPDATA\opam\playground") { Remove-Item -Path "$env:LOCALAPPDATA\opam\playground" -Force -Recurse }
- Exit Visual Studio Code and any
utop
orocaml
sessions. Then use the installer above. - After installing the new version, run the following in PowerShell in each directory that has a local opam switch to upgrade to OCaml 4.14.0 and all the other package versions that come with DKML 1.1.0:
# Sometimes `dkml init` can fail, but you are OK as long as you see: # ... upgrade ocaml-system 4.12.1 to 4.14.0 dkml init opam upgrade opam install . --deps-only --with-test
Cautions:
- Do not use this distribution if you have a space in your username (ex.
C:\Users\Jane Smith
). Sorry, but the broader OCaml ecosystem does not yet consistently support spaces in directories. - Your Windows anti-virus may play havoc with the installer. If possible, temporarily disable your anti-virus (the “realtime protection”, “exploit protection” and/or “malware protection” options). Some anti-virus products include a button to temporarily disable AV protection for two hours; do that. If you forget and the installer fails, you will need to disable AV protection, run the uninstaller, and then rerun the installer!
New features:
- The system OCaml is 4.14.0 (was 4.12.1)
- The system includes ocamlnat, the experimental native toplevel. It should be run using
with-dkml ocamlnat
so native code is compiled with Visual Studio. - Add odoc 2.1.0 to user PATH, to align with the OCaml Platform.
- Relocatable native binaries are installed rather than compiled into place. Installations should be quicker, which is a pre-requisite for
winget install
(pending!) on Windows. - Add opam global variable
sys-pkg-manager-cmd-msys2
for future compatibility
with opam 2.2 depext support of MSYS2 - The
opam dkml init
command is nowdkml init
. Thedkml
executable is precompiled and shaves ~20 minutes of installation time.
New security:
-
(Advanced; experimental) If you are behind a corporate firewall that uses man-in-the-middle (MITM) TLS proxying, you can install your corporate CA chain so DKML, in particular MSYS2, does not reject connections. Only persons with write access to
$env:ProgramData\DiskuvOCaml\conf\unixutils.sexp
will be able to define the allowed MITM TLS chain; you may need access from your corporate Administrator. An exampleunixutils.sexp
is:( (trust_anchors ("C:\\conf\\my.pem" "D:\\conf\\my.cer")) )
You specify one or more
.pem
or.cer
CA files, making sure to use two backslashes to escape your paths. Your Administrator may have already placed the CA files on your machine; otherwise use the guide at FAQ - MSYS2 to copy them from your web browsers.
Not so good problems:
-
Known bug #21 To install the OCaml language server in a new switch you will need to first do
opam pin remove fiber omd stdune dyn ordering --no-action
before doingopam install ocaml-lsp-server
. - Many opam packages do not work with the MSVC compiler or with Windows. It will take a long time (months, years) to substantially improve Windows coverage. When you do find a package that fails to compile on Windows, please file an issue with whoever owns the package expressing interest in the package working on Windows. Please be patient: some package owners may want to see several people express interest before deciding the extra work is justified.
Breaking changes:
- Cross-compiling on macOS with dkml-base-compiler now requires you to be explicit which CPU architecture you are targeting. Before using
dune -x darwin_arm64
would always cross-compile both Intel and Silicon. Now Silicon developers need to usedune -x darwin_x86_64
and Intel developers need to usedune -x darwin_arm64
. The change was necessary to not rely on the presence of optional Rosetta2 translation. Since this cross-compiling feature is little used, it does not warrant a breaking version bump.
Documentation changes:
- The documentation site has moved to https://diskuv-ocaml.gitlab.io/distributions/dkml/. Please update your bookmarks!
Bug fixes:
-
The dune.exe shim uses a cache containing the expensive-to-compute MSVC environment settings. A race condition populating the cache has been fixed.
-
Repetitive opam repository updates, a source of slowness, were eliminated during installation.
-
ocaml-crunch upgraded (pinned) from 3.2.0 to 3.3.1 to fix Windows/Unix path inconsistency and handling of CRLF. That and other changed package versions are:
Package Old Version New Version dune 2.9.3 3.6.2 ocaml-crunch 3.2.0 3.3.1 cmdliner 1.0.4 1.1.1 uuidm 0.9.7 0.9.8 ptime 0.8.6 1.1.0 sexplib v0.14.0 v0.15.1 lsp 1.9.0 1.10.3 ocaml-lsp-server 1.9.0 1.10.3 jsonrpc 1.9.0 1.10.3 odoc 2.1.0 2.2.0 odoc-parser 0.9.0 1.0.1 stdio v0.14.0 v0.15.0 base v0.14.2 v0.15.1 mdx 2.0.0 2.1.0 ocamlformat 0.19.0 0.23.0 ocamlformat-rpc 0.19.0 not pinned ocamlformat-rpc-lib 0.19.0 0.23.0 -
The Visual Studio installation cleans up aborted previous installations.
-
The Visual Studio installation, on failure, writes error logs to a location that isn’t immediately erased.
Component changes:
-
opam.exe is compiled directly from the opam master branch; no patches! There is still a shim but that shim just sets up environment variables and delegates to the authoritative (unpatched) opam.There is one patch for opam on top of the opam master branch (opam 2.2) dated 2022-12-21. - MSYS2 setup program is bundled inside the installer to lessen download TLS problems when a proxy is present (common with corporate/school Windows PCs). Resolves Installer fails at curl due to self-signed certificate · Issue #19 · diskuv/dkml-installer-ocaml · GitHub
Reproducibility features:
- Packages promoted to central Opam repository:
- dkml-runtime-common
- dkml-runtime-distribution
- dkml-component-opam
- Introduce simple spec for which package+versions are installed and/or compiled as part of the DKML distribution (in dkml-runtime-distribution). Eventually it will become authoritative.
- Introduce dkml-component-desktop which does CI for changes to that spec (aka. testing new package versions for Windows using MSVC), and builds all relocatable binaries like dune and ocp-indent used in the Windows installer. It is not yet in the central Opam repository.
- During installation any
CAMLLIB
environment variable (in addition toOCAMLLIB
which was already checked) is renamed to deconflict with a new OCaml installation. Among other things, this provides an upgrade from CamlLight to OCaml. Unbound module Stdlib · Issue #13 · diskuv/dkml-installer-ocaml · GitHub
Usability tweaks:
- When building DKML packages like dkml-base-compiler, limit dump of Opam logs used for troubleshooting to 4 hours
Feature flags:
-
Enable
--enable-imprecise-c99-float-ops
during OCaml compilation by setting( (feature_flag_imprecise_c99_float_ops) )
in
$env:ProgramData\DiskuvOCaml\conf\ocamlcompiler.sexp
. This is sometimes needed inside virtual machines like Vagrant
Licensing:
- Diskuv OCaml is fully open-source, and is targeted for pure OCaml development. Commercial tools and support are available from Diskuv for mixed OCaml/C development; however, Diskuv OCaml only has limited support for mixed OCaml/C. For example, the
ctypes
opam package has been patched to work with Visual Studio but is out-dated. Contact support AT diskuv.com if you need OCaml/C development.
Internal changes:
- with-dkml.exe is now configured as a opam wrapper relative to the installation directory ($DiskuvOCamlHome) rather than the tools opam switch. That change decouples your new switches (aka. dkml init) from another opam switch.