Questions tagged [ocaml-dune]

Use for questions relating to dune, previously jbuilder, a build system for [ocaml] and [reason]

Dune is a build system for and .

Resources

96 questions
9
votes
1 answer

How to have nested libraries? Confused about dune etc

I have an OCaml project using dune Following advice in basic tutorials I have a dir structure like: bin/ cli.ml dune lib/ dune ... .ml The number of files in my lib dir is growing and I would like to have another level…
Anentropic
  • 32,188
  • 12
  • 99
  • 147
6
votes
1 answer

How to disable Error (warning 66): unused open! in dune

As per https://github.com/ocaml/ocaml/pull/1110, OCaml 4.08 and later raises a warning for unused module opens, even when they are opened with open!. This creates friction with the common practice of using open! Foo to establish that the following…
Shon
  • 3,989
  • 1
  • 22
  • 35
6
votes
1 answer

Running OUnit tests using dune

I'm having difficulties running OUnit tests, mostly because I'm new to both dune and OUnit. dune complains when I run dune runtest: File "test/dune", line 4, characters 13-14: Error: Library "f" not found. Hint: try: dune external-lib-deps --missing…
Flux
  • 9,805
  • 5
  • 46
  • 92
5
votes
2 answers

Copy the produced executable in my root dir with dune

Let's say I have a simple project with the following structure: . ├── dune-project └── src └── bin ├── dune └── main.ml dune-project (lang dune 2.7) (name myproject) (package (name myproject) (synopsis "myproject") (description "Basic…
Lhooq
  • 4,281
  • 1
  • 18
  • 37
5
votes
1 answer

Is there a way to declare executables with hyphens in a OCaml dune?

I'm setting up a demo project using dune, and want to name the executable "hello-world.exe" instead of "hello_world". If I try to build the project I get an compiler error. How can I declare an executable with hyphens in the filename? I'm using dune…
Niko W.
  • 51
  • 1
5
votes
0 answers

requiring "core" in utop gives error: Unix.Unix_error (Unix.ENOENT, "sysconf", "")

When I try to call #require "core" in utop, I get an error: utop # #require "core";; Exception: Unix.Unix_error (Unix.ENOENT, "sysconf", ""). Raised by primitive operation at unknown location Called from file "toplevel/topdirs.ml", line 144,…
illabout
  • 3,517
  • 1
  • 18
  • 39
4
votes
1 answer

How to specify requirements for versions of dependencies for ocaml dune projects?

Say I run dune init proj hello_world, then modify the bin/dune and bin/main.ml files so that a new dependency foobar is in use. The bin/dune file now: (executable (public_name hello_world) (name main) (libraries hello_world foobar)) 1. How can I…
Costava
  • 175
  • 9
4
votes
2 answers

Debugging with dune

I know of the OCaml debugging tool (first compile with ocamlc -g , then run ocamldebug ) and also the function call tracing feature in the toplevel (both covered here). However, I can't seem to find anything about debug builds with…
Quantifier
  • 135
  • 1
  • 8
4
votes
1 answer

How to link with a local ocaml library using dune

I took over an ocaml project that consists of a main program and a library, but the library is built indepenently. Linking the main program was up until now possible with "ocamlopt -I mylib.cmxa myprogram.ml" - but I had problems using opam…
Marius Melzer
  • 863
  • 1
  • 7
  • 10
4
votes
1 answer

unbound module in OCaml / dune build

I trying out OCaml for the first time and trying to build a couple files together. When I run: dune build bin/main.exe I am getting: ocamlc bin/.main.eobjs/main.{cmi,cmo,cmt} (exit 2) (cd _build/default && /usr/bin/ocamlc.opt -w…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
4
votes
1 answer

how to derive to_string methods for data types using ppx

How can I derive to_string methods for data types using ppx with jbuilder? For instance, I'm trying to use @@deriving show to derive show_* methods for a data type. I have a simple main.ml file that looks like this: open Core type foo = Bar | Baz …
illabout
  • 3,517
  • 1
  • 18
  • 39
3
votes
0 answers

OCAML MLI + ML files and multiple implementations

I wrote a interface for a map data structure in an MLI file and then the implementation of maps using association lists in a file of the same name but with extension of "ML". this works. but now I want to write a second implementation of the map…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
3
votes
1 answer

How to use Flambda with dune in ocaml?

I'm doing a project in which I need to optimize my code as much as I can because it takes hours to run with a normal compilation. I was told to use Flambda, but I didn't find anything on the internet on how to use it with dune. I'd appreciate…
Butanium
  • 726
  • 5
  • 19
3
votes
2 answers

How to include a local library to an executable with dune ocaml

I have a project structured like this : root/ |—— dune-project |—— lib/ | |—— dune | |—— Readertsp.ml | |-- ... | |—— bin/ | |—— dune | |—— bin.ml bin.ml : let city_config = "ch130" in let path = Readertsp.open_path city_config in…
Butanium
  • 726
  • 5
  • 19
3
votes
1 answer

OCaml dune: get absolute path to source directory

I have a project and there is a ./tests directory at its root containing several hundred MB of data that is used by the tests of several…
josch
  • 6,716
  • 3
  • 41
  • 49
1
2 3 4 5 6 7