Skip to content

zstd directory not found after updating the library #12431

@voodoos

Description

@voodoos

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions