Dune links base.cmxa twice


#1

Once I enable preprocessing with ppx_jane in dune, I’m getting errors about Base defining certain modules twice:

My dune:

(executable
  (name hcl)
  (libraries Base Stdio Core_kernel cryptokit cmdliner sexplib)
  (preprocess (pps ppx_jane))
  (modules_without_implementation asttypes cctypes))
(cd _build/default && /Users/leandros/.opam/4.07.1/bin/ocamlopt.opt -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs -warn-error -A -g -o hcl.exe -I /Users/leandros/.opam/4.07.1/lib/Base -I /Users/leandros/.opam/4.07.1/lib/Core_kernel -I /Users/leandros/.opam/4.07.1/lib/Stdio -I /Users/leandros/.opam/4.07.1/lib/base -I /Users/leandros/.opam/4.07.1/lib/base/caml -I /Users/leandros/.opam/4.07.1/lib/base/md5 -I /Users/leandros/.opam/4.07.1/lib/base/shadow_stdlib -I /Users/leandros/.opam/4.07.1/lib/base_bigstring -I /Users/leandros/.opam/4.07.1/lib/base_quickcheck -I /Users/leandros/.opam/4.07.1/lib/bin_prot -I /Users/leandros/.opam/4.07.1/lib/bin_prot/shape -I /Users/leandros/.opam/4.07.1/lib/cmdliner -I /Users/leandros/.opam/4.07.1/lib/core_kernel/base_for_tests -I /Users/leandros/.opam/4.07.1/lib/cryptokit -I /Users/leandros/.opam/4.07.1/lib/fieldslib -I /Users/leandros/.opam/4.07.1/lib/jane-street-headers -I /Users/leandros/.opam/4.07.1/lib/parsexp -I /Users/leandros/.opam/4.07.1/lib/ppx_assert/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/ppx_bench/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/ppx_compare/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/ppx_enumerate/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/ppx_expect/collector -I /Users/leandros/.opam/4.07.1/lib/ppx_expect/common -I /Users/leandros/.opam/4.07.1/lib/ppx_expect/config -I /Users/leandros/.opam/4.07.1/lib/ppx_hash/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/ppx_inline_test/config -I /Users/leandros/.opam/4.07.1/lib/ppx_inline_test/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/ppx_module_timer/runtime -I /Users/leandros/.opam/4.07.1/lib/ppx_sexp_conv/runtime-lib -I /Users/leandros/.opam/4.07.1/lib/sexplib -I /Users/leandros/.opam/4.07.1/lib/sexplib0 -I /Users/leandros/.opam/4.07.1/lib/splittable_random -I /Users/leandros/.opam/4.07.1/lib/stdio -I /Users/leandros/.opam/4.07.1/lib/time_now -I /Users/leandros/.opam/4.07.1/lib/typerep -I /Users/leandros/.opam/4.07.1/lib/variantslib -I /Users/leandros/.opam/4.07.1/lib/zarith /Users/leandros/.opam/4.07.1/lib/base/caml/caml.cmxa /Users/leandros/.opam/4.07.1/lib/base/shadow_stdlib/shadow_stdlib.cmxa /Users/leandros/.opam/4.07.1/lib/sexplib0/sexplib0.cmxa /Users/leandros/.opam/4.07.1/lib/base/base.cmxa /Users/leandros/.opam/4.07.1/lib/variantslib/variantslib.cmxa /Users/leandros/.opam/4.07.1/lib/typerep/typerep_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_sexp_conv/runtime-lib/ppx_sexp_conv_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_compare/runtime-lib/ppx_compare_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_enumerate/runtime-lib/ppx_enumerate_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_hash/runtime-lib/ppx_hash_lib.cmxa /Users/leandros/.opam/4.07.1/lib/stdio/stdio.cmxa /Users/leandros/.opam/4.07.1/lib/jane-street-headers/jane_street_headers.cmxa /Users/leandros/.opam/4.07.1/lib/time_now/time_now.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_module_timer/runtime/ppx_module_timer_runtime.cmxa /Users/leandros/.opam/4.07.1/lib/fieldslib/fieldslib.cmxa /Users/leandros/.opam/4.07.1/lib/base/md5/md5_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ocaml/unix.cmxa /Users/leandros/.opam/4.07.1/lib/ocaml/bigarray.cmxa /Users/leandros/.opam/4.07.1/lib/bin_prot/shape/bin_shape_lib.cmxa /Users/leandros/.opam/4.07.1/lib/bin_prot/bin_prot.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_bench/runtime-lib/ppx_bench_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_assert/runtime-lib/ppx_assert_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_expect/common/expect_test_common.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_expect/config/expect_test_config.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_inline_test/config/inline_test_config.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_inline_test/runtime-lib/ppx_inline_test_lib.cmxa /Users/leandros/.opam/4.07.1/lib/ppx_expect/collector/expect_test_collector.cmxa /Users/leandros/.opam/4.07.1/lib/splittable_random/splittable_random.cmxa /Users/leandros/.opam/4.07.1/lib/base_quickcheck/base_quickcheck.cmxa /Users/leandros/.opam/4.07.1/lib/Base/base.cmxa /Users/leandros/.opam/4.07.1/lib/Stdio/stdio.cmxa /Users/leandros/.opam/4.07.1/lib/base_bigstring/base_bigstring.cmxa /Users/leandros/.opam/4.07.1/lib/core_kernel/base_for_tests/base_for_tests.cmxa /Users/leandros/.opam/4.07.1/lib/parsexp/parsexp.cmxa /Users/leandros/.opam/4.07.1/lib/sexplib/sexplib.cmxa /Users/leandros/.opam/4.07.1/lib/Core_kernel/core_kernel.cmxa /Users/leandros/.opam/4.07.1/lib/zarith/zarith.cmxa /Users/leandros/.opam/4.07.1/lib/cryptokit/cryptokit.cmxa /Users/leandros/.opam/4.07.1/lib/cmdliner/cmdliner.cmxa .hcl.eobjs/ast.cmx .hcl.eobjs/parser.cmx .hcl.eobjs/lexer.cmx .hcl.eobjs/cc.cmx .hcl.eobjs/hcl.cmx)
File "_none_", line 1:
Error: Files /Users/leandros/.opam/4.07.1/lib/Base/base.cmxa
       and /Users/leandros/.opam/4.07.1/lib/base/base.cmxa
       both define a module named Base__Poly0

#2

Lowercase the library names in your libraries list. I think your mac is using a case insensitive fs and trying to link Base and base: the first should not exist in principle, but in practice they both refer to the same object due to cas-insensitivity (and similarly for the others).


#3

Doh! You’re right. The package name is lowercase.
That fixed it.

Thank you! :bow:


#4

Any chance you could open an issue on the dune issue tracker about this particular problem? I think that dune should spot the case-insensitivity clash earlier and not try to do a double link on macOS.


#5

Done: https://github.com/ocaml/dune/issues/1920