Dune 'flags' & 'library_flags'

maybe there’s a typo on the doc. or I’m misunderstanding compiling vs linking…

regarding flags, dune doc. says ‘flags’ field for libraries (executable,s & env) is used at compilation (creating .cm* files), whereas ‘library_flags’ (for library stanza) is said to be used for linking (building archive files), same as ‘link_flags’ but for executable stanza.

in the case of libraries, from the build logs I see that ‘flags’ is used for compiling & for linking as well (‘library_flags’ is used when linking only)

my question is, is there a way to pass flags only for compilation time?
(tho, my libraries are built fine & fast :raised_hands:t4: with current dunes setup)

(a side question:)
using following ‘flags’ field content at linking has no effect on the archives, but is passed along for no reason?
(ocamlc_flags (-g))
(ocamlopt_flags (-g))

Yh, I can’t remember why this is like this. We’d need to look a bit more into the impact of not passing compilation flags to the linking step, but that might be acceptable. Could you open a ticket on github.com/ocaml/dune to track this?

here it is: https://github.com/ocaml/dune/issues/1916