Dune - object file output is not using -output-complete-obj



I’m on 1.0+beta19.1 and my jbuild file contains the following:

(jbuild_version 1)

(executable (
 (name react_ios)
 (libraries (r2n2))
 (modes (object))

(install (
  (package react_ios)
  (section lib)
  (files (react_ios.o))

I expected the resulting object file to be fully linked. However, it seems like dune passes -c to ocamlopt in the following command (taken from jbuilder build --verbose):

ocamlopt -w -40 -g -I src/bin/.react_ios.eobjs -I src/flex/.flex.objs -I src/lib/.r2n2.objs -intf-suffix .ml -no-alias-deps -o src/bin/.react_ios.eobjs/react_ios.cmx -c -impl src/bin/react_ios.re.ml

It results in a react_ios.o file however it’s not fully linked.


@diml should have a look at this if he has the time. But looking at the tests for output-obj I see taht you’re not quite doing the write thing.

The object file you’re looking for is react_ios.exe${ext_obj}.


Thank you. You’re right. However changing it causes:

No rule found for src/bin/react_ios.exe${ext_obj} (context default.ios)


Probably because the modes were setup differently. The relevant mode those tests is native object.

Btw, what problem do you have with -c being passed? AFAIK that has nothing to do with the kind of object file you’re trying to produce.


Unfortunately, I’ve set the modes in the same way, i.e. (modes ((native object))).

I don’t have a problem with -c being passed per se, I wanted to give as much information as possible.


The various extensions are documented in the manual: http://dune.readthedocs.io/en/latest/jbuild.html#linking-modes.

-c is passed for compiling but not for linking.

For the second problem, it is because we don’t currently expand variables in install stanza, we need to change that.


Thank you. Expanding the extension manually worked.


I will create an issue regarding variable expansion in install stanzas.