-
Notifications
You must be signed in to change notification settings - Fork 470
Linker is invoked from unexpected directory #7146
Copy link
Copy link
Open
Description
Expected Behavior
If a library specifies custom linker flags in (c_library_flags ...) which reference files relative to the directory containing the dune file, those files should be discoverable by the linker. For example, if I have a project with a static library src/libfoo.a and src/dune is
(library
...
(c_library_flags :standard -lfoo -L.))
...or...
(library
...
(c_library_flags :standard -lfoo -L%{project_root}/src))
...the linker should be able to find the archive libfoo.a.
Actual Behavior
The linker can't find the library: cannot find -lfoo: No such file or directory. This is because the linker is not invoked from the directory containing the dune file, and %{project_root} resolves to a relative path (relative to the directory containing the dune).
Reproduction
- PR with a reproducing test: Repro for #7146: Linker is invoked from unexpected directory #7147
Specifications
- Version of
dune(output ofdune --version): 3.7 - Version of
ocaml(output ofocamlc --version): 4.14.0 - Operating system (distribution and version): NixOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels