From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id E11975D5 for ; Sun, 12 Jan 2020 23:06:57 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.69,426,1571695200"; d="scan'208,217";a="430990406" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 13 Jan 2020 00:06:56 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id EEE077F3CF; Mon, 13 Jan 2020 00:06:55 +0100 (CET) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 970D57ED1F for ; Sun, 12 Jan 2020 23:24:15 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=robert.muller2@gmail.com; spf=Pass smtp.mailfrom=robert.muller2@gmail.com; spf=None smtp.helo=postmaster@mail-lj1-f179.google.com IronPort-PHdr: =?us-ascii?q?9a23=3Ap6W5+hVdH5xP0tl+eAa4xf4OMOTV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYbByEt8tkgFKBZ4jH8fUM07OQ7/m7HzZesd3Y7SFKWacPfidNsd?= =?us-ascii?q?8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3wOgVv?= =?us-ascii?q?O+v6BJPZgdip2OCu4Z3TZBhDiCagbb9oIxi6sAvcutMIjYZjKas9xQbFr3tMdu?= =?us-ascii?q?9L2W5mOFWfkgrm6Myt5pBj6SNQu/wg985ET6r3erkzQKJbAjo7LW07/dXnuhbf?= =?us-ascii?q?QwSB4HscSXgWnQFTAwfZ9hH6X4z+vTX8u+FgxSSVJ8z2TbQzWTS/86dmTQLjhS?= =?us-ascii?q?kbOzIl9mzcl9d9h7xHrh2/uxN/wpbUYICLO/p4YqPdZs4RSW5YUspMSyBNHoaw?= =?us-ascii?q?Yo0SBOQDIOlYtZHwqFQArRS8BQeiCuDhxCJWiHDqxqA1yfgtHBvc0QA8A94Dsn?= =?us-ascii?q?LZp8j1OqcIVuC1ybHFwynEb/xNxzj98pTIeQ0mr/GRWbJwddTeyVMyHA7ClFWQ?= =?us-ascii?q?rpfqMC2P1uQRqWSb6vdgVeari2E5sQF9vCOixsgpiobTh4IVzkrI+jl+wIYwPN?= =?us-ascii?q?C1TlNwb9CjEJtVrS6aNo12T9s5Q2BovSY10boGuZqhcCgPzJQr3wTQa+ebc4SS?= =?us-ascii?q?5xLjUP6dLit/hHJgYLK/hhKy/la6xu35Usm51ktBoCldktTUqHwByxje5tKER/?= =?us-ascii?q?Z95EutxyqD2gPJ5u1ZI005kazWIIM7zLEqjJocq0HDEzf2mEroiK+WcV0p+u2y?= =?us-ascii?q?5OTmZrXqv5ucN41phg3nPKQih86yDOAiPggBWGib/uu81Ln98kHjXLpKifg2nr?= =?us-ascii?q?HYsJDcO8sbura0DxFJ3osn8RqyDDer3M4GkXUbL19JYg+LgortNl3WJfD3F/a/?= =?us-ascii?q?g1CikDdxwPDGO6XsAo/KLnfYjrjhZ6p951RZyAouydBf44xbCqsfLP/oVU/xsc?= =?us-ascii?q?bXDh49MwCu3+nnD9B92psEWW2TGq+ZLL/SsViQ6+0zOeaMYYsVtC/5K/gk/P7u?= =?us-ascii?q?kWQ0mUQdfKmsxZsYcmq0HvVgI0WDYHrjmM0NEWkQvll2cOu/rlyJVjrafEGVXa?= =?us-ascii?q?8w7wYRhJjuWYHCTYepiafH2yW2EpQQbGlcIlSBAXbmdsOPXPJaOwyIJco0qDsO?= =?us-ascii?q?WKK9A6o80RWjrkeu0b1tI/DIvCgFsZbuzoJd6OjalBV0/jtxWZfOm1qRRn15yz?= =?us-ascii?q?tbDwQ927py9Akkkg/ajPpIxsdAHNkW3MtnFwc3MZmGkb5/AtH2HwbDJ5KHEQn3?= =?us-ascii?q?BNqhBj41Q5Q6xNpcOx8hSeXntQjK2m+RO5FQj6aCXcVm/afV3ny3LMF4mS6fhf?= =?us-ascii?q?sRymI+S84KDlWIw6t29gzdHYnMyhzLmKOjdKBa1ynIpj6O?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CACQAnmxtehrPQVdFbCh4BCxyFEFQzK?= =?us-ascii?q?oQMgRyCXosgghGZT4FnCQEDAQwbFAEBhEACgXIcBwEENBMCEAEBBAEBAQIBAgM?= =?us-ascii?q?EARMBAQEICwsIKYU+DII7KQGCeQEBAQECARIRBBkBGx0BAwELBgULDSoCAiEBA?= =?us-ascii?q?REBBQEcBhMigwQBgkkBAw4gnCCBAz2KMXV/FgUBF4J/BYRXChknDWMDgRcaAgc?= =?us-ascii?q?SgSSMGYIagUeCKDU+ghuBdg2DO4JeBIE/AZUEgSeXDUQGAYIXI3qGQYFbiHGEJ?= =?us-ascii?q?huCR3eXLplXkBMPI4FGgXozGiNQMW2BTglHGA2IARqCKoEvhCCGUSYwAY9XAQE?= X-IPAS-Result: =?us-ascii?q?A0CACQAnmxtehrPQVdFbCh4BCxyFEFQzKoQMgRyCXosgghG?= =?us-ascii?q?ZT4FnCQEDAQwbFAEBhEACgXIcBwEENBMCEAEBBAEBAQIBAgMEARMBAQEICwsIK?= =?us-ascii?q?YU+DII7KQGCeQEBAQECARIRBBkBGx0BAwELBgULDSoCAiEBAREBBQEcBhMigwQ?= =?us-ascii?q?BgkkBAw4gnCCBAz2KMXV/FgUBF4J/BYRXChknDWMDgRcaAgcSgSSMGYIagUeCK?= =?us-ascii?q?DU+ghuBdg2DO4JeBIE/AZUEgSeXDUQGAYIXI3qGQYFbiHGEJhuCR3eXLplXkBM?= =?us-ascii?q?PI4FGgXozGiNQMW2BTglHGA2IARqCKoEvhCCGUSYwAY9XAQE?= X-IronPort-AV: E=Sophos;i="5.69,426,1571695200"; d="scan'208,217";a="430989001" X-MGA-submission: =?us-ascii?q?MDHsdHoQsDbmOZt5HXqA20ulQgia73q0tYZYok?= =?us-ascii?q?Y47Wz46Qp9znN9oClCtTMK3s5GMQTtG1ul2kse0UDVHV1kPSy2mApgS0?= =?us-ascii?q?X8lA8Bq/UFMorfdEOl9AKMUK1nWZ0OLOZve/hU/QOSYUdy9YRGmnWRwF?= =?us-ascii?q?UBK404Osx6gib0Tzenh2Ozcw=3D=3D?= Received: from mail-lj1-f179.google.com ([209.85.208.179]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 12 Jan 2020 23:24:14 +0100 Received: by mail-lj1-f179.google.com with SMTP id y4so7903087ljj.9 for ; Sun, 12 Jan 2020 14:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z0yHSiHf82O+KaRUDNWIk3mHYyP2uZOvuxR/IKX9Xbo=; b=fkTAsB82GvE8XQY6nuH7igECOyI8YWl3mggIgMK3r6snEL42tJEMxXWQWMSPHsV5t7 PUJ44iQCl9pg6My3pu4RiLskclm1OQtH1uVKdTu7RUXVYuwGwgmPk5fBTt72/y+DsliV Usa6gz5N5hFFNPLeVF0Jwz+b8gQjo6BCxUNKxudDAHhd6YjW9oI54QvwJeTgRFtohKiR 24K6sD90zJnfP8RyjYvQIGvGAwjGhb/TbSEuhn5l1FLVJVYkmBlFwC728KTbLooz4QHQ 5I81aAX4N3LZtm/fuUlo+dLNVTRRxzRxzkdYbun8tMczYXnAatr7i0rKJnZs+kcYxou/ +/hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z0yHSiHf82O+KaRUDNWIk3mHYyP2uZOvuxR/IKX9Xbo=; b=oT8x5FgdTY6YzJYYz927InSdRy6XUndNJ3MtxcgmL20WipoDRnKGBjAd3cJlk/2GNr NYE3z6PN9ikL1lpoFHghj/Sc/4+vJQy34GPlHImJuz9Z+FZdjHXqrPCcRvKnGTlw0qi5 Js/bPIMpl1Gmnf7YhPa7dMe95bssWBRSEMuqNxeJQNaKtW/K2SE+Cct0ThWtS+qxR5/d yHPSlZeqiXszYz7k2fIKY+YpzPMdSNycvVGUcj9YxOOElpqpdeuTepBUaJJlt/N67moE nYk8nQDGQcj8lxyWpJfzTd9RIQ6yBLhj6pGGCdoZtef/t6bDIw0Ia+2lEZTwP+ipgFyI pvSQ== X-Gm-Message-State: APjAAAU6ShowYNB9ECoyyG5oGP8XtREwFr/HIPE6iR7GZ98y7D44vxsb ITeH3bsIbjafktONUPEowaK9it5k3+Ivj+k7EEBAgiGiQtI= X-Google-Smtp-Source: APXvYqyCOrTsTBcHpFj4in8HG9AE7O3a5eBaCccZzNXSkxvKKuXfZPScxCtMDCSiEXxGAsAPSvoHRDRdkZ7OGwG98fU= X-Received: by 2002:a05:651c:232:: with SMTP id z18mr8619800ljn.85.1578867853616; Sun, 12 Jan 2020 14:24:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Robert Muller Date: Sun, 12 Jan 2020 17:24:00 -0500 Message-ID: To: =?UTF-8?Q?Nicol=C3=A1s_Ojeda_B=C3=A4r?= Cc: Ocaml Mailing List Content-Type: multipart/alternative; boundary="0000000000008fec58059bf8d105" X-Validation-by: robert.muller2@gmail.com Subject: Re: [Caml-list] make -> dune: recommended structure Reply-To: Robert Muller X-Loop: caml-list@inria.fr X-Sequence: 17949 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --0000000000008fec58059bf8d105 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable One year later, take-two on transitioning from make to dune for an OCaml-based PL course. We have a course library, say, code.cma, stored in a folder outside the dune workspace, say /Users/studentX/lib/, several course projects use the definitions in this course library. As I understand it, the singular "library" in a dune stanza refers to the artifact created by a build (the output) while the plural "libraries" refers to -inputs- to the current build. How to inform dune about the path to look for non-local .cma files? (As in the include switch > ocamlc -I path ...)? I found the following in the dune documentation: Finding external libraries > When a library is not available in the workspace, dune will look it up in > the installed world, and expect it to be already compiled. > > It looks up external libraries using a specific list of search paths. A > list of search paths is specific to a given build context and is determin= ed > as follow: > > if the ocamlfind is present in the PATH of the context, use each line in > the output of ocamlfind printconf path as a search path > otherwise, if opam is present in the PATH, use the output of opam config > var lib > otherwise, take the directory where ocamlc was found, and append ../lib t= o > it. For instance if ocamlc is found in /usr/bin, use /usr/lib > I didn't know what "A list of search paths is specific to a given build context..." meant but ocamlfind -is- present in the PATH and the command > ocamlfind printconf path shows /Users/muller/.opam/default/lib seems reasonable (though I suppose I should go sort out exactly the difference between a package and a library). Anyway, I couldn't find a more civilized way to extend ocamlfind's search path so I edited /Users/muller/.opam/default/lib/findlib.conf by hand to include the path to our course library. Dune still cannot find our course library. I could be wrong, but it seems this setup (with a standard site library code.cma) is pretty common, so I'm sure I'm missing something super-obvious in the documentation. Any leads would be appreciated. Bob Muller On Sun, Jan 13, 2019 at 9:07 AM Nicol=C3=A1s Ojeda B=C3=A4r < nicolas.ojeda.bar@lexifi.com> wrote: > Dear Bob, > > Your present directory structure is just fine. A single `dune` file at > `src/dune` with the contents > > (executable > (name compile) > (public_name translate)) > > should be enough. Here I am assuming that all modules in `src/` are part > of the compiler. If this is not the case you need to specify the modules > you want to include as follows: > > (executable > (name compile) > (public_name translate) > (modules compile ast symbol ...)) > > Note: if you have a file `parser.mly` in your project that needs to be > processed with `ocamlyacc` then you need to declare this in its own stanz= a: > > (ocamlyacc parser) > > Similarly an `ocamllex` file `lexer.mll` needs to be declared with > > (ocamllex lexer) > > Finally, you need to make sure there is a `.opam` file at the root o= f > your project. This file can be be empty if you do not actually use `opam` > but the name `foo` is used by `dune` to identify the "package" your > executable belongs to. Once these files are in place, you can build your > project with > > dune build > > Best wishes, > Nicol=C3=A1s > > On Sun, 13 Jan 2019 at 14:31, Robert Muller > wrote: > >> Greetings. I have a toy compiler made up of ~20 modules: >> >> ast.mli ast.ml symbol.mli symbol.ml ... >> >> and a top-level in compile.ml. These sources are compiled and linked >> using a Makefile which invokes ocamlc. I'll call the resulting compiler >> "translate". >> >> At present I have *all* of these files resident in a single src/ >> directory. I'm considering converting the build to dune for the semester= . >> What would the recommended directory structure be and what would the dun= e >> file(s?) and stanzas look like? I assume this is in the middle of dune's >> wheelhouse but I wasn't able to find anything on it in the examples or >> documents. I assume/hope I don't have to put the modules in a library. >> Thank you, >> Bob Muller >> > --0000000000008fec58059bf8d105 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
One year later, take-two on transitioning=C2=A0from make t= o dune for an OCaml-based PL course. We have=C2=A0a course library, say, co= de.cma, stored in a folder outside the dune workspace, say /Users/studentX/= lib/, several course projects use the definitions in this course library.= =C2=A0
As I understand it, the singular "library" in a dune s= tanza refers to the artifact created by a build (the output) while the plur= al "libraries" refers to -inputs- to the current build. How to in= form dune about the path to look for non-local .cma files? (As in the inclu= de switch > ocamlc -I path ...)? I found=C2=A0the following in the dune = documentation:

