Apparently, I'm making inconsistent assumptions over an interface (dune, etc.)

So, I wrote this library called subprocess for working with OS processes. It’s a dune package. I installed it (or so I thought) with dune install.

I wrote a “script” for doing stuff with files (previewing them and then moving them to a folder). It’s called watchnmove. It is supposed to use the subprocess library. When I’m editing it, merlin seems to know the subprocess library and the interfaces it provides.

However, when I try to build watchnmove, I get the following error:

File "_none_", line 1:
Error: Files .watchnmove.eobjs/native/dune__exe__Watchnmove.cmx
       and /home/ninjaaron/.opam/4.10.0/lib/subprocess/subprocess.cmxa
       make inconsistent assumptions over interface Subprocess

Not really sure how to proceed at this point. dune build @check works fine (for the watchnmove script).

ocamlobjinfo is your friend. It can be that recorded (relative) path of source files is different. This will modify the hash and lead to this error

Thanks, but I don’t know how to act on this insight. Should I just read the man page for ocamlobjinfo? I don’t know what you’re advising me to do. This is my first time trying to use a library that I wrote and installed with dune. There are many things I do not know. e.g. how to change the recorded path.

ocamlobjinfo foo.cmi ocamlobjinfo whateever_uses_foo.cmi

check the hashes of Foo in the output

Are your projects someplace where others can clone/reproduce the problem?

I found the hash for my subprocess library, but there doesn’t appear to be any object file for the watchnmove program. This is the directory tree:

├── _build
│   ├── default
│   │   └──
│   └── log
├── dune
├── dune-project
├── foo

2 directories, 6 files

I ran ocamlobjinfo on the cmxa file I was trying to use:

File /home/ninjaaron/.opam/4.10.0/lib/subprocess/subprocess.cmxa
Extra C object files:
Extra C options:
Name: Subprocess
CRC of implementation: d657ce8d0693089c410e832fc6ed51d0
Globals defined:
Interfaces imported:
	618916e3750d258813c503390a6d11af	UnixLabels
	ba30fbe5ee87d3d4d5bd805af35f363b	Unix
	015289f70a832fcf8656f6e88b1a51e6	Subprocess
	c51d7a295527e9500ba69b459f81d6b3	Stdlib__uchar
	c5f4ef3f36de5f47b7041eed1deb9679	Stdlib__seq
	908ae2bf186b4ad7c88e5443c57d73af	Stdlib__printf
	d6c8b384cf8b1a3066eeb6d66bd95790	Stdlib__option
	13989ef6fbcb7235b257d3df9a80253a	Stdlib__list
	067e32179a81c1c8dbdd0a8d52b0c645	Stdlib__complex
	28161e4effde5ea372547815f87193ec	Stdlib__buffer
	33ee4c2e3aa5fb2f083dd780ce492c0b	Stdlib__bigarray
	9558001a029d7270458a252505f6a024	Stdlib__array
	aea3513d44d604b62eaff79ad12007b3	Stdlib
	f562e7b79dbe1bb1591060d6b4e854cf	CamlinternalFormatBasics
Implementations imported:
	27707ead31735f5fc007cca109489449	UnixLabels
	33e6bc48723c0388a908be1d5b5e43a2	Stdlib__seq
	19b790b69e71cc8a18d06eb2330f9df4	Stdlib__printf
	04b767392a141a521eea0ec7b68922c1	Stdlib__option
	e3a5f633b69d62d35929d9e3f6c26a20	Stdlib__list
	d8cbd5c6bb9dc377a421cad028946a12	Stdlib__array
	6b88613cf2b6620d6f11cd8a342880fc	Stdlib
Clambda approximation:
Currying functions: 5 2 4
Apply functions:
Send functions:
Force link: no

I see a lot of hashes, and I don’t really know which ones I’m supposed to be looking at. I see one next to something that says CRC of implementation which is different from the one that says Subprocess under “Interfaces imported”.

Though I don’t think I’ve done everything you actually asked, let’s assume the hashes are mismatched. What would I do to correct that?

Ok, I also did this:

$ ocamlobjinfo /home/ninjaaron/.opam/4.10.0/lib/subprocess/subprocess.cmi 
File /home/ninjaaron/.opam/4.10.0/lib/subprocess/subprocess.cmi
Unit name: Subprocess
Interfaces imported:
	5f68cffdcdf0daa3a799416a60eb0ef4	Subprocess
	618916e3750d258813c503390a6d11af	UnixLabels
	ba30fbe5ee87d3d4d5bd805af35f363b	Unix
	c5f4ef3f36de5f47b7041eed1deb9679	Stdlib__seq
	067e32179a81c1c8dbdd0a8d52b0c645	Stdlib__complex
	33ee4c2e3aa5fb2f083dd780ce492c0b	Stdlib__bigarray
	aea3513d44d604b62eaff79ad12007b3	Stdlib
	f562e7b79dbe1bb1591060d6b4e854cf	CamlinternalFormatBasics

I found a solution:

Turns out I just had to recompile my subprocess library.

1 Like