Risc42
April 5, 2024, 7:28am
1
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
.
Risc42
April 5, 2024, 10:30am
3
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
opened 01:31PM - 26 Jul 23 UTC
closed 10:58AM - 04 Aug 23 UTC
I encountered a surprising error when working with a custom compiler recently. I… t looks like the compiler is expecting headers for `libzstd` to be in a directory that might change when the lib is updated. I don't now if this is the expected behaviour, but it feels wrong to have to re-configure and re-build the compiler after such an update.
Environment:
- Platform: Mac M1
- Compiler version: a branch based on `5.1`
- `libzstd` installed with `brew`
Steps to reproduce:
- Configure and build the compiler
- Update the `zstd` library with `brew` (in my case from `1.5.2` to `1.5.5`)
- Link an executable with the compiler
```shell
$ echo "print_int 42" > main.ml
$ ocamlopt.opt main.ml
ld: warning: directory not found for option '-L/opt/homebrew/Cellar/zstd/1.5.2/lib'
ld: library not found for -lzstd
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
```
Output of `ocamlc -config`:
```
bytecomp_c_libraries: -L/opt/homebrew/Cellar/zstd/1.5.2/lib -lzstd -lm -lpthread
native_c_libraries: -L/opt/homebrew/Cellar/zstd/1.5.2/lib -lzstd -lm -lpthread
```
Output of `otool -L _opam/bin/ocamlopt.opt` (`otool`is a `ldd` equivalent)
```
_opam/bin/ocamlopt.opt:
/opt/homebrew/opt/zstd/lib/libzstd.1.dylib (compatibility version 1.0.0, current version 1.5.2)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
```
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