Stream: Dune devs & users

Topic: generate_module


view this post on Zulip Vadim Zaliva (Oct 12 2021 at 17:33):

I am trying to follow these instructions https://github.com/ocaml/dune/blob/c8974099a47e1cff50c8ff0f7fff8ce601661d28/doc/sites.rst#id8 but getting Error: Unknown constructor generate_module. Does anyone know what it means?

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 17:41):

dune 2.9.1.

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 17:42):

Another observation (bug?) that sites stanza in package does not allow to specify a single site. It expects a list and does not accept a single element one :)

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 17:46):

Exact line (generate_module (name mysites) (sites share))

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 17:48):

ah, I see. Now it is called 'generate_sites_module' :)

view this post on Zulip Paolo Giarrusso (Oct 12 2021 at 20:10):

And I was wondering if the docs were up-to-date, but the newer docs are: https://github.com/ocaml/dune/blob/2.9/doc/sites.rst.

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 20:25):

there is still a problem I am trying to solve: in my case the site is associated with library, not with exectuable. The executable is using library which is using files from site. (it is all in one project). I am trying generate_sites_module in dune file for the library but when I query it at runtime later the site object (similar to Mysites.Sites.themes in the docs) returns empty list.

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 20:30):

install stanza seems to be working and files are installed. Sites ML file has ~encoded field which contains: ~encoded:(Sys.opaque_identity "%%DUNE_PLACEHOLDER:4096:location:share:10:myproject followed by repeating % characters.

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 21:13):

It could be related to this sentence from the documentation: "For promotion it works only if the generated modules are only in the executable (or library statically linked) promoted; generated modules in plugins will not work." but I am unsure how to fix it. Should I somehow "promte the library which contains module generated bygenerate_sites_module ? How?

view this post on Zulip Vadim Zaliva (Oct 12 2021 at 22:46):

Fixed it! It was due to missing --create-install-files

view this post on Zulip Emilio Jesús Gallego Arias (Oct 13 2021 at 12:02):

@Vadim Zaliva don't hesitate to give feedback about sites in the Dune bugtracker, if you feel something should be improved

view this post on Zulip Vadim Zaliva (Oct 13 2021 at 15:47):

will do. so far everything worked out and just required more careful reading of documentation :)


Last updated: Jan 30 2023 at 17:03 UTC