OCaml: how to solve findlib warnings of several `cmi` s

Now I am trying to write a compiler with ocamlfindsome packages, especially ppx_sexp_convwith opam.
In some cases, dependencies are ppx_sexp_convrequired compiler-libs, so ocamlfind ocamlc -package ppx_sexp_convan option is added when compiling files -I ~/.opam/VERSION/lib/compiler-libs.

The problem is, that compiler-libscontains very common file name, such as parsing.cmi, main.cmi, lexing.cmi.
This leads to file conflicts .cmiand makes a lot of noisy warnings as follows:

$ ocamlfind ocamlc  -package ppx_sexp_conv -c parser.mli
findlib: [WARNING] Interface main.cmi occurs in several directories: ., /home/nomaddo/.opam/4.02.3/lib/ocaml/compiler-libs
findlib: [WARNING] Interface lexer.cmi occurs in several directories: ., /home/nomaddo/.opam/4.02.3/lib/ocaml/compiler-libs
findlib: [WARNING] Interface topdirs.cmi occurs in several directories: /home/nomaddo/.opam/4.02.3/lib/ocaml/compiler-libs, /home/nomaddo/.opam/4.02.3/lib/ocaml
findlib: [WARNING] Interface parser.cmi occurs in several directories: ., /home/nomaddo/.opam/4.02.3/lib/ocaml/compiler-libs

`` ``

Note that main.cmi, parsing.cmi, lexing.cmiand main.cmiexist in the same directory.

I believe that such file names are common and everyone wants to use.
My question is how to calm such noisy warnings.
Thanks to them, it is difficult to find more important warnings and errors right away ...

My environment: ocaml 4.02.3 with opam 1.2.2.

+4
source share
1 answer

One way to suppress these warnings is to set the findlib environment variable OCAMLFIND_IGNORE_DUPS_INto /home/nomaddo/.opam/4.03.0/lib/ocaml/compiler-libs.

Here is an example with OCaml 4.03.0 and ppx_sexp_conv version 113.33.01 + 4.03.

parser.mli:

type t = int [@@deriving sexp]

In the shell, do the following

export OCAMLFIND_IGNORE_DUPS_IN=/home/nomaddo/.opam/4.03.0/lib/ocaml/compiler-libs

ocamlfind ocamlc  -package ppx_sexp_conv -dsource -c parser.mli

You can see that it has been .mlipre-processed and no additional warnings have been selected.

Link:

+9

All Articles