Skip to content

Diagnose missing target errors #265

Closed

Description

@timbertson

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)

Activity

  1. timbertson commented on Oct 2, 2017

    @timbertson
    ContributorAuthor

    "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
    
  2. rgrinberg commented on Oct 10, 2017

    @rgrinberg
    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.

  3. rgrinberg commented on Sep 21, 2018

    @rgrinberg
    Member

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

  4. timbertson commented on Sep 21, 2018

    @timbertson
    ContributorAuthor
  5. rgrinberg commented on Sep 21, 2018

    @rgrinberg
    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.

  6. added
    good first issue
    on Sep 21, 2018
  7. timbertson commented on Sep 22, 2018

    @timbertson
    ContributorAuthor
  8. 9 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions