Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enabled_if not masking a library target #5505

Closed
avsm opened this issue Mar 6, 2022 · 1 comment · Fixed by #7899
Closed

enabled_if not masking a library target #5505

avsm opened this issue Mar 6, 2022 · 1 comment · Fixed by #7899
Assignees
Milestone

Comments

@avsm
Copy link
Member

avsm commented Mar 6, 2022

eio has the following dune file frag:

(test
 (name test)
 (package eio_linux)
 (enabled_if (= %{system} "linux"))
 (modules test)
 (libraries alcotest eio_linux))

doing a build on macos results in this error:

File "lib_eio_linux/tests/dune", line 30, characters 21-30:
30 |  (libraries alcotest eio_linux))
                          ^^^^^^^^^
Error: Library "eio_linux" in _build/default/lib_eio_linux is hidden
(unsatisfied 'enabled_if').
-> required by _build/default/lib_eio_linux/tests/test.bc
-> required by alias lib_eio_linux/tests/all
-> required by alias default

cc @talex5 @patricoferris

It would be good if the exists_if in the dune file stops the library target from being attempted to be resolved.

@emillon
Copy link
Collaborator

emillon commented Mar 24, 2022

I had a look at this, this is only caused in the presence of stubs. Here's a repro case:

  $ cat > dune-project << EOF
  > (lang dune 2.0)
  > EOF

  $ cat > dune << EOF
  > (library
  >  (name l)
  >  (modules l)
  >  (foreign_stubs
  >   (language c)
  >   (names stubs))
  >  (enabled_if false))
  > 
  > (test
  >  (name t)
  >  (modules t)
  >  (libraries l)
  >  (enabled_if false))
  > EOF

  $ touch t.ml l.ml stubs.c

  $ dune build

I'll have a look at a possible fix.

@emillon emillon self-assigned this Mar 24, 2022
emillon added a commit to emillon/dune that referenced this issue Mar 24, 2022
When a `(test)` stanza is disabled through `(enabled_if)`, do not create
any rule. This removes spurious "Library X is hidden (unsatisfied
`enabled_if`)" error messages.

Closes: ocaml#5505
Signed-off-by: Etienne Millon <me@emillon.org>
@emillon emillon linked a pull request Mar 24, 2022 that will close this issue
@emillon emillon linked a pull request Jun 19, 2023 that will close this issue
@rgrinberg rgrinberg added this to the 3.9.0 milestone Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants