4 ms·
It is complicated to figure out a straightforward way to do builds in OCaml. If you're not tapped into the Current Way, you kind of have to read this blog, read
by pnathan 7y ago
It is complicated to figure out a straightforward way to do builds in OCaml. If you're not tapped into the Current Way, you kind of have to read this blog, read that fragment, piece it together. I worked it through for a project of mine, and it was unusually unpleasant vs, say, Haskell.
Docker because, presumably, he didn't want to dink with installing it locally.
- tempodox 7y agoI can't find it complicated at all. I control my OCaml builds mostly from simple, hand-written Makefiles. Reading up on the pertaining compiler and linker options is something you'd have to do for any compiled language. Building with dune isn't that much harder, either.
- ernst_klim 7y ago> It is complicated to figure out a straightforward way to do builds in OCaml Sorry, what is not straightforward in building with `dune`?
- srpablo 7y agoSome things I ran into: - How do I run tests? Oh, you can't really dune runtest on executables, only libraries. So how do I run tests on executables? Make a library with the core of the functionality and wrap it, I guess. Wasn't obvious. - Tree-like heirarchy of dune files confused me since it wasn't really explained anywhere. I wanted my source files in a `src` directory; most of the examples assume your `dune` file is just hanging out with the source in the toplevel. - Does `dune` handle dependencies (like I would declare them in a rebar.config, mix.exs, or a package.json)? Not really, it plays with opam, requiring one to read a bunch of docs for opam, and its files, and where they should go. - The syntax of the dune files changed a bit from when I started the project (it was just moving from jbuilder -> dune). Less of an issue now, though I still question the use of s-expressions. - Can I load an interactive shell with the definitions? There's a command in the documentation for it, but it didn't work quite right when I tried. - If you look at other projects, you'll see they use opam files differently from one another. - How do I add a dependency in my current switch (something like npm --save install <library>?) I tried `opam install --deps-only`, but it complained sometimes about the state of uncommitted files. I understand why it's like this (trying to tie together a ton of use cases) and love developing in it after it's all said and done, but there are a lot of rakes to step on.
- ernst_klim 7y ago> Tree-like heirarchy of dune files confused me since it wasn't really explained anywhere. It's explained in project layout [1]. And it's not a tree like, it's basically flat, since it doesn't matter how deep in the file system your dune file is buried. It's like `meson` in its concept. > Does `dune` handle dependencies It doesn't, and so neither do `meson`, `cmake` and most other build systems. As you may want to use various ways of installing dependencies: native packages, manual compilation, opam, esy. > Can I load an interactive shell with the definitions? Yes, you can run `dune utop ./path` > If you look at other projects, you'll see they use opam files differently from one another. Dune is independent of opam, opam file is needed to publish your package to opam. You can specify packages with dune without creating an opam file, see [2] > I tried `opam install --deps-only`, but it complained sometimes about the state of uncommitted files. If you use opam, you can do `opam install --deps-only`, or `dune build @install`, which would suggest a command to install missing packages. [1] https://dune.readthedocs.io/en/stable/overview.html#project-layout https://dune.readthedocs.io/en/stable/overview.html#project-... [2] https://dune.readthedocs.io/en/stable/concepts.html#package-specification https://dune.readthedocs.io/en/stable/concepts.html#package-...
- pnathan 7y agoWhen I was putting together the build about 2? years ago, dune was not the normative standard.