Fi= nding external libraries
When a library is not available in the workspac= e, dune will look it up in the installed world, and expect it to be already= compiled.

It looks up external libraries using a specific list of s= earch paths. A list of search paths is specific to a given build context an= d is determined as follow:

if the ocamlfind is present in the PATH o= f the context, use each line in the output of ocamlfind printconf path as a= search path
otherwise, if opam is present in the PATH, use the output o= f opam config var lib
otherwise, take the directory where ocamlc was fou= nd, and append ../lib to it. For instance if ocamlc is found in /usr/bin, u= se /usr/lib

I didn't know what &quo= t;A list of search paths is specific to a given build context..." mean= t but ocamlfind -is- present in the PATH and the command

> ocamlfind printcon= f path

shows=C2=A0

/Users/muller/.opam/default/lib

seems reasona= ble (though I suppose I should go sort out exactly the difference between a= package and a library). Anyway, I couldn't find a more civilized way t= o extend ocamlfind's search path so I edited /Users/muller/.opam/defaul= t/lib/findlib.conf
by hand to include the path to our cours= e library. Dune still cannot find our course library.

<= div>I could be wrong, but it seems this setup (with a standard site library= code.cma) is pretty common, so I'm sure I'm missing something supe= r-obvious in the documentation. Any leads would be appreciated.
<= br>
Bob Muller


