-
Notifications
You must be signed in to change notification settings - Fork 454
Open
Labels
Description
Expected Behavior
When eg. (root_modules root) is used, dune produces a working Root module that reexports all libraries dependencies.
Actual Behavior
The produced module exports Logs and other related modules twice, causing the following error:
dune build --root /tmp/dune/
File "root.ml-gen", line 17, characters 0-18:
17 | module Logs = Logs
^^^^^^^^^^^^^^^^^^
Error: Multiple definition of the module name Logs.
Names must be unique in a given structure or signature.
Reproduction
PR with a reproducing test: #6147
Dockerfile reproducing the error
FROM alpine:3.16.2
RUN apk --no-cache add gcc make musl-dev opam
RUN opam init --compiler="4.14.0" --disable-sandboxing --yes
RUN opam install --yes dune logs lwt
RUN printf > /root/dune-project '(lang dune 3.4)\n'
RUN printf > /root/dune '(library\n\
(name root_module)\n\
(root_module root)\n\
(libraries logs.lwt))\n'
RUN printf > /root/root_module.ml 'module Logs = Root.Logs\n'
RUN eval $(opam env) && cd /root && dune buildSpecifications
- Version of
dune(output ofdune --version):
Shared cache: disabled
Workspace root: /tmp/dune
Auto-detected concurrency: 12
Running[0]: /tmp/dune/_opam/bin/ocamlc.opt -config > /tmp/dune_eef136_output
Dune context:
{ name = "default"
; kind = "default"
; profile = Dev
; merlin = true
; for_host = None
; fdo_target_exe = None
; build_dir = "default"
; toplevel_path = Some External "/tmp/dune/_opam/lib/toplevel"
; ocaml_bin = External "/tmp/dune/_opam/bin"
; ocaml = Ok External "/tmp/dune/_opam/bin/ocaml"
; ocamlc = External "/tmp/dune/_opam/bin/ocamlc.opt"
; ocamlopt = Ok External "/tmp/dune/_opam/bin/ocamlopt.opt"
; ocamldep = Ok External "/tmp/dune/_opam/bin/ocamldep.opt"
; ocamlmklib = Ok External "/tmp/dune/_opam/bin/ocamlmklib.opt"
; env =
map
{ "DUNE_OCAML_HARDCODED" : "/tmp/dune/_opam/lib"
; "DUNE_OCAML_STDLIB" : "/tmp/dune/_opam/lib/ocaml"
; "DUNE_SOURCEROOT" : "/tmp/dune"
; "INSIDE_DUNE" : "/tmp/dune/_build/default"
; "OCAMLFIND_IGNORE_DUPS_IN" : "/tmp/dune/_build/install/default/lib"
; "OCAMLPATH" : "/tmp/dune/_build/install/default/lib"
; "OCAMLTOP_INCLUDE_PATH" :
"/tmp/dune/_build/install/default/lib/toplevel"
; "OCAML_COLOR" : "always"
; "OPAMCOLOR" : "always"
}
; findlib_paths = [ External "/tmp/dune/_opam/lib" ]
; arch_sixtyfour = true
; natdynlink_supported = true
; supports_shared_libraries = true
; ocaml_config =
{ version = "4.14.0"
; standard_library_default = "/tmp/dune/_opam/lib/ocaml"
; standard_library = "/tmp/dune/_opam/lib/ocaml"
; standard_runtime = "the_standard_runtime_variable_was_deleted"
; ccomp_type = "cc"
; c_compiler = "gcc"
; ocamlc_cflags =
[ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread"; "-fPIC" ]
; ocamlc_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
; ocamlopt_cflags =
[ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread"; "-fPIC" ]
; ocamlopt_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
; bytecomp_c_compiler =
[ "gcc"
; "-O2"
; "-fno-strict-aliasing"
; "-fwrapv"
; "-pthread"
; "-fPIC"
; "-D_FILE_OFFSET_BITS=64"
]
; bytecomp_c_libraries = [ "-lm"; "-lpthread" ]
; native_c_compiler =
[ "gcc"
; "-O2"
; "-fno-strict-aliasing"
; "-fwrapv"
; "-pthread"
; "-fPIC"
; "-D_FILE_OFFSET_BITS=64"
]
; native_c_libraries = [ "-lm" ]
; native_pack_linker = [ "ld"; "-r"; "-o" ]
; cc_profile = []
; architecture = "amd64"
; model = "default"
; int_size = 63
; word_size = 64
; system = "linux"
; asm = [ "as" ]
; asm_cfi_supported = true
; with_frame_pointers = false
; ext_exe = ""
; ext_obj = ".o"
; ext_asm = ".s"
; ext_lib = ".a"
; ext_dll = ".so"
; os_type = "Unix"
; default_executable_name = "a.out"
; systhread_supported = true
; host = "x86_64-pc-linux-gnu"
; target = "x86_64-pc-linux-gnu"
; profiling = false
; flambda = false
; spacetime = false
; safe_string = true
; exec_magic_number = "Caml1999X031"
; cmi_magic_number = "Caml1999I031"
; cmo_magic_number = "Caml1999O031"
; cma_magic_number = "Caml1999A031"
; cmx_magic_number = "Caml1999Y031"
; cmxa_magic_number = "Caml1999Z031"
; ast_impl_magic_number = "Caml1999M031"
; ast_intf_magic_number = "Caml1999N031"
; cmxs_magic_number = "Caml1999D031"
; cmt_magic_number = "Caml1999T031"
; natdynlink_supported = true
; supports_shared_libraries = true
; windows_unicode = false
}
}
Actual targets:
- alias @@default
Running[1]: (cd _build/.sandbox/66237914947f915ee42bf707f638bfb4/default && /tmp/dune/_opam/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -w -49 -nopervasives -nostdlib -g -bin-annot -I .root_module.objs/byte -I .root_module.objs/public_cmi -I /tmp/dune/_opam/lib/logs -I /tmp/dune/_opam/lib/lwt -no-alias-deps -opaque -o .root_module.objs/byte/root_module__Root.cmo -c -impl root.ml-gen)
Command [1] exited with code 2:
$ (cd _build/.sandbox/66237914947f915ee42bf707f638bfb4/default && /tmp/dune/_opam/bin/ocamlc.opt -w @1..3@5..28@30..39@43@46..47@49..57@61..62@67@69-40 -strict-sequence -strict-formats -short-paths -keep-locs -w -49 -nopervasives -nostdlib -g -bin-annot -I .root_module.objs/byte -I .root_module.objs/public_cmi -I /tmp/dune/_opam/lib/logs -I /tmp/dune/_opam/lib/lwt -no-alias-deps -opaque -o .root_module.objs/byte/root_module__Root.cmo -c -impl root.ml-gen)
File "root.ml-gen", line 17, characters 0-18:
17 | module Logs = Logs
^^^^^^^^^^^^^^^^^^
Error: Multiple definition of the module name Logs.
Names must be unique in a given structure or signature.
-
Version of
ocaml(output ofocamlc --version):4.14.0 -
Operating system (distribution and version): Gentoo