Jbuilder hello_world example error

I cloned jbuilder, cd’ed to jbuilder/example/sample-projects/hello_world, and entered jbuilder build @install, as specified in README.org in that directory. I get this error:

No rule found for alias example/sample-projects/hello_world/install

This is with OCaml 4.05.0 after opam update and opam upgrade. I tried deleting this sexp from bin/jbuild:

 ((section bin)
  (files ((main.exe as hello_world)))))

I also tried deleting "@install" near the end of hello_world.opam… I don’t yet now what these do, but the modifications seemed worth trying, if only to see what new error was generated. Neither of those modifications made a difference: The original error remained, and was the only one.

(Not sure if this should be in the Build category, or if I should just file an issue, but since I’m just starting with jbuilder, I suspect that the problem is at my end, so it seemed appropriate for the Learn category.)

Looks like a bug to me:

/p/t/j/e/s/hello_world$ jbuilder build bin/main.exe
Don't know how to build example/sample-projects/hello_world/bin/main.exe

/p/t/j/e/s/hello_world$ jbuilder build --root=. bin/main.exe
/p/t/j/e/s/hello_world$ ./_build/default/bin/main.exe 
Hello, world!

Moving the example directory outside of the main jbuilder tree also fixes it. It’s probably related to the jbuild-ignore file. I’d suggest filing an issue anyway; it’s certainly confusing.

1 Like

Thanks @talex5. Yes, adding --root="." fixes the problem for me. I submitted an issue.

I stumbled upon the same problem. Could you please link to the issue you submitted?

EDIT I found two issues related to the hello_world project, both still open (Jan 2018):

The second issue, #240, is the one I opened, fwiw.