# Jbuilder hello\_world example error

**URL:** <https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773>\
**Category:** Learning\
**Tags:** jbuilder\
**Created:** [August 27, 2017, 3:27pm UTC](https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773 "2017-08-27T15:27:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mars0i](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mars0i/32/1058_2.png) [@mars0i](https://discuss.ocaml.org/u/mars0i)\
**Post date:** [August 27, 2017, 3:27pm UTC](https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773/1 "2017-08-27T15:27:15Z")

</div>

I cloned [jbuilder](https://github.com/janestreet/jbuilder), cd’ed to jbuilder/example/sample-projects/hello\_world, and entered `jbuilder build @install`, as specified in [README.org](http://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:

```
(install
 ((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.)

---

<div class="post-metadata">

**Author:** ![talex5](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/talex5/32/353_2.png) [@talex5](https://discuss.ocaml.org/u/talex5)\
**Post date:** [August 27, 2017, 4:28pm UTC](https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773/2 "2017-08-27T16:28:34Z")

</div>

Looks like a bug to me:

```nohighlight
/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.

---

<div class="post-metadata">

**Author:** ![mars0i](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mars0i/32/1058_2.png) [@mars0i](https://discuss.ocaml.org/u/mars0i)\
**Post date:** [August 28, 2017, 12:53am UTC](https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773/3 "2017-08-28T00:53:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marco-m](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@marco-m](https://discuss.ocaml.org/u/marco-m)\
**Post date:** [January 10, 2018, 12:45pm UTC](https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773/4 "2018-01-10T12:45:11Z")

</div>

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):

- [https://github.com/janestreet/jbuilder/issues/283](https://github.com/janestreet/jbuilder/issues/283)  
[https://github.com/janestreet/jbuilder/issues/240](https://github.com/janestreet/jbuilder/issues/240)

---

<div class="post-metadata">

**Author:** ![mars0i](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mars0i/32/1058_2.png) [@mars0i](https://discuss.ocaml.org/u/mars0i)\
**Post date:** [January 10, 2018, 4:24pm UTC](https://discuss.ocaml.org/t/jbuilder-hello-world-example-error/773/5 "2018-01-10T16:24:19Z")

</div>

> [@marco-m](#):
>
> 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):
> 
> - [Example (hello\_world) fails to build · Issue #283 · ocaml/dune · GitHub](https://github.com/janestreet/jbuilder/issues/283)  
> [hello\_world: "No rule found for alias ..." · Issue #240 · ocaml/dune · GitHub](https://github.com/janestreet/jbuilder/issues/240)

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