On Sun, J= an 13, 2019 at 9:07 AM Nicol=C3=A1s Ojeda B=C3=A4r <nicolas.ojeda.bar@lexifi.com> wrote:
=
Dear Bob,

Your present directory structure is just fine. A single `= dune` file at `src/dune` with the contents

=C2=A0 =C2=A0 (executable
=C2=A0 =C2=A0 =C2=A0(name compile)
=C2=A0 =C2=A0 =C2=A0(public_name translate))

should be enough. Here I am assuming that all modules in `src/` are pa= rt of the compiler. If this is not the case you need to specify the modules= you want to include as follows:

=C2=A0 =C2=A0 (executable
=C2=A0 =C2=A0 =C2=A0(name compile)
=C2=A0 =C2=A0 =C2=A0(public_name translate)
=C2=A0 =C2=A0 =C2=A0(modules compile ast symbol ...))

Note: if you have a file `parser.mly` in your project that needs to be= processed with `ocamlyacc` then you need to declare this in its own stanza= :

=C2=A0 =C2=A0 (ocamlyacc parser)

Similarly an `ocamllex` file `lexer.mll` needs to be declared with

=C2=A0 =C2=A0 (ocamllex lexer)

Finally, you need to make sure there is a `<foo>.opam` file at t= he root of your project. This file can be be empty if you do not actually u= se `opam` but the name `foo` is used by `dune` to identify the "packag= e" your executable belongs to. Once these files are in place, you can build your project with

=C2=A0 =C2=A0 dune build

Best wishes,
Nicol=C3=A1s

On Sun, 13 Jan 2019 at 14:31, Robert Muller <robert.muller2@gmail.co= m> wrote:
Greetings. I have a toy compiler made up of ~20 modules:

ast.mli ast.ml symbol.= mli symbol.ml ...=C2=A0

and a top-level in com= pile.ml. These sources are compiled and linked using a Makefile which i= nvokes ocamlc. I'll call the resulting compiler "translate".<= /div>

At present I have *all* of these files resident in a single src/ direc= tory. I'm considering converting the build to dune for the semester. Wh= at would the recommended directory structure be and what would the dune fil= e(s?) and stanzas look like? I assume this is in the middle of dune's wheelhouse but I wasn't able to fi= nd anything on it in the examples or documents. I assume/hope I don't h= ave to put the modules in a library.
Thank you,
Bob Muller=C2=A0
--0000000000008fec58059bf8d105--