ocaml / ocaml/dune

Detect case-insensitive filesystems and prevent double-linking

Open
#1,920 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

This came out here: https://discuss.ocaml.org/t/dune-links-base-cmxa-twice/3465

I am not sure how hard or reasonable is to integrate this as a fix in dune, but I agree with @avsm that it is worth raising it here to discuss the eventuality.

I report the failure from the discuss thread below:

$ cat dune
(executable
  (name hcl)
  (libraries Base Stdio Core_kernel cryptokit cmdliner sexplib)
  (preprocess (pps ppx_jane))
  (modules_without_implementation asttypes cctypes))

$ dune build
[...]
(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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported dune build on a case-insensitive filesystem using the shown dune file and compiler command. Trace how dune handles filesystem names and linking when both Base and base paths are present. Done means detecting the filesystem behavior and preventing the duplicate link that produces the Base__Poly0 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.