Skip to content
New issue

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

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

Already on GitHub? # to your account

[3.0 opam failures] Could not find the .cmi file #5267

Open
voodoos opened this issue Dec 2, 2021 · 12 comments
Open

[3.0 opam failures] Could not find the .cmi file #5267

voodoos opened this issue Dec 2, 2021 · 12 comments
Assignees

Comments

@voodoos
Copy link
Collaborator

voodoos commented Dec 2, 2021

Package: orun.0.0.1

#=== ERROR while compiling orun.0.0.1 =========================================#
# context              2.1.1 | linux/x86_64 | ocaml-base-compiler.4.12.1 | file:///home/opam/opam-repository
# path                 ~/.opam/4.12+dune3/.opam-switch/build/orun.0.0.1
# command              ~/.opam/opam-init/hooks/sandbox.sh build dune build -p orun -j 31
# exit-code            1
# env-file             ~/.opam/log/orun-20-2a31ad.env
# output-file          ~/.opam/log/orun-20-2a31ad.out
### output ###
# (cd _build/default && /home/opam/.opam/4.12+dune3/bin/ocamlc.opt -w -40 -w -49 -nopervasives -nostdlib -g -bin-annot -I .profiler.objs/byte -no-alias-deps -o .profiler.objs/byte/profiler.cmo -c -impl profiler.ml-gen)
# File "profiler.ml-gen", line 1:
# Error: Could not find the .cmi file for interface profiler.mli.

- (cd _build/default && /home/opam/.opam/4.12+dune3/bin/ocamlc.opt -w -40 -w -49 -nopervasives -nostdlib -g -bin-annot -I .profiler.objs/byte -no-alias-deps -o .profiler.objs/byte/profiler.cmo -c -impl profiler.ml-gen)
- File "profiler.ml-gen", line 1:
- Error: Could not find the .cmi file for interface profiler.mli.

Full log

Parent issue: #5257

@voodoos voodoos added this to the 3.0.0 milestone Dec 2, 2021
@ghost
Copy link

ghost commented Dec 8, 2021

The problem seems to be due to the fact that the library has (modules ) and a module with the library name. Can reproduce with:

$ cat >dune<<EOF
(library
 (name foo)
 (modules ))
EOF
$ touch foo.ml
$ touch foo.mli

However:

  • with (lang dune 3.0) the builds succeed
  • with (lang dune 2.9) the builds fails
  • with (lang dune 2.9) and --sandbox copy the builds succeed

Requires more investigation. /cc @rgrinberg, does this rings a bell?

@ghost ghost added the requires-dune-change label Dec 8, 2021
@ghost ghost assigned rgrinberg Dec 8, 2021
@rgrinberg
Copy link
Member

Here's a more complete reproduction case:

  $ cat >dune-project <<EOF
  > (lang dune 1.2)
  > EOF
  $ cat >dune<<EOF
  > (library
  >  (name foo)
  >  (modules))
  > (executable
  >  (name bar)
  >  (libraries foo))
  > EOF
  $ cat >bar.ml <<EOF
  > module M = Foo
  > EOF
  $ touch foo.ml
  $ touch foo.mli

  $ dune build ./bar.exe --always-show-command-line
  (cd _build/default && /Users/rgrinberg/github/ocaml/dune/_opam/bin/ocamlc.opt
      -w @1..3@5..28@30..39@43@46..47@49..57@61..62-40 -strict-sequence
      -strict-formats -short-paths -keep-locs -w -49 -nopervasives -nostdlib -g
      -bin-annot -I .foo.objs/byte -no-alias-deps -opaque -o
      .foo.objs/byte/foo.cmo -c -impl foo.ml-gen)
  File "foo.ml-gen", line 1:
  Error: Could not find the .cmi file for interface foo.mli.
  [1]

dune is confused because it thinks the source for Foo is from the toplevel module of library foo. The issue can be worked around by setting foo to be (wrapped false).

The problems itself stems from us from creating Modules.t. We assume that the collection modules should include the alias module for wrapped libraries. I think we should just special case empty libraries in Modules.t because they have a few peculiarities we should always keep in mind

rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Dec 14, 2021
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Dec 14, 2021
Treat all empty modules in a consistent way

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jan 10, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jan 10, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jan 21, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jan 21, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jan 21, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit to rgrinberg/jbuilder that referenced this issue Jan 23, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
rgrinberg added a commit that referenced this issue Jan 23, 2022
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: B6DCB61E-4F60-438B-A632-15DCFE3BC268
@rgrinberg
Copy link
Member

I took a look at this again, why did we decide this is a blocker for 3.0? The problem occurs with 2.9.1 in the same manner.

@rgrinberg
Copy link
Member

In any case, there's a simple workaround for this. Just split the stanzas into separate directories.

@rgrinberg
Copy link
Member

And here's the workaround: ocaml-bench/orun#4

@moazzammoriani
Copy link

moazzammoriani commented Apr 21, 2022

Hello, despite the fact that you have seemingly patched this issue @rgrinberg I am still getting this exact error message when trying to install orun with dune

@rgrinberg
Copy link
Member

What command are you using to install orun?

@moazzammoriani
Copy link

opam install orun

@rgrinberg
Copy link
Member

rgrinberg commented Apr 21, 2022 via email

@moazzammoriani
Copy link

oh wait no. I don't think I did.

@rgrinberg
Copy link
Member

rgrinberg commented Apr 21, 2022 via email

@moazzammoriani
Copy link

moazzammoriani commented Apr 22, 2022

Pinning it solved it for me. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants