Differences between dune install and opam install

Dear all,

I’m experiencing a very strange behaviour.
I have an OCaml library that is used to build a plugin and a core component that is able to load this plugin

But if I install this library using opam (opam install . --working-dir) during the load of the plugin I get an error of implementation mismatch while if I install it using dune (dune build && dune install) it works like a charm.

Those are my build and install portion of the library opam file

build: [
["dune" "subst"] {pinned}
 ["dune" "-p" name "-j" jobs]

install: [
  ["dune" "build" "@install"]
  ["dune" "install" name]

Any suggestion?

As far as I know, you do not need a “install” section in your opam file for projects which use only dune, because dune generates a .install file that is natively understood by opam, which can then copy and manage the installed files.

Thanks @zozozo
I will remove that, and in the meanwhile after some trying I found that the actual issue was related to another library with a wrong opam file that was causing a chain of errors.

It was missing the ["dune" "subst"] {pinned} line in the build. I guess I have to spent more time in actually understand how dune works