[ANN] Dune 2.8.0

On behalf of the dune, I’m pleased to announce the release of dune 2.8.0. This release contains many bug fixes, performance improvements, and interesting new features. I’ll point out two new features that I’m most excited about.

First is the experimental dune_site extension that makes it possible to register and load plugins at runtime. This feature is quite involved, but we’ve documented it extensively in the manual.

Another cool feature is that we’ve eliminated the need for .merlin files and all the caveats that came with them. Now, merlin talks to dune directly to get precise configuration for every module. Say goodbye to all those “approximate .merlin file” warnings!

I encourage everyone to upgrade as soon as possible, as earlier versions are not compatible with OCaml 4.12. Happy Hacking.

Full change log:

2.8.0 (13/01/2021)

  • dune rules accepts aliases and other non-path rules (#4063, @mrmr1993)

  • Action (diff reference test_result) now accept reference to be absent and
    in that case consider that the reference is empty. Then running dune promote
    will create the reference file. (#3795, @bobot)

  • Ignore special files (BLK, CHR, FIFO, SOCKET), (#3570, fixes #3124, #3546,

  • Experimental: Simplify loading of additional files (data or code) at runtime
    in programs by introducing specific installation sites. In particular it allow
    to define plugins to be installed in these sites. (#3104, #3794, fixes #1185,

  • Move all temporary files created by dune to run actions to a single directory
    and make sure that actions executed by dune also use this directory by setting
    TMPDIR (or TEMP on Windows). (#3691, fixes #3422, @rgrinberg)

  • Fix bootstrap script with custom configuration. (#3757, fixes #3774, @marsam)

  • Add the executable field to inline_tests to customize the compilation
    flags of the test runner executable (#3747, fixes #3679, @lubegasimon)

  • Add (enabled_if ...) to (copy_files ...) (#3756, @nojb)

  • Make sure Dune cleans up the status line before exiting (#3767,
    fixes #3737, @alan-j-hu)

  • Add {gitlab,bitbucket} as options for defining project sources with source
    stanza (source (<host> user/repo)) in the dune-project file. (#3813,

  • Fix generation of META and dune-package files when some targets (byte,
    native, dynlink) are disabled. Previously, dune would generate all archives
    for regardless of settings. (#3829, #4041, @rgrinberg)

  • Do not run ocamldep to for single module executables & libraries. The
    dependency graph for such artifacts is trivial (#3847, @rgrinberg)

  • Fix cram tests inside vendored directories not being interpreted correctly.
    (#3860, fixes #3843, @rgrinberg)

  • Add package field to private libraries. This allows such libraries to be
    installed and to be usable by other public libraries in the same project
    (#3655, fixes #1017, @rgrinberg)

  • Fix the %{make} variable on Windows by only checking for a gmake binary
    on UNIX-like systems as a unrelated gmake binary might exist on Windows.
    (#3853, @kit-ty-kate)

  • Fix $ dune install modifying the build directory. This made the build
    directory unusable when $ sudo dune install modified permissions. (fix
    #3857, @rgrinberg)

  • Fix handling of aliases given on the command line (using the @ and @@
    syntax) so as to correctly handle relative paths. (#3874, fixes #3850, @nojb)

  • Allow link time code generation to be used in preprocessing executable. This
    makes it possible to use the build info module inside the preprocessor.
    (#3848, fix #3848, @rgrinberg)

  • Correctly call git ls-tree so unicode files are not quoted, this fixes
    problems with dune subst in the presence of unicode files. Fixes #3219
    (#3879, @ejgallego)

  • dune subst now accepts common command-line arguments such as
    --debug-backtraces (#3878, @ejgallego)

  • dune describe now also includes information about executables in addition to
    that of libraries. (#3892, #3895, @nojb)

  • instrumentation backends can now receive arguments via (instrumentation (backend <name> <args>)). (#3906, #3932, @nojb)

  • Tweak auto-formatting of dune files to improve readability. (#3928, @nojb)

  • Add a switch argument to opam when context is not default. (#3951, @tmattio)

  • Avoid pager when running $ git diff (#3912, @AltGr)

  • Add (root_module ..) field to libraries & executables. This makes it
    possible to use library dependencies shadowed by local modules (#3825,

  • Allow (formatting ...) field in (env ...) stanza to set per-directory
    formatting specification. (#3942, @nojb)

  • [coq] In coq.theory, :standard for the flags field now uses the
    flags set in env profile flags (#3931 , @ejgallego @rgrinberg)

  • [coq] Add -q flag to :standard coqc flags , fixes #3924, (#3931 , @ejgallego)

  • Add support for Coq’s native compute compilation mode (@ejgallego, #3210)

  • Add a SUFFIX directive in .merlin files for each dialect with no
    preprocessing, to let merlin know of additional file extensions (#3977,

  • Stop promoting .merlin files. Write per-stanza Merlin configurations in
    binary form. Add a new subcommand dune ocaml-merlin that Merlin can use to
    query the configuration files. The allow_approximate_merlin option is now
    useless and deprecated. Dune now conflicts with merlin < 3.4.0 and
    ocaml-lsp-server < 1.3.0 (#3554, @voodoos)

  • Configurator: fix a bug introduced in 2.6.0 where the configurator V1 API
    doesn’t work at all when used outside of dune. (#4046, @aalekseyev)

  • Fix libexec and libexec-private variables. In cross-compilation settings,
    they now point to the file in the host context. (#4058, fixes #4057,

  • When running $ dune subst, use project metadata as a fallback when package
    metadata is missing. We also generate a warning when (name ..) is missing in
    dune-project files to avoid failures in production builds.

  • Remove support for passing -nodynlink for executables. It was bypassed in
    most cases and not correct in other cases in particular on arm32.
    (#4085, fixes #4069, fixes #2527, @emillon)

  • Generate archive rules compatible with 4.12. Dune longer attempt to generate
    an archive file if it’s unnecessary (#3973, fixes #3766, @rgrinberg)

  • Fix generated Merlin configurations when multiple preprocessors are defined
    for different modules in the same folder. (#4092, fixes #2596, #1212 and
    #3409, @voodoos)

  • Add the option use_standard_c_and_cxx_flags to dune-project that 1.
    disables the unconditional use of the ocamlc_cflags and ocamlc_cppflags
    from ocamlc -config in C compiler calls, these flags will be present in the
    :standard set instead; and 2. enables the detection of the C compiler family
    and populates the :standard set of flags with common default values when
    building CXX stubs. (#3875, #3802, fix #3718 and #3528, @voodoos)


Just upgraded to dune 2.8. For existing projects that was using previous version of merlin and dune you have to delete the existing .merlin files for the new way of merlin to work. It works okay after that.