Unable to install some packages with opam on macOS

Hi there,
I’m using a Mac with Homebrew installed which updates my packages. The package zstd had been updated by Homebrew a few days ago and its location is : /opt/homebrew/Cellar/zstd/1.5.6/lib. Unfortunately this update broke opam for some installations and now for example, I’m unable to install ocaml-lsp-server because it says that the

search path ‘/opt/homebrew/Cellar/zstd/1.5.5/lib’ not found

I’ve tried to install older versions of zstd with the brew command but it’s impossible.
So do you know how to say to opam to look after the 1.5.6 version?
Thanks !

In my experience this is due to the ocaml packages referencing the old paths that don’t exist anymore. You’d need to rebuild (opam reinstall) whatever package has linked with zstd. Probably zstandard or zstd.

In fact, zstd is a package install by Homebrew wich is needed to compile with opam so it does not work

I don’t mean the zstd homebrew package, I mean the OCaml package that links to libzstd on your system (which is most likely zstd or zstandard).

It’s a bit unclear what errors here. Is it opam itself ? In which case you might try to reinstall opam with brew.

If you can provide the full log, that would indeed help see better what exactly fails.

Atm, my gut instinct tells me that it’s a repeat of

and that it’s the compiler itself (or packages that got linked with compilers-lib) that fails. If so, opam switch reinstall would fix such issue.

FWIW I just started to see:

[edocs ocamlopt][0]: (b0 log --id 52)
ld: warning: search path '/opt/homebrew/Cellar/zstd/1.5.5/lib' not found

in my build logs and got rid of it by:

opam reinstall ocaml-base-compiler
2 Likes