ocaml-dune / csexp

Minimal support for Canonical S-expressions
MIT License
27 stars 7 forks source link

Circular dependency: csexp depends on dune, and dune depends on csexp #18

Closed yurivict closed 2 years ago

yurivict commented 3 years ago

The FreeBSD port devel/ocaml-dune fails without csexp, but to build csexp dune is required.

How can this work, and how can anybody even build dune or csexp?

jamesjer commented 2 years ago

I encountered the same issue in Fedora. I came up with a gross way of dealing with the issue, but it "works". Essentially, I installed csexp with opam and recorded the steps taken to build it, then copied those into the build instructions (the ocaml-csexp.spec file's %build section). Then I looked at the installed results and came up with instructions for putting the files into the same places by hand (the %install section).

It would be a lot nicer, of course, to not have to deal with circular dependencies. I could rant about those for quite awhile, but who would care? :-)

gasche commented 2 years ago

It looks like Csexp is a rather simple library (it's exactly one source file), so it should be pretty simple to write a non-dune build system for it, using say Make or in fact just a shell script -- this is in essence what the Fedora package is doing.

how can anybody even build dune or csexp?

It looks like dune "vendors" csexp, and all its other dune-using dependencies, that it includes their sources directly see https://github.com/ocaml/dune/tree/main/vendor . Dune itself is built by dune, so it has a "bootstrap" mechanism already, and I guess this bootstrap system is used to build those vendored dependencies along the way.

rgrinberg commented 2 years ago

Yes, there's no bug or circular dependency here. Dune does depend on the csexp package, but rather its own vendored version. I have no idea what upstream packages are trying to do, but dune's build instructions clearly state that only OCaml and a C compiler are required to build it.