I set out to use virtual modules to present my library as a virtual library with two implementations:
I also found the manual unclear about virtual libraries; it claims to do what I want (example of libraries clock.unix and clock.win) but the example is not detailed and it took several days of failed attempts to get to something that might work (though it shows the bug below). I wonder if I am doing things correctly and, if not, what is the intended use.
Internal error, please report upstream including the contents of _build/log.
Description:
("External.cm_dir",
{ t =
{ public_dir = In_build_dir "default/src/nothreads"
; private_dir = None
; public_cmi_ocaml_dir = None
; melange_dir = In_build_dir "default/src/nothreads/melange"
; public_cmi_melange_dir = None
}
})
Raised at Stdune__Code_error.raise in file
"otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from
Dune_rules__Install_rules.Stanzas_to_entries.lib_install_files.(fun) in
file "src/dune_rules/install_rules.ml", line 253, characters 21-71
Called from
Dune_rules__Install_rules.Stanzas_to_entries.lib_install_files.set_dir.(fun)
in file "src/dune_rules/install_rules.ml", line 285, characters 59-75
Called from Stdlib__List.rev_map.rmap_f in file "list.ml", line 103,
characters 22-25
Called from Stdune__List.rev_concat_map.aux in file
"otherlibs/stdune/src/list.ml", line 54, characters 15-18
Called from Dune_rules__Install_rules.Stanzas_to_entries.lib_install_files in
file "src/dune_rules/install_rules.ml", line 304, characters 8-138
Called from Fiber__Core.O.(>>|).(fun) in file "vendor/fiber/src/core.ml",
line 253, characters 36-41
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
line 76, characters 8-11
-> required by ("stanzas-to-entries", "default")
-> required by ("symlinked_entries", ("default", "memprof-limits"))
-> required by ("Rule.make", ())
-> required by ("execute-rule", { id = 2; info = Internal })
-> required by ("<unnamed>", ())
-> required by ("build-file", In_build_dir "default/memprof-limits.install")
-> required by
("build_file_selector",
{ dir = In_build_dir "default"
; predicate = True
; only_generated_files = false
})
-> required by ("<unnamed>", ())
-> required by
("build-alias", { dir = In_build_dir "default"; name = "all" })
-> required by ("<unnamed>", ())
-> required by
("build-alias", { dir = In_build_dir "default"; name = "default" })
-> required by ("toplevel", ())
I must not crash. Uncertainty is the mind-killer. Exceptions are the
little-death that brings total obliteration. I will fully express my cases.
Execution will pass over me and through me. And when it has gone past, I
will unwind the stack along its path. Where the cases are handled there will
be nothing. Only I will remain.
Internal error, please report upstream including the contents of _build/log.
Description:
("External.cm_dir",
{ t =
{ public_dir = In_build_dir "default/src/threads"
; private_dir = None
; public_cmi_ocaml_dir = None
; melange_dir = In_build_dir "default/src/threads/melange"
; public_cmi_melange_dir = None
}
})
Raised at Stdune__Code_error.raise in file
"otherlibs/stdune/src/code_error.ml", line 10, characters 30-62
Called from
Dune_rules__Install_rules.Stanzas_to_entries.lib_install_files.(fun) in
file "src/dune_rules/install_rules.ml", line 253, characters 21-71
Called from
Dune_rules__Install_rules.Stanzas_to_entries.lib_install_files.set_dir.(fun)
in file "src/dune_rules/install_rules.ml", line 285, characters 59-75
Called from Stdlib__List.rev_map.rmap_f in file "list.ml", line 103,
characters 22-25
Called from Stdune__List.rev_concat_map.aux in file
"otherlibs/stdune/src/list.ml", line 54, characters 15-18
Called from Dune_rules__Install_rules.Stanzas_to_entries.lib_install_files in
file "src/dune_rules/install_rules.ml", line 304, characters 8-138
Called from Fiber__Core.O.(>>|).(fun) in file "vendor/fiber/src/core.ml",
line 253, characters 36-41
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
line 76, characters 8-11
-> required by ("stanzas-to-entries", "default")
-> required by ("symlinked_entries", ("default", "memprof-limits"))
-> required by ("Rule.make", ())
-> required by ("execute-rule", { id = 2; info = Internal })
-> required by ("<unnamed>", ())
-> required by ("build-file", In_build_dir "default/memprof-limits.install")
-> required by
("build_file_selector",
{ dir = In_build_dir "default"
; predicate = True
; only_generated_files = false
})
-> required by ("<unnamed>", ())
-> required by
("build-alias", { dir = In_build_dir "default"; name = "all" })
-> required by ("<unnamed>", ())
-> required by
("build-alias", { dir = In_build_dir "default"; name = "default" })
-> required by ("toplevel", ())
I set out to use virtual modules to present my library as a virtual library with two implementations:
memprof-limits.threads);memprof-limits.nothreads).The current state of my implementation is available here (branch virtual_lib): https://gitlab.com/gadmm/memprof-limits/-/tree/virtual_lib?ref_type=heads, more precisely the following commit introduces the virtual modules: https://gitlab.com/gadmm/memprof-limits/-/commit/fc96f08aa54c87e5897e72b5a92104be02e0c143
As a control, I created a version that uses virtual modules but does not declare public names for the libraries (branch virtual_lib.nocrash): https://gitlab.com/gadmm/memprof-limits/-/tree/virtual_lib.nocrash?ref_type=heads, more precisely the following commit: https://gitlab.com/gadmm/memprof-limits/-/commit/751890860b8e6107bc9afc9029c30fc2a2a902f2
I also found the manual unclear about virtual libraries; it claims to do what I want (example of libraries
clock.unixandclock.win) but the example is not detailed and it took several days of failed attempts to get to something that might work (though it shows the bug below). I wonder if I am doing things correctly and, if not, what is the intended use.Expected Behavior
dune buildanddune testsuccessfully complete in the same way with both branches when using ocaml 4 (e.g. 4.14).Actual Behavior
dune buildanddune testsucceed with the branch virtual_lib.nocrash. However, for the branch virtual_lib (addingpublic_names), dune outputs the following message:Nevertheless the library appears to compile and the tests do succeed after this initial error message.
Please find attached _build/log.
Reproduction
git clone -b virtual_lib --single-branch https://gitlab.com/gadmm/memprof-limits.gitcd memprof-limitsdune buildordune testSpecifications
dune(output ofdune --version): 3.15.3ocaml(output ofocamlc --version): 4.14.0Additional information
dunewith the--verboseflag):dune build --verbose > verbose.txt 2>&1