Dune beginner error : Library not found

I’ve just duplicated my dune project, the duplicated copy is called “Idaho”.
Here’s how I did the duplication :

  1. dune init proj Idaho

Which was successful, as the output was

Entering directory 'Idaho'
Success: initialized project component named Idaho
Leaving directory 'Idaho'
  1. Adjusting the dune files : as my project has two dune files, lib/dune and
    watched/dune, I first copied them from the old project to the new, then replaced
    the old project name with the new in the copies.

  2. Copying the ocaml files in lib or watched from the old project to the new

Now, when I try dune build after all this, I get the following error :

$ dune build
File “bin/dune”, line 4, characters 12-17:
4 | (libraries Idaho))
^^^^^
Error: Library “Idaho” not found.
→ required by _build/default/bin/main.exe
→ required by alias bin/all
→ required by alias default

Note that I prefer to call my main library idaho_lib rather than idaho ; here is
the lib/dune file :

(include_subdirs unqualified)
(library
(flags -w +1..31+33..69+71+72)
(name idaho_lib)
(libraries str unix zarith))

I insist that for the what regards dune, my two projects are identical except for the project names.
And calling dune build causes no error in the old project. What am I missing here ?

Are you on a Mac? Casei-insensitive file system. Check your file names?

No, I’m on Ubuntu. Which filenames do you mean I should check ?

Well it’s not an issue on Linux.

I re-tried with the global project name being uncapitalized “idaho”, the error message stayed the same.

I’m probably not the guy to be answering but: if you name your lib idaho_lib, and your bin depends on library Idaho, you’re gonna have a problem.

Do look at the dune docs about "name"vs. “public_name” for libs.

Indeed. For the record, the file that needed to be fixed was bin/dune, and here is the correct content :

(executable 
 (public_name idaho)
 (name main) 
 (libraries idaho_lib))
1 Like