Skip to content

-I option not passed during development for headers installed by a sibling package from a monorepo #4121

@aantron

Description

@aantron

Expected Behavior

Luv vendors libuv, and installs libuv's header uv.h at lib/luv/uv.h using an install stanza (see also #3907 about this stanza).

When a project that depends on package luv is compiled, Dune correctly passes -I path/to/switch/lib/luv when compiling the project's C files, which allows them to pull in uv.h with #include <uv.h>.

I recently added package luv_unix to the Luv repo (in branch unix), which depends on luv and needs uv.h. After pinning everything, doing

opam install luv
opam install luv_unix

works, because the package installations are separate, and uv.h is in the switch by the time luv_unix is installed.

The expected behavior is that during development,

dune build

or some variation on it, should also work. luv_unix should be able to find uv.h.

Actual Behavior

$ dune build
         gcc src/unix/luv_unix.o (exit 1)
luv_unix.c:9:10: fatal error: uv.h: No such file or directory
    9 | #include <uv.h>
      |          ^~~~~~
compilation terminated.

This can be seen immediately in Travis logs. The command failing there is trying to build Luv's tester, which in branch unix depends on luv_unix.

Reproduction

opam pin add luv https://github.com/aantron/luv.git#unix
opam pin add luv_unix https://github.com/aantron/luv.git#unix
opam install luv luv_unix
opam remove luv luv_unix
git clone https://github.com/aantron/luv.git
cd luv
make test   # or dune build -p luv,luv_unix, etc.

Specifications

  • Version of dune (output of dune --version): 2.8.1
  • Version of ocaml (output of ocamlc --version): 4.11.1
  • Operating system (distribution and version): Ubuntu 20.04 on WSL1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions