Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate key: compiler-libs.toplevel #4328

Closed
jamesjer opened this issue Mar 8, 2021 · 6 comments
Closed

Duplicate key: compiler-libs.toplevel #4328

jamesjer opened this issue Mar 8, 2021 · 6 comments

Comments

@jamesjer
Copy link
Contributor

jamesjer commented Mar 8, 2021

I just updated dune to version 2.8.3 for Fedora Rawhide. Immediately after, the base build started failing.

Expected Behavior

The base build should succeed.

Actual Behavior

$ dune build -j8
Internal error, please report upstream including the contents of _build/log.
Description:
  ("Map.add_exn: key already exists", { key = "compiler-libs.toplevel" })
Raised at Stdune__Code_error.raise in file "src/stdune/code_error.ml", line
  9, characters 30-62
Called from Stdlib__map.Make.update in file "map.ml", line 283, characters
  18-28
Called from Stdlib__map.Make.update in file "map.ml", line 291, characters
  21-33
Called from Stdlib__map.Make.update in file "map.ml", line 291, characters
  21-33
Called from Dune_rules__Findlib.Loader.dune_package_of_meta.loop in file
  "src/dune_rules/findlib/findlib.ml", line 460, characters 8-70
Called from Stdlib__list.fold_left in file "list.ml", line 121, characters
  24-34
Called from Dune_rules__Findlib.Loader.dune_package_of_meta in file
  "src/dune_rules/findlib/findlib.ml", line 473, characters 6-79
Called from Dune_rules__Findlib.Loader.lookup_and_load.loop.(fun) in file
  "src/dune_rules/findlib/findlib.ml", line 536, characters 28-50
Called from Dune_rules__Findlib.find_root_package in file
  "src/dune_rules/findlib/findlib.ml", line 568, characters 14-43
Called from Dune_rules__Findlib.find in file
  "src/dune_rules/findlib/findlib.ml", line 574, characters 11-59
Called from Dune_rules__Lib.DB.create_from_findlib.(fun) in file
  "src/dune_rules/lib.ml", line 1795, characters 14-39
Called from Dune_rules__Lib.Resolve.resolve_name in file
  "src/dune_rules/lib.ml", line 1247, characters 10-25
Called from Dune_rules__Lib.Resolve.resolve_name in file
  "src/dune_rules/lib.ml", line 1261, characters 21-49
Called from Dune_rules__Lib.Resolve.resolve_name in file
  "src/dune_rules/lib.ml", line 1261, characters 21-49
Called from Dune_rules__Lib.Resolve.resolve_dep in file
  "src/dune_rules/lib.ml", line 1239, characters 10-38
Called from Dune_rules__Lib.Resolve.resolve_complex_deps.(fun) in file
  "src/dune_rules/lib.ml", line 1357, characters 25-72
Called from Stdlib__list.fold_left in file "list.ml", line 121, characters
  24-34
Called from Dune_rules__Lib.Resolve.resolve_complex_deps in file
  "src/dune_rules/lib.ml", line 1339, characters 6-1023
Called from Dune_rules__Lib.Resolve.instantiate in file
  "src/dune_rules/lib.ml" (inlined), line 1139, characters 9-96
Called from Dune_rules__Lib.Resolve.instantiate in file
  "src/dune_rules/lib.ml", line 1138, characters 6-125
Called from Dune_rules__Lib.DB.find_even_when_hidden in file
  "src/dune_rules/lib.ml", line 1822, characters 10-61
Called from Dune_rules__Odoc.init.(fun) in file "src/dune_rules/odoc.ml",
  line 669, characters 17-104
Called from Stdune__List.filter_map.loop in file "src/stdune/list.ml", line
  19, characters 12-15
Called from Stdlib__list.rev_map.rmap_f in file "list.ml", line 103,
  characters 22-25
Called from Stdune__List.map in file "src/stdune/list.ml" (inlined), line 5,
  characters 19-33
Called from Stdune__List.concat_map in file "src/stdune/list.ml", line 40,
  characters 29-39
Called from Dune_rules__Odoc.init in file "src/dune_rules/odoc.ml" (inlined),
  line 662, characters 7-549
Called from Dune_rules__Odoc.init in file "src/dune_rules/odoc.ml", line 661,
  characters 6-563
Called from Stdlib__map.Make.iter in file "map.ml", line 297, characters
  20-25
Called from Stdune__Exn.protectx in file "src/stdune/exn.ml", line 12,
  characters 8-11
Re-raised at Stdune__Exn.protectx in file "src/stdune/exn.ml", line 18,
  characters 4-11
Called from Memo__Implicit_output.collect_sync in file
  "src/memo/implicit_output.ml", line 119, characters 4-162
Called from Dune_engine__Rules.collect_opt in file "src/dune_engine/rules.ml"
  (inlined), line 188, characters 20-71
Called from Dune_engine__Rules.collect in file "src/dune_engine/rules.ml",
  line 191, characters 20-33
Called from Dune_engine__Build_system.set_rule_generators in file
  "src/dune_engine/build_system.ml", line 405, characters 23-41
Called from Dune_rules__Gen_rules.gen in file "src/dune_rules/gen_rules.ml",
  line 434, characters 2-387
Called from Fiber.Execution_context.safe_run_k in file "src/fiber/fiber.ml",
  line 129, characters 18-21

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.
$ cat _build/log
# dune build -j8
# OCAMLPARAM: unset
# Workspace root: /builddir/build/BUILD/base-0.14.1
# disable binary cache
$ /usr/bin/ocamlc.opt -config > /tmp/dune73c644.output
# Dune context:
#  { name = "default"
#  ; kind = "default"
#  ; profile = Dyn
#  ; merlin = true
#  ; for_host = None
#  ; fdo_target_exe = None
#  ; build_dir = "default"
#  ; toplevel_path = None
#  ; ocaml_bin = External "/usr/bin"
#  ; ocaml = Ok External "/usr/bin/ocaml"
#  ; ocamlc = External "/usr/bin/ocamlc.opt"
#  ; ocamlopt = Ok External "/usr/bin/ocamlopt.opt"
#  ; ocamldep = Ok External "/usr/bin/ocamldep.opt"
#  ; ocamlmklib = Ok External "/usr/bin/ocamlmklib.opt"
#  ; env =
#      map
#        { "CAML_LD_LIBRARY_PATH" :
#            "/builddir/build/BUILD/base-0.14.1/_build/install/default/lib/stublibs"
#        ; "DUNE_OCAML_HARDCODED" : "/usr/lib64/ocaml"
#        ; "DUNE_OCAML_STDLIB" : "/usr/lib64/ocaml"
#        ; "DUNE_SOURCEROOT" : "/builddir/build/BUILD/base-0.14.1"
#        ; "INSIDE_DUNE" : "/builddir/build/BUILD/base-0.14.1/_build/default"
#        ; "MANPATH" :
#            "/builddir/build/BUILD/base-0.14.1/_build/install/default/bin"
#        ; "OCAMLFIND_IGNORE_DUPS_IN" :
#            "/builddir/build/BUILD/base-0.14.1/_build/install/default/lib"
#        ; "OCAMLPATH" :
#            "/builddir/build/BUILD/base-0.14.1/_build/install/default/lib"
#        ; "OCAMLTOP_INCLUDE_PATH" :
#            "/builddir/build/BUILD/base-0.14.1/_build/install/default/lib/toplevel"
#        }
#  ; findlib_path = [ External "/usr/lib64/ocaml" ]
#  ; arch_sixtyfour = true
#  ; natdynlink_supported = true
#  ; supports_shared_libraries = true
#  ; ocaml_config =
#      { version = "4.12.0"
#      ; standard_library_default = "/usr/lib64/ocaml"
#      ; standard_library = "/usr/lib64/ocaml"
#      ; standard_runtime = "the_standard_runtime_variable_was_deleted"
#      ; ccomp_type = "cc"
#      ; c_compiler = "gcc"
#      ; ocamlc_cflags =
#          [ "-O2"
#          ; "-fno-strict-aliasing"
#          ; "-fwrapv"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ; "-fPIC"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ]
#      ; ocamlc_cppflags = [ "-D_FILE_OFFSET_BITS=64"; "-D_REENTRANT" ]
#      ; ocamlopt_cflags =
#          [ "-O2"
#          ; "-fno-strict-aliasing"
#          ; "-fwrapv"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ; "-fPIC"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ]
#      ; ocamlopt_cppflags = [ "-D_FILE_OFFSET_BITS=64"; "-D_REENTRANT" ]
#      ; bytecomp_c_compiler =
#          [ "gcc"
#          ; "-O2"
#          ; "-fno-strict-aliasing"
#          ; "-fwrapv"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ; "-fPIC"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ; "-D_FILE_OFFSET_BITS=64"
#          ; "-D_REENTRANT"
#          ]
#      ; bytecomp_c_libraries =
#          [ "-Wl,-z,relro"
#          ; "-Wl,--as-needed"
#          ; "-Wl,-z,now"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
#          ; "-lm"
#          ; "-ldl"
#          ; "-lpthread"
#          ]
#      ; native_c_compiler =
#          [ "gcc"
#          ; "-O2"
#          ; "-fno-strict-aliasing"
#          ; "-fwrapv"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ; "-fPIC"
#          ; "-O2"
#          ; "-flto=auto"
#          ; "-ffat-lto-objects"
#          ; "-fexceptions"
#          ; "-g"
#          ; "-grecord-gcc-switches"
#          ; "-pipe"
#          ; "-Wall"
#          ; "-Werror=format-security"
#          ; "-Wp,-D_FORTIFY_SOURCE=2"
#          ; "-Wp,-D_GLIBCXX_ASSERTIONS"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1"
#          ; "-fstack-protector-strong"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1"
#          ; "-m64"
#          ; "-mtune=generic"
#          ; "-fasynchronous-unwind-tables"
#          ; "-fstack-clash-protection"
#          ; "-fcf-protection"
#          ; "-D_FILE_OFFSET_BITS=64"
#          ; "-D_REENTRANT"
#          ]
#      ; native_c_libraries =
#          [ "-Wl,-z,relro"
#          ; "-Wl,--as-needed"
#          ; "-Wl,-z,now"
#          ; "-specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
#          ; "-lm"
#          ; "-ldl"
#          ]
#      ; 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 = "Caml1999X029"
#      ; cmi_magic_number = "Caml1999I029"
#      ; cmo_magic_number = "Caml1999O029"
#      ; cma_magic_number = "Caml1999A029"
#      ; cmx_magic_number = "Caml1999Y029"
#      ; cmxa_magic_number = "Caml1999Z029"
#      ; ast_impl_magic_number = "Caml1999M029"
#      ; ast_intf_magic_number = "Caml1999N029"
#      ; cmxs_magic_number = "Caml1999D029"
#      ; cmt_magic_number = "Caml1999T029"
#      ; natdynlink_supported = true
#      ; supports_shared_libraries = true
#      ; windows_unicode = false
#      }
#  }

Reproduction

  1. Build dune 2.8.3 for Fedora Rawhide.
  2. Use that dune build to build base 0.14.1

Specifications

  • Version of dune (output of dune --version): n/a (I thought that was fixed in 2.8.1?)
  • Version of ocaml (output of ocamlc --version): 4.12.0
  • Operating system (distribution and version): Fedora Rawhide
@nojb
Copy link
Collaborator

nojb commented Mar 8, 2021

Hello, this was fixed in #4249 (included in 2.8.3 I think)... can you confirm which version of dune are you using?

@nojb
Copy link
Collaborator

nojb commented Mar 8, 2021

Ah, it looks like the fix had not been cherry-picked to 2.8.3, but it is in the process of being fixed (see ocaml/opam-repository#18286 (comment))

@jamesjer
Copy link
Contributor Author

jamesjer commented Mar 8, 2021

I am using this tarball: https://github.com/ocaml/dune/archive/2.8.3.tar.gz. Although dune --version reports n/a ...

Okay, I can apply that patch to the Fedora dune for now until the next version is released.

@rgrinberg
Copy link
Member

2.8.4 should fix this

@jamesjer
Copy link
Contributor Author

jamesjer commented Mar 8, 2021

Thank you for the quick fix!

@nojb
Copy link
Collaborator

nojb commented Mar 16, 2021

I believe this is fixed, so closing.

@nojb nojb closed this as completed Mar 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants