Live data from Hacker News

OCaml Onboarding: Introduction to the Dune build system

ocamlpro.com

21–30 of 38 posts

Re: OCaml Onboarding: Introduction to the Dune build system

#21

what is wrong with make why does every language need to re invent packaging, building, etc. I think these people have no useful software to write so they rewrite the development stack.

one day we'll get the equivelent of language server for build systems.

Re: OCaml Onboarding: Introduction to the Dune build system

#22

what is wrong with make why does every language need to re invent packaging, building, etc. I think these people have no useful software to write so they rewrite the development stack.

I tried to write some Ocaml stuff using a Makefile, because I also didn't want to use even more specific tooling, but it became ugly quickly, because I had to use `ocamlfind` and `ocamlc`, and provide a list of all packages to include and so on. It felt a bit like writing C at that moment, where you need to tell gcc what system libraries you are using, so that it compiles the program with those.

So in the end I tried using dune and opam and whatnot, but it all felt less than clear to me. Especially, the comment someone else made here about having 2 different types of files for dune to work ...

I just want a project local directory, that contains all my dependencies and a lock file to reproducibly built my projects. That's the minimum I expect these days. Or some equivalent alternative.

Re: OCaml Onboarding: Introduction to the Dune build system

#23

what is wrong with make why does every language need to re invent packaging, building, etc. I think these people have no useful software to write so they rewrite the development stack.

What are you proposing? Because make isn't really good for anything either.

I use GNU Make for my Python and GNU Guile projects just fine. For Python projects it becomes a job runner of tooling commands. For Guile projects it uses a SHELL that is a guix shell, which references channels and manifest, to ensure reproducibility.

Re: OCaml Onboarding: Introduction to the Dune build system

#24
post #19

Earlier quoted context omitted.

The OCaml ecosystem tried the Make route, it was complex, turns out no one likes maintaining makefiles by hand, and they like opaque make rules even less. Like it or not, dune exists for a very good reason.

Make works fine with OCaml. There's a handful of rules you copy and paste around which is not ideal, but that's much easier to deal with than dune.

Can you link a Makefile for an OCaml project, which ensures reproducibility and locality? What I mean is checking checksums of dependencies upon when they are installed, and acting only in the project directory, not changing the surrounding system in order to run the program. Asking, because I tried and failed.

Re: OCaml Onboarding: Introduction to the Dune build system

#25
post #19

Earlier quoted context omitted.

The OCaml ecosystem tried the Make route, it was complex, turns out no one likes maintaining makefiles by hand, and they like opaque make rules even less. Like it or not, dune exists for a very good reason.

Make works fine with OCaml. There's a handful of rules you copy and paste around which is not ideal, but that's much easier to deal with than dune.

I'd rather not have to maintain lists of source files to compile by hand; dune eliminates this drudge work.

Re: OCaml Onboarding: Introduction to the Dune build system

#27

what is wrong with make why does every language need to re invent packaging, building, etc. I think these people have no useful software to write so they rewrite the development stack.

one day we'll get the equivelent of language server for build systems.

Build systems are a much harder problem, probably because mainstream languages are all edited the same way, but not built the same way.

The closest we have right now are build systems in the Bazel / Buck2 lineage.

Re: OCaml Onboarding: Introduction to the Dune build system

#28

Does anyone know what's up with ocaml on windows? I haven't used it in a while. Trying to install utop on 5.x compiler and quite a few packages need a downgrade to 4.x? I've tried with both mingw and system-msvc. Same behavior.

Installing via opam and using the cygwin method is supported and should be working fine (cygwin is just used for build - binaries still just link with mingw).

That specific combination (ocaml + mingw) has a known problem with ocamlfind that's still awaiting a new release (see https://github.com/ocaml/ocamlfind/pull/112). ocamlfind underpins quite a bit of the package ecosystem, so this one is annoying, as the mingw workflow is otherwise quite good.

Re: OCaml Onboarding: Introduction to the Dune build system

#29
post #14

is uv to python what dune is to OCaml?

Not yet - it's mostly a build tool, but package management abilities (which is otherwised covered by opam) is being added to it^1. It's currently usable for some projects (and worth trying out), but still in preview mode.

^1: https://dune.readthedocs.io/en/stable/tutorials/dune-package...

Post reply on HN