[ANN] opam 2.2.0~beta1

On behalf of the opam dev team, I’m happy to announce the first beta release of opam 2.2.0.

What’s new in this beta?

  • opam init on Windows now requires you to choose which Git to use. Git for Windows is now recommended by default, though Cygwin’s Git can of course still be used. See the blog post linked below for more info on why choose one over the other.
  • when compiling opam on Windows with MinGW, the resulting opam binary now contains libstdc++ instead of requiring the DLL to be distributed alongside it or to be present in the environment during compilation
  • fix opam env containing carriage return on Cygwin - eval $(opam env) now works from a Cygwin bash terminal
  • as well as a bunch of bug fixes and improvements

You’ll find these features presented in the blog post, and for some extra details you can take a look at the release note or the changelog.

We encourage you to try out this beta release, instructions are detailed in the blog post, in particular if you’re using Windows for which we provide a – still experimental – pre-built binary.

On Unix-like systems though, to upgrade, simply run:

bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0~beta1"

Happy hacking,
<> <> The opam team <> <> :camel:

20 Likes

The blog page doesn’t tell us how to install opam. I guess a simple make cold-install (command given by the README.md).

One nasty thing I have to fix is the symlink behavior. Compiling ocamlbuild (needed by utop directly or not) needs native symlinks.

We have to enable them:

  1. Set the environment: CYGWIN=winsymlinks:nativestrict
  2. Add the create symlinks privileges to the user (see User Rights Assignment - Windows Security | Microsoft Learn)
  3. logout/login

(CYGWIN=winsymlinks:native could work, but if the symlink right is not set, the error would come later)

NOTE: I would be glad to know how DiskuvOcaml can compile ocamlbuild without the symlinks right. I guess I have compiled it when installing utop.

However, I have a utop working. Quite a nice job.

This is indeed a known issue at the moment sorry for that, see #5782. The fix for this is slotted for the next beta (2.2.0~beta2)

There is also another known similar issue that you can learn about here: #5781

Sorry to clutter the topic:

I’ve looked through several pages related to the project and I cannot find some information. Is there any expectation or understanding about when opam 2.2.0 is expected to be fully released?

Also, if there’s a roadmap or something that I’m missing or didn’t find, I’d very much appreciate a link.

Thanks!

1 Like

There is no date no, it’ll be there when opam and opam-repository work out of the box on Windows.

On opam itself there is a fairly small amount of things left that you can see here:

On opam-repository the work on making the compiler packages compatible with Windows was fairly involved and is still in progress. There is no central place where the todo list for this is but there should be some news on what’s left to be done next week or so.

If you’re not using Windows however, feel free to think of this beta release as stable, all the alpha/beta releases have been extensively tested on Linux and macOS for the past 2 years

2 Likes

I’m not sure what symlink behavior you are referring to but keep in mind that MSYS2 (used by DkML) has a philosophy and implementation details that are quite different than Cygwin (the default for opam 2.2): https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/ … “Replacement of symlinks with copying, so that Windows programs don’t trip up on these files.”.


Aside 1: I have a few Windows patches for ocamlbuild that would require significant ocamlbuild rewrites (and some breakage) to upstream, and regardless it isn’t worth it to upstream because ocamlbuild looks like it is unmaintained. Anyway, the ocamlbuild patches are in https://github.com/diskuv/diskuv-opam-repository/tree/2.1.0


Aside 2: DkML takes every effort to avoid requiring administrative permissions. In many environments, especially schools and school-provided laptops, administrative permissions are a showstopper (at least where I’m from). Visual Studio is the last major piece of DkML that requires admin, and there is a workaround (using the same technique that Rust does) that may eventually be incorporated. Anyway, I hope we aren’t backing ourselves into a permanent one-way door by requiring admin.

1 Like

Being one of the ocamlbuild maintainers (currently too busy on opam do to this work myself) I can assure you that upstream ocamlbuild with Windows support will definitely happen during the 2.2.0 Release Candidate period.

The current focus is on upstreaming the compiler in opam-repository, once that’s done and we have a Windows CI in opam-repository, we should be able to have someone working on upstreaming the patches to at least a couple of key packages which includes ocamlbuild.

2 Likes

I have made VS Code + Ocaml Platform + OPAM 2.2.0 + ocaml-lsp-server working. Simply add the C:\Cygwin\usr\local\bin to the PATH and launch VS Code.

But it has worked only after a VS Code update. It could be a coincidence. (My initial try was launching VS Code from Cygwin to be sure it has the right environment). The opam bin path is enough.

Emacs + merlin would need more tweak. The Cygwin Emacs is puzzled by Windows style path given by opam… and the Windows Emacs miss a /bin/sh required by merlin.

PS: ocp-indent also need the symlink support (CYGWIN variable + elevated rights)… but fails even with the real symlink configuration+privileges

1 Like

I had a new issue… compiling dune with a MSVC toolchain uses LINK which is in conflict with the Cygwin link command. This is a known issue. ocaml/README.win32.adoc at trunk · ocaml/ocaml · GitHub

I guess when the final 2.2.0 will be announced, the different issues, installation requirements… will be described in a more obvious place.