opam 2.4 release
Feedback on this post is welcomed on Discuss!
We are extremely happy to announce the release of opam 2.4.0 and encourage all users to upgrade. Please read on for installation and upgrade instructions.
Major changes
-
On
opam initthe compiler chosen for the default switch will no longer beocaml-system(#3509) This was done because the system compiler (as-is your ocaml installed system wide, e.g. /usr/bin/ocaml) is known to be under-tested and prone to a variety of bugs and configuration issues. Removing it from the default compiler allows new-comers a more smooth experience. Note: if you wish to use it anyway, you are always able to do it explicitly usingopam init --compiler=ocaml-system -
GNU
patchand thediffcommand are no longer runtime dependencies. Instead the OCamlpatchlibrary is used (#6019, #6052, #3782, ocaml/setup-ocaml#933) Doing this we've removed some rarely used features of GNU Patch such as the support of Context diffs. The new implementation only supports Unified diffs including the git extended headers, however file permission changes via said extended headers have no effect. -
Add Nix support for external dependencies (depexts) by adding support for stateless package managers (#5982). Thanks to @RyanGibb for this contribution
-
Fix
opam install <local_dir>with and without options like--deps-onlyor--show-actionhaving unexpected behaviours (#6248, #5567) such as:- reporting
Nothing to dodespite dependencies or package not being up-to-date - asking to install the wrong dependencies
- reporting
UI changes
-
opam shownow displays the version number of packages flagged withavoid-version/deprecatedgray (#6354) -
opam upgrade: Do not show the message about packages "not up-to-date" when the package is tagged withavoid-version/deprecated(#6271) -
Fail when trying to pin a package whose definition could not be found instead of forcing interactive edition (e.g. this could happen when making a typo in the package name of a pin-depends) (#6322)
New commands / options
-
Add
opam admin compare-versionsto compare package versions for sanity checks. Thanks to @mbarbin for this contribution -
Add
opam lock --keep-localto keep local pins url inpin-dependsfield (#4897) -
Add
opam admin migrate-extrafileswhich moves allextra-filesof an existing opam repository intoextra-sources. Thanks to @hannesm for this contribution -
The
-i/--ignore-test-docargument has been removed fromopam admin check(#6335)
Other noteworthy changes
-
opam pin/opam pin listnow displays the current revision of a pinned repository in a new column. Thanks to @desumn for this contribution -
Symlinks in repositories are no longer supported (#5892)
-
Fix sandboxing support in NixOS (#6333)
-
Add the
OPAMSOLVERTOLERANCEenvironment variable to allow users to fix solver timeouts for good (#3230) -
Fix a regression on
opam upgrade <package>upgrading unrelated packages (#6373). Thanks to @AltGr for this contribution -
Fix
pin-dependsforwith-*dependencies when creating a lock file (#5428) -
opam admin checknow setswith-testandwith-doctofalseinstead oftrue -
Add
apt-rpm/ALTLinux family support for depexts. Thanks to @RiderALT for this contribution -
Fix the detection of installed external packages on OpenBSD to not just consider manually installed packages (#6362). Thanks to @semarie for this contribution
-
Disable the detection of available system packages on SUSE-based distributions (#6426)
ystem,dune,beginner,dev,new project
Changes
opam switch create [name] <version>will not include compiler packages flagged withavoid-version/deprecatedin the generated invariant anymore (#6494). This will allow opam to avoid the use of theocaml-systempackage unless actually explicitly requested by the user. The opam experience when theocaml-systemcompiler is used is known to be prone to a variety of bugs and configuration issues.- Cygwin: Fallback to the existing
setup-x86_64.exeif its upgrade failed to be fetched (#6495, partial fix for #6474) - Fix a memory leak happening when running large numbers of commands or opening large number of opam files (#6484). Thanks to @hannesm for this contribution
- Remove handling of the
OPAMSTATSenvironment variable (#6485). Thanks to @hannesm for this contribution
Changes
- Fixed some bugs in
opam install --deps-only(and other commands simulating package pins, such as--depext-only) more visible in 2.4:- When a package
pkgis already installed andopam install ./pkg --depsis called, if there is a conflict between the installedpkgdependencies and the definition of the localpkg, the conflict was not seen and the already installedpkgwas kept (#6529) - No longer fetch and write the sources when simulating packages that were already pinned (#6532)
- opam was triggering the reinstall of the package based on the already pinned packages instead of the expected newly simulated pinned packages (#6501)
- opam was using the opam description of the wrong package in some cases (#6535)
- When a package
- Change the behaviour of
--deps-only, where it no longer requires unicity of package version between the request and the installed packages. In other words, if you havepkg.1installed, installing dependencies ofpkg.2no longer removespkg.1. This also allows to install dependencies of conflicting packages when their dependencies are compliant. (#6520)
Windows binary
- Improve the prebuilt Windows binaries by including Cygwin's
setup-x86_64.exein the binary itself as fallback, in casecygwin.comis inaccessible (#6538)
NOTE: this article is cross-posted on opam.ocaml.org and ocamlpro.com.
About OCamlPro:
OCamlPro is a R&D lab founded in 2011, with the mission to help industrial users benefit from experts with a state-of-the-art knowledge of programming languages theory and practice.
- We provide audit, support, custom developer tools and training for both the most modern languages, such as Rust, Wasm and OCaml, and for legacy languages, such as COBOL or even home-made domain-specific languages;
- We design, create and implement software with great added-value for our clients. High complexity is not a problem for our PhD-level experts. For example, we helped the French Income Tax Administration re-adapt and improve their internally kept M language, we designed a DSL to model and express revenue streams in the Cinema Industry, codename Niagara, and we also developed the prototype of the Tezos proof-of-stake blockchain from 2014 to 2018.
- We have a long history of creating open-source projects, such as the Opam package manager, the LearnOCaml web platform, and contributing to other ones, such as the Flambda optimizing compiler, or the GnuCOBOL compiler.
- We are also experts of Formal Methods, developing tools such as our SMT Solver Alt-Ergo (check our Alt-Ergo Users' Club) and using them to prove safety or security properties of programs.
Please reach out, we'll be delighted to discuss your challenges: contact@ocamlpro.com or book a quick discussion.
Most Recent Articles
2025
2024
- opam 2.3.0 release!
- Optimisation de Geneweb, 1er logiciel français de Généalogie depuis près de 30 ans
- Alt-Ergo 2.6 is Out!
- Flambda2 Ep. 3: Speculative Inlining
- opam 2.2.0 release!
- Flambda2 Ep. 2: Loopifying Tail-Recursive Functions
- Fixing and Optimizing the GnuCOBOL Preprocessor
- OCaml Backtraces on Uncaught Exceptions
- Opam 102: Pinning Packages
- Flambda2 Ep. 1: Foundational Design Decisions
- Behind the Scenes of the OCaml Optimising Compiler Flambda2: Introduction and Roadmap
- Lean 4: When Sound Programs become a Choice
- Opam 101: The First Steps
2023