I encountered a surprising error when working with a custom compiler recently. It 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
$ 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 (otoolis 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)
I encountered a surprising error when working with a custom compiler recently. It looks like the compiler is expecting headers for
libzstdto 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:
5.1libzstdinstalled withbrewSteps to reproduce:
zstdlibrary withbrew(in my case from1.5.2to1.5.5)Output of
ocamlc -config:Output of
otool -L _opam/bin/ocamlopt.opt(otoolis alddequivalent)