Live data from Hacker News

OCaml Onboarding: Introduction to the Dune build system

ocamlpro.com

31–38 of 38 posts

Re: OCaml Onboarding: Introduction to the Dune build system

#31
post #19

Earlier quoted context omitted.

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.

ocamldep will set up the dependencies correctly. For examples, have a look at the multiple Makefile.am files in libguestfs, guestfs-tools & virt-v2v projects. All run as non-root so they don't change anything about "the system" assuming that's what you meant. (On mobile at the moment so can't link easily.)

Re: OCaml Onboarding: Introduction to the Dune build system

#32
I have been trying to read the original Dune "documentation", but it never told me how to do the stuff I needed to do. Finding pertinent information was based on pure luck, and even then it was tough as old chewing gum to find out "how do I do X?". The target audience is apparently limited to wizards who already perfectly understand Dune.

Maybe this introduction will finally do the trick.

Re: OCaml Onboarding: Introduction to the Dune build system

#33

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 use Dune only for my local libraries, because the install step fits perfectly. But my app projects all use a Makefile, including apps with a table-driven parser (Menhir), where the OCaml `.ml` source has to be generated first. You have to know `make` well enough to do that, but it's definitely possible.

Re: OCaml Onboarding: Introduction to the Dune build system

#34
post #9
post #6

Earlier quoted context omitted.

Because Make sucks? Because it's really limited and not expressive? Because it's not really a build system (nor is it a package manager or a dependency resolver or...)

> Because it's really limited and not expressive? It's neither of those unless you limit yourself to a lowest-common-denominator feature set. GNU Make, for example, is a Turing-complete, dynamic programming language and a CLI task runner. You can build a build system in GNU Make ( https://github.com/omercsp/simple-build-system ) just like you can do so in any other language. Make suffers from unfamiliar and somewhat…

In Make you can’t even have recipe-local variables with scope spanning more than a single shell command. At that point I prefer to write a Bash script where at least variables work.

Re: OCaml Onboarding: Introduction to the Dune build system

#35

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…

It's incredibly painful working with OCaml and dune on Windows, unfortunately. Docs are insufficient and there is little information online :/, wish it was not the case.

Re: OCaml Onboarding: Introduction to the Dune build system

#36

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’s wrong with make is largely that people are bad at writing makefiles. A tool like dune is able to enable cross compilation of a massive number of libraries out of the box, but make based projects that weren’t designed with it in mind almost always require someone to go through and separate out the mess of what needs to run on the host vs be built for the target, etc, etc

Re: OCaml Onboarding: Introduction to the Dune build system

#37

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.

Just to let you know you are not alone, stranger; but also to advise you to be careful when touching on group identities.

Re: OCaml Onboarding: Introduction to the Dune build system

#38
post #31

Earlier quoted context omitted.

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.

ocamldep will set up the dependencies correctly. For examples, have a look at the multiple Makefile.am files in libguestfs, guestfs-tools & virt-v2v projects. All run as non-root so they don't change anything about "the system" assuming that's what you meant. (On mobile at the moment so can't link easily.)

You mean this one: https://github.com/libguestfs/libguestfs/blob/master/Makefil... ?

I don't see how ocamldep is used in there. It seems to use multiple different programming languages somehow. I don't find it easy to understand what it does. It seems to be building a website as well.

Post reply on HN