ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 401 forks source link

Building using redis #1311

Closed WhoAteDaCake closed 6 years ago

WhoAteDaCake commented 6 years ago

When running a dune build, it throws

Too many opam files for package "redis-sync":
- node_modules/@opam/redis-lwt/redis-sync.opam
- node_modules/@opam/redis/redis-sync.opam

Package can be found https://github.com/0xffea/ocaml-redis

rgrinberg commented 6 years ago

What are the steps to reproduce this? The package.json for esy that is.

cc @andreypopp

WhoAteDaCake commented 6 years ago

I was not using esy install at the time, The dune file can be found https://github.com/WhoAteDaCake/reason-server/blob/e0063731017b93723883eb76deca2d760611efbd/src/dune

WhoAteDaCake commented 6 years ago

I will try to create a reproducible repo

WhoAteDaCake commented 6 years ago

ocaml: The OCaml toplevel, version 4.06.1 opam: 2.0.0

After removing esy, i just ran dune and it threw:

Error: The files src/.rserver.eobjs/redis.cmi
       and src/.rserver.eobjs/redis.cmi make inconsistent assumptions
       over interface Redis
rgrinberg commented 6 years ago

Anyway, the error is obvious from dune's point of view. It's not going to work if it sees two conflicting definitions for a package. The question is how you got into this situation.

WhoAteDaCake commented 6 years ago

Is it possible because both redis-lwt/redis-sync.opam offer redis/redis-sync.opam different interfaces?

P.S. I am relatively new to ocaml

rgrinberg commented 6 years ago

I'm not sure how you got the second error, but i've seen others getting it. Are you using windows btw?

WhoAteDaCake commented 6 years ago

No, I am using Ubuntu 18.04

WhoAteDaCake commented 6 years ago

I will try to recreate that inside a docker container, just to see whether it's my system that is at fault

andreypopp commented 6 years ago

@WhoAteDaCake you need to instruct dune to ignore node_modules:

echo '(ignored_subdirs (node_modules))' >> dune

It is managed by esy and dune shouldn't be doing anything inside.

WhoAteDaCake commented 6 years ago

@rgrinberg I managed to replicate it inside a docker container, the setup can be found https://github.com/WhoAteDaCake/reason-server/tree/b49554890e81ee7aad5d26e971338ef41c75ad56

WhoAteDaCake commented 6 years ago

I feel so stupid, the reason why it said those errors because I had a file named redis.re which essentially exported module Redis. This caused a collision and the errors you've seen

rgrinberg commented 6 years ago

The error form the compiler is still quite bizarre. Why isn't it reporting the cmi for the redis module from the library? It's saying that it's the same file.