From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 2C7DE7FE36 for ; Sun, 10 Jul 2016 13:03:35 +0200 (CEST) IronPort-PHdr: 9a23:AFs4WxZZ75A3BtNIMHBd/EH/LSx+4OfEezUN459isYplN5qZpcuzbnLW6fgltlLVR4KTs6sC0LuO9fu8Ejdaqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ3pzxjLz5oMebSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGx48sgs/M9YUKj8Y79wDfkBVGxnYCgJ45jOvAPfTA3HynY5X2ESlVIcBgHf8BD8Upr0vy/+scJy3SCbOYv9SrViChq46KI+ZxLyhG88Kzk96GTejMo42KNdrhWJqBFlz8vPfIaRLP93eKWbcd5MFjkJZdpYSyEUWtD0VIAIFedUeL8A94Q= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=217.72.192.75; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=217.72.192.75; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=217.72.192.75; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CrAADwKYJXh0vASNldhBR8uxAehXoCgR88EAEBAQEBAQEBEQEBAQgNCQkhL4IyBAESAYITAQVVJBALRlcGEwkSiBkBCa9rb402AQEBAQEBBAEBAQEBFA6FL4VFhE2CPQuDBwWIHJB8gTkChFKIRYlJBIVfkA81gigRC4FObAGJeQEBAQ X-IPAS-Result: A0CrAADwKYJXh0vASNldhBR8uxAehXoCgR88EAEBAQEBAQEBEQEBAQgNCQkhL4IyBAESAYITAQVVJBALRlcGEwkSiBkBCa9rb402AQEBAQEBBAEBAQEBFA6FL4VFhE2CPQuDBwWIHJB8gTkChFKIRYlJBIVfkA81gigRC4FObAGJeQEBAQ X-IronPort-AV: E=Sophos;i="5.28,340,1464645600"; d="asc'?scan'208";a="184415173" Received: from mout.kundenserver.de ([217.72.192.75]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2016 13:03:34 +0200 Received: from office1.lan.sumadev.de ([178.4.30.143]) by mrelayeu.kundenserver.de (mreue101) with ESMTPSA (Nemesis) id 0M2dqH-1b6BbV1ovt-00sQ8Q; Sun, 10 Jul 2016 13:03:32 +0200 Received: from [192.168.65.10] (unknown [192.168.65.10]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id C4D88DC05D; Sun, 10 Jul 2016 13:03:31 +0200 (CEST) Message-ID: <1468148606.25014.58.camel@e130.lan.sumadev.de> From: Gerd Stolpmann To: Martin DeMello Cc: "caml-list@inria.fr" Date: Sun, 10 Jul 2016 13:03:26 +0200 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-gWF/ELXlDUtcVNvJ6b5V" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 X-Provags-ID: V03:K0:uGnnK2U6DZ6CDcPyIjaeGYZabqVUmjaVSnTF6HkrK5tarJro4mq HkEvYZPevlAnqv9dR8DQqJllRIB3S+F62OIri/fCLVw0u5u9EB4frdu9r+U0+ZjSbsYwiO9 RGxYAWPY4iGvSCG3NEWRcRt0Jcv+ojfHVEYdz5LVxlB/d9N4DMTBRa3UhqA8PRNquy0gjnj 2QuUzUFca4eW2qGbZVW6Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:6OVwLsCg7Ns=:3xlW63gIkGBTQm8TPxEyOB 0TpSSgOIIVKj4eQC69ZXICvEABl0204AEEwp1gCuBgQB7G23zMtl0/PUTdNe/2TgZm5yMtKA7 MbbELu2l8pB5NRpDpScHKjsk3DVZ9NCbXsRm0NZyj6TUr+TrI6XCieDKvfwauAQFR56WDcXN8 fDtTwCY0sudtFfesyLYGUKKnAn9C/yGXyaMGmK+EO7FjeRNQcE9W18SUCHWD/YmyFE3fRFrFX C+pS6E9ggh8dZ3zDy4McmA0YPluCwVUsfTVglSaHtXJrgn09DCPNqr7ops7brame9NKg2P/KM zLGT3SNMAutNvUncfxxGjXFHlCjfQOwSMELByDTuKHxL0Z9fPN0uODnBeqTAfeuOfdzfSTarQ 8aJcDkhIcIzfUpBpamjZEXPN/DjSQ7L1cClCX9RnORGsLzHRz02zCBTsExlGlcpmMYB2UluRZ L2p1IIKvM+SrKNi1/1y9OoseODXAYPelA9dMF39inERk2giVWR+QqrvyApIqyA/xB4XUIMZQc Y6H+ayURJLV7zUf7+5e9vVTiKjquHSetBbMWC/hQhNlsLXHgvDrejDhqzCi7GQg5xt4c3dRNQ K4aqL8+cRc/bZxFiPnvTq+6/UfMvxQ/EK80Ovwnn+GCpupYjIV8s9rxrATk40TKDIae3pTNE8 WcKl2jNpxaWkowNTw8THucOfMA8o0z2fjnKVlFJs862klmpzF4rU2s6uTu9gIOCSmE3o= Subject: Re: [Caml-list] why is building ocaml hard? --=-gWF/ELXlDUtcVNvJ6b5V Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Samstag, den 09.07.2016, 21:16 -0700 schrieb Martin DeMello: > My consistent experience with OCaml has been that the build systems > are fiddly and hard to work with, but I've never seen a discussion of > why this is so (as opposed to problems with specific build tools). > Supposing you were to start from scratch and develop a new build > system in a bottom up manner, starting with a set of libraries and > utilities and working your way up to a framework or dsl, what would > the difficult steps be? Well, I don't think you can improve it that much (except... see below). Since I've taken over omake and studied it carefully, I think I have good insights into the problems. In short, the big difficulty of OCaml is the strict build topology. You need to build a module before the caller of the module. Most build-tool related failures come from that. Note that many other languages have more relaxed build topologies, or work around the problem by doing 2-pass builds (i.e. you first pre-compile and extract interfaces for the whole project, and do the actual code generation in the second pass). Let's have a closer look why it is relatively error-prone to extract the dependencies. The tool in question is ocamldep. It is fairly dumb in so far it is only parsing the source code, and then looks at all module-related constructs (open, include, module, etc.). Because it never looks into already compiled interfaces and also proceeds file by file, it may sometimes emit wrong dependency information. For example, when there is open M1 open M2 at the beginning of a file, ocamldep doesn't know whether M2 is another top-level module, or whether it is a submodule of M1. ocamldep normally errs on the side of generating too many dependencies, which is then tried to be corrected by only accepting those deps corresponding to existing files. In this example, this would mean that a dependency to M2 is emitted when there is a file M2.ml. Note that this is wrong when M2 is actually a submodule of M1 AND the file M2.ml exists. So how to fix this? In my opinion there are two solutions. You can either have a more intelligent ocamldep (e.g. one that reads in non-local cmi files and uses that information and also tries to interpret all project ml files at once and not file by file - btw, did anybody check whether there is an algorithm that precisely solves the problem?). The other solution path is to mark toplevel modules in the syntax of OCaml (e.g. you'd have to do "open ^M2" is M2 is a toplevel module). Besides ocamldep, there are also other aspects that affect the dependency analysis. E.g. with omake there is a distinction of project-local and other dependencies, and you need to set the OCAMLINCLUDES variable to add other directories to the local part of the analysis, whereas the non-local deps are nowadays handled with ocamlfind. First of all, this distinction is not really clear to every user, and second, there are some difficulties in processing that when both concepts overlap (e.g. you want to also get project-local dependency expansion with ocamlfind). Note that recently the dependency analysis even became harder because of flambda. Now cmx files play a bigger role. In particular a cmx file can refer to another cmx file that isn't a direct dependency. In other words, there is a second kind of dependency that is added by the code generator. Current build tools cannot record these dependencies yet. Gerd --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-gWF/ELXlDUtcVNvJ6b5V Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJXgit+AAoJEAaM4b9ZLB5TFlYIAJZccNz0W0/Gka3IDjpm8L/x 5SRHqHJLE+HsHos4F+2YqHa0fDuaLPSa0o9gtF2kBBR6CIVKnDAoud2zvCHqQPTh /rhhYdVJ0Ou2I1Yi4TGiKO+xOLyMTTOPNciBd6NM2uhxWy5Et5H2NctJ8CxEhatl RcKhtv80AWdremGSe+1a2R6C64DxF/7lBCTxlA9vBFD5vVTmt5IfuolyUh6RA0pA Fv1Mxu1Q6SeMZa7GFot04qp2NcfnXMjQ3+pJEOfAhGChNVpSlnFD66f/O0XUEo5I seB9GHCz5cMDwvhrTXpDSf+I3B1iUQmCmwnYRffakRkE4HmpQWo5C7BNcJo0Or0= =5WNx -----END PGP SIGNATURE----- --=-gWF/ELXlDUtcVNvJ6b5V--