I’d like to add
(modes (byte exe)) to
(executable) section of “dune” file if an environment variable is set or command line argument is provided.
However I couldn’t find anything related in the dune manual. Is it even possible?
dune build path/to/executable.bc
dune build path/to/executable.exe
That’s not possible directly. Can you describe a bit more why you need to switch
(modes) in this way?
By default we build native binary (for release, for ci and for development). But sometimes I need to switch to bytecode for interactive debugging.
dune knows about both types of executable without the need to change
(modes): you can run
dune build path/to/my_executable.bc to build a bytecode version (where you would put
dune build path/to/my_executable.exe).
Would that work for your use case?
Unfortunately that doesn’t work for me. I get “Error: Don’t know how to build path/to/my_executable.byte” while “dune build path/to/my_executable.exe” is built successfully.
Yep, that works.
Thanks, @emillon and @SkySkimmer !
Hm. That seems to be different than specifying “(modes (byte exe))” in dune file.
With “dune build path/my_executable.bc” I get following error:
Error: Error on dynamically loaded library: ./libs/extc/dllextc_stubs.so: ./libs/extc/dllextc_stubs.so: undefined symbol: inflate
“extc” is a library with its own “dune” file defined like this:
Yes, thanks! Too many years with ocamlbuild