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

Diagnose missing target errors #265

Closed
timbertson opened this issue Sep 23, 2017 · 8 comments · Fixed by #7770
Closed

Diagnose missing target errors #265

timbertson opened this issue Sep 23, 2017 · 8 comments · Fixed by #7770

Comments

@timbertson
Copy link
Contributor

I've been converting a few of my own libraries to use jbuilder. It's gone fairly well so far, so thanks :) (and sorry for the influx of issues, I'll quiet down soon I promise ;))

But a number of times I've hit a wall when jbuilder says "nope", but I can't find a way to get more information about what it tried or why it couldn't do what I asked. Here's an example:

$ jbuilder build _build/default/examples/todomvc/main.bc.js
Don't know how to build _build/default/examples/todomvc/main.bc.js

Well.. there should be a build target there. In these sorts of cases I'd love some flags which enable logging about:

  • what jbuild files it's loading
  • what targets are defined in the given directory
  • if I'm getting really desperate, what targets are defined in the entire workspace

In this case, the only troubleshooting I could do was:

  • ls examples/todomvc/main.ml (yep, it's there)
  • cat examples/todomvc/jbuild (yep, it defines an executable called "main")

At which point I'm pretty much out of ideas.

In the end, I figured out that I had created a bad jbuild-workspace - it was empty (which is documented as equivalent to (context default), but maybe that's not implemented in beta12?). I expect doing any sort of dump of "which targets are defined" would have more quickly pointed to a project-wide issue, as it would have been empty.

I eventually figured it out by trying other targets which had previously worked, and they could no longer be found. This process wasn't obvious either though, since top-level targets still seemed to kind of work (until I did a clean, then they became suspicious):

  • jbuilder build vdoml.install - successfully built the install file, but didn't build any of the files it depends on
  • jbuilder build @install - didn't appear to build anything (but didn't fail either)
@ghost
Copy link

ghost commented Sep 29, 2017

Yh, the empty jbuild-workspace equivalent to (context default) is not released yet. Hopefully we should never end up with a system with 0 rules...

When you request a target that doesn't exist from the command line, jbuilder try to give a hint when it can (Did you mean ...?).

@ghost
Copy link

ghost commented Sep 29, 2017

BTW, one thing that is close to what your are asking is jbuild rules.

@timbertson
Copy link
Contributor Author

"Did you mean" is neat, but it's probably only going to work for typos - if it only gives you zero or one suggestion, it's not likely to be a good debugging aid, where you often want to scan the list of what's available to pick out patterns or surprises.

I tried jbuilder rules, but it wasn't happy:

$ jbuilder rules
Error: External library "utop" not found.
-> required by "src/.utop/jbuild (context default)"
Hint: try: jbuilder external-lib-deps --missing

I don't depend on utop anywhere, and I have a src/ directory but no src/.utop. I'm assuming it's a builtin thing?

$ jbuilder external-lib-deps --missing @install
# (no output)

$ jbuilder external-lib-deps --missing src/.utop/jbuild
Don't know how to build src/.utop/jbuild

@rgrinberg
Copy link
Member

@timbertson utop is necessary for launching utop toplevels ($ jbuilder utop). Its absence shouldn't be breaking $ jbuilder utop though. That's an annoying deficiency.

@rgrinberg
Copy link
Member

What I think might help here is a command to print targets. Would something like $ dune targets <dir> be useful for you @timbertson ?

@timbertson
Copy link
Contributor Author

timbertson commented Sep 21, 2018 via email

@rgrinberg
Copy link
Member

The team is pretty busy at the moment, so it's unlikely that we'll get to tackle this in the near/medium future. But if you'd like we can guide on how to implement this feature. It shouldn't be too difficult.

@timbertson
Copy link
Contributor Author

timbertson commented Sep 22, 2018 via email

Alizter added a commit to Alizter/dune that referenced this issue May 21, 2023
fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue May 22, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 8, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 16, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 16, 2023
Add a dune targets command similar to ls that prints the available
targets in a given directory.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 16, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 16, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 16, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 16, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter added a commit to Alizter/dune that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix ocaml#265

Co-authored-by: Rudi Grinberg <me@rgrinberg.com>
Signed-off-by: Ali Caglayan <alizter@gmail.com>
rgrinberg pushed a commit that referenced this issue Jun 17, 2023
Add a `dune show targets` and `dune show aliases` command for showing
targets and aliases in a directory like `ls`.

fix #265

Signed-off-by: Ali Caglayan <alizter@gmail.com>
emillon added a commit to emillon/opam-repository that referenced this issue Jun 23, 2023
CHANGES:

- Validate file extension for `$ dune ocaml top-module`. (ocaml/dune#8005, fixes ocaml/dune#8004, @3Rafal)

- Include the time it takes to read/write state files when `--trace-file` is
  enabled (ocaml/dune#7960, @rgrinberg)

- Add `dune show` command group which is an alias of `dune describe`. (ocaml/dune#7946,
  @Alizter)

- Include source tree scans in the traces produced by `--trace-file` (ocaml/dune#7937,
  @rgrinberg)

- Cinaps: The promotion rules for cinaps would only offer one file at a time no
  matter how many promotions were available. Now we offer all the promotions at
  once (ocaml/dune#7901, @rgrinberg)

- Do not re-run OCaml syntax files on every iteration of the watch mode. This
  is too memory consuming. (ocaml/dune#7894, fix ocaml/dune#6900, @rgrinberg)

- Remove some compatibility code for old version of dune that generated
  `.merlin` files. Now dune will never remove `.merlin` files automatically
  (ocaml/dune#7562)

- Add `dune show env` command and make `dune printenv` an alias of it. (ocaml/dune#7985,
  @Alizter)

- Add additional metadata to the traces provided by `--trace-file` whenever
  `--trace-extended` is passed (ocaml/dune#7778, @rleshchinskiy)

- Extensions used in `(dialect)` can contain periods (e.g., `cppo.ml`). (ocaml/dune#7782,
  fixes ocaml/dune#7777, @nojb)

- Allow `(include_subdirs qualified)` to be used when libraries define a
  `(modules ...)` field (ocaml/dune#7797, fixes ocaml/dune#7597, @anmonteiro)

- `$ dune describe` is now a command group, so arguments to subcommands must be
  passed after subcommand itself. (ocaml/dune#7919, @Alizter)

- The `interface` and `implementation` fields of a `(dialect)` are now optional
  (ocaml/dune#7757, @gpetiot)

- Add commands `dune show targets` and `dune show aliases` that display all the
  available targets and aliases in a given directory respectively. (ocaml/dune#7770,
  grants ocaml/dune#265, @Alizter)

- Allow multiple globs in library's `(stdlib (internal_modules ..))`
  (@anmonteiro, ocaml/dune#7878)

- Attach melange rules to the default alias (ocaml/dune#7926, @haochenx)

- In opam constraints, reject `(and)` and `(or)` with no arguments at parse
  time (ocaml/dune#7730, @emillon)

- Compute digests and manage sandboxes in background threads (ocaml/dune#7947,
  @rgrinberg)

- Add `(build_if)` to the `(test)` stanza. When it evaluates to false, the
  executable is not built. (ocaml/dune#7899, fixes ocaml/dune#6938, @emillon)

- Add necessary parentheses in generated opam constraints (ocaml/dune#7682, fixes ocaml/dune#3431,
  @Lucccyo)
emillon added a commit to emillon/opam-repository that referenced this issue Jun 28, 2023
CHANGES:

- Validate file extension for `$ dune ocaml top-module`. (ocaml/dune#8005, fixes ocaml/dune#8004, @3Rafal)

- Include the time it takes to read/write state files when `--trace-file` is
  enabled (ocaml/dune#7960, @rgrinberg)

- Add `dune show` command group which is an alias of `dune describe`. (ocaml/dune#7946,
  @Alizter)

- Include source tree scans in the traces produced by `--trace-file` (ocaml/dune#7937,
  @rgrinberg)

- Cinaps: The promotion rules for cinaps would only offer one file at a time no
  matter how many promotions were available. Now we offer all the promotions at
  once (ocaml/dune#7901, @rgrinberg)

- Do not re-run OCaml syntax files on every iteration of the watch mode. This
  is too memory consuming. (ocaml/dune#7894, fix ocaml/dune#6900, @rgrinberg)

- Add `--all` option to `dune rpc status` to show all Dune RPC servers running.
  (ocaml/dune#8011, fix ocaml/dune#7902, @Alizter)

- Remove some compatibility code for old version of dune that generated
  `.merlin` files. Now dune will never remove `.merlin` files automatically
  (ocaml/dune#7562)

- Add `dune show env` command and make `dune printenv` an alias of it. (ocaml/dune#7985,
  @Alizter)

- Add additional metadata to the traces provided by `--trace-file` whenever
  `--trace-extended` is passed (ocaml/dune#7778, @rleshchinskiy)

- Extensions used in `(dialect)` can contain periods (e.g., `cppo.ml`). (ocaml/dune#7782,
  fixes ocaml/dune#7777, @nojb)

- Allow `(include_subdirs qualified)` to be used when libraries define a
  `(modules ...)` field (ocaml/dune#7797, fixes ocaml/dune#7597, @anmonteiro)

- `$ dune describe` is now a command group, so arguments to subcommands must be
  passed after subcommand itself. (ocaml/dune#7919, @Alizter)

- The `interface` and `implementation` fields of a `(dialect)` are now optional
  (ocaml/dune#7757, @gpetiot)

- Add commands `dune show targets` and `dune show aliases` that display all the
  available targets and aliases in a given directory respectively. (ocaml/dune#7770,
  grants ocaml/dune#265, @Alizter)

- Allow multiple globs in library's `(stdlib (internal_modules ..))`
  (@anmonteiro, ocaml/dune#7878)

- Attach melange rules to the default alias (ocaml/dune#7926, @haochenx)

- In opam constraints, reject `(and)` and `(or)` with no arguments at parse
  time (ocaml/dune#7730, @emillon)

- Compute digests and manage sandboxes in background threads (ocaml/dune#7947,
  @rgrinberg)

- Add `(build_if)` to the `(test)` stanza. When it evaluates to false, the
  executable is not built. (ocaml/dune#7899, fixes ocaml/dune#6938, @emillon)

- Add necessary parentheses in generated opam constraints (ocaml/dune#7682, fixes ocaml/dune#3431,
  @Lucccyo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants