ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.64k stars 409 forks source link

jbuilder exec cannot find exe #390

Closed NJBS closed 6 years ago

NJBS commented 6 years ago

When testing out the sample project for jbuilder found here , jbuilder exec doesn't seem to work:

[km@hadron hello_world]$ jbuilder build bin/main.exe
    ocamldep bin/main.depends.ocamldep-output
    ocamldep lib/hello_world.depends.ocamldep-output
      ocamlc lib/hello_world.{cmi,cmo,cmt}
      ocamlc bin/main.{cmi,cmo,cmt}
    ocamlopt lib/hello_world.{cmx,o}
    ocamlopt lib/hello_world.{a,cmxa}
    ocamlopt bin/main.{cmx,o}
    ocamlopt bin/main.exe
[km@hadron hello_world]$ jbuilder exec bin/main.exe
Error: Program "bin/main.exe" not found!

Any ideas on what I'm doing wrong? The binary file is correctly in the _build folder, it just seems like jbuilder exec can't find it.

dra27 commented 6 years ago

jbuilder exec works on "installed" files only, so you needed instead to run jbuilder build @install (or just jbuilder build, as @install is the default target) and then you can run jbuilder exec hello_world which is its installed name (you can see all this in bin/jbuild in the sample).

It's no problem posting questions on our issue tracker, but it's also worth heading over to OCaml's Discource forum, as the issue tracker is read predominantly by jbuilder's developer team, but the forum includes many jbuilder users.

rgrinberg commented 6 years ago

FYI, this will work in master/the next release $ jbuilder exec ./bin/main.exe