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 8E8FC5D6 for ; Wed, 31 Jul 2019 22:08:02 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.64,331,1559512800"; d="scan'208";a="394048761" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 01 Aug 2019 00:07:59 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 9372C82719; Thu, 1 Aug 2019 00:07:59 +0200 (CEST) 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 C23BB826BB for ; Thu, 1 Aug 2019 00:07:46 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=octa@polychoron.fr; spf=Pass smtp.mailfrom=octa@polychoron.fr; spf=Pass smtp.helo=postmaster@quaesituri.org IronPort-PHdr: =?us-ascii?q?9a23=3A77SBXRwDT46uA6rXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?1OsWIJqq85mqBkHD//Il1AaPAdyBraMawLKK+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1?= =?us-ascii?q?Ov71GonPhMiryuy+4ZLebxhWiDanZb5/LRq6oRneu8ILnYZsN6E9xwfTrHBVYe?= =?us-ascii?q?pW32RoJVySnxb4+Mi9+YNo/jpTtfw86cNOSL32cKskQ7NWCjQmKH0169bwtRbf?= =?us-ascii?q?VwuP52ATXXsQnxFVHgXK9hD6XpP2sivnqupw3TSRMMPqQbwoXzmp8qFmQwLqhi?= =?us-ascii?q?gaLT406HzZhNJ+jKxboxyvqRJwzIHWb46JO/RzZb/dcNAASGZdQspcWS5MD4Wh?= =?us-ascii?q?ZIUPFeoBOuNYopH9qVsKqhu+HwisC/npyjRVmnL226I63PolEQ7YwAwgA9MOu2?= =?us-ascii?q?nTodXyKKgSTfq6wbLQzTXEa/NX2Svy6IjPchA7pvGMW6h8ccTLyUQ2EQ7Ok1ae?= =?us-ascii?q?qZT9Mj6VzOgBrmyW4ut6We+tkWIqqxx9riCry8sykIXFm5wZx1Pe+Sh9wIs5P9?= =?us-ascii?q?m1RUF9bNW5CpVfrTuaOJFzQs46Q2FnpiI6yroetJ6iYSgF0oooxwXea/ybboiI?= =?us-ascii?q?+BPjWPyWITdii3JpYLO/hxCs/ki80uDxVtO43EtOoydEiNXBtGoB2hzO5sSfT/?= =?us-ascii?q?ty5Eah2TKB1wDJ7eFEJFg5la3HJJ492LE9jYITsUPHHi72hEr2jKiWdl8j+uiu?= =?us-ascii?q?8ejnbK/mqoeGN4BokgH+LrgumsunDOskKAcOWmyb9f241L3i5k35XK5HjuY2k6?= =?us-ascii?q?ncqJDVP94Xpq+/Aw9P04Ys8QyzDzm80IdQoX5SJ1tAfFeDjpP1E1DIOvHxS/ml?= =?us-ascii?q?0Hq2lzI+6fTBJLzoBN3kKHfOlLr9Ybc1v0lX1AMb1ddb9plUDasGJrT9QBmi55?= =?us-ascii?q?TjEhYlPlnskK7cA9Jn29ZGAD/dMuqiKKrX9GSwyKcvLu2LPdFHoSv0JuMk++P0?= =?us-ascii?q?jDk+g1BPJPD4j6tSU2ixG7FdG2vcZHPthtkbFmJT41gmS+j7g12FSzlVIXioDf?= =?us-ascii?q?tlumMLTbm+BIKGfbiDxaSb1X7mTIVRYnFNCleWFnGueZ/WA/o=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0B4KQCIEEJd/zMHxAVmHQEBHwUBBgGBT?= =?us-ascii?q?gKCFm0DTzIqhB6PPE4BAQEBAQaBCS1+gmaFfo81gWcJAQMBDB8NAQIBAYRAAgi?= =?us-ascii?q?CRhwGAQQzBg4BAwEBBAEBAgEDAwFshR4Mgjoigm8BBSMPAQUIAQE4DwsYAgImA?= =?us-ascii?q?gJXEwgBAYMeAYF2GKtbcYEygnoBAQWCR4RmCYEMKAGLXxd4gQeBESeBbUkHLj6?= =?us-ascii?q?EDINDglirEwmBMmqGXIRziEQhgxuKIYpapUyBZiKBWE0nETuCbAmKSnSBPYQEP?= =?us-ascii?q?TOBBAGOQwEB?= X-IPAS-Result: =?us-ascii?q?A0B4KQCIEEJd/zMHxAVmHQEBHwUBBgGBTgKCFm0DTzIqhB6?= =?us-ascii?q?PPE4BAQEBAQaBCS1+gmaFfo81gWcJAQMBDB8NAQIBAYRAAgiCRhwGAQQzBg4BA?= =?us-ascii?q?wEBBAEBAgEDAwFshR4Mgjoigm8BBSMPAQUIAQE4DwsYAgImAgJXEwgBAYMeAYF?= =?us-ascii?q?2GKtbcYEygnoBAQWCR4RmCYEMKAGLXxd4gQeBESeBbUkHLj6EDINDglirEwmBM?= =?us-ascii?q?mqGXIRziEQhgxuKIYpapUyBZiKBWE0nETuCbAmKSnSBPYQEPTOBBAGOQwEB?= X-IronPort-AV: E=Sophos;i="5.64,331,1559512800"; d="scan'208";a="315295467" X-MGA-submission: =?us-ascii?q?MDEgJs0qNG1kr731xpcaG3Urvs7A6981Rv+3Iy?= =?us-ascii?q?WgRUDSLLK7oWEvfXzFe8J/0e4JH3WVc5NYYQR+dC75HxbJR3deatjz9E?= =?us-ascii?q?7J9ieF8gL9Y9oIqAPLezpo4DnKCrKUcyQDEUm44pkfsBxd/2SmcLKFdt?= =?us-ascii?q?xSsC5IHKNdQUlP/cDI1dnO8A=3D=3D?= Received: from quaesituri.org ([5.196.7.51]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Aug 2019 00:07:45 +0200 Received: from [192.168.0.2] (unknown [92.128.95.94]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by quaesituri.org (Postfix) with ESMTPSA id 809B210D3AC for ; Thu, 1 Aug 2019 00:09:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.quaesituri.org; s=mail; t=1564610970; bh=Whbr2mKdfy1Ik5ktaGOci9mZG833BDsvicn+p8+YrUM=; h=Subject:To:References:From:Date:In-Reply-To; b=M5473oEmd1VdBC2RTZGEeu8OONMv2uMNeLYGcsOu4G72OYi6UAhaqbXPm0eAy4j+C eCvSzgZhx5GO6Hgah+/lVMfDA5Z4CdykqsYVduE15Vin/i3lFL+lp/5CU5LgTZAVkh XWOSFDj3V6TU3JzVQMG2hklTdRReCPwNd8EHNJjg= To: caml-list@inria.fr References: <20190731211816.x5vj472m34cshifj@matica.foolinux.mooo.com> From: Florian Angeletti Message-ID: <6480f30b-a2c3-90bc-33b3-6efa2e02f398@polychoron.fr> Date: Thu, 1 Aug 2019 00:07:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190731211816.x5vj472m34cshifj@matica.foolinux.mooo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US-large Subject: Re: [Caml-list] How to use -map , -no-alias-deps and friends? Reply-To: Florian Angeletti X-Loop: caml-list@inria.fr X-Sequence: 17727 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: Dear Ian, As far as I can see your invocation of ocamldep in the .depend target is mostly fine. You may want to add `-open Aaa` too (another minor issue here is that `-as-map` is a global flag and does not take an argument) . The problem seems to come from your undisclosed linkorder script. Note than another option to compute .depend and the link order is to use `codept` (available on opam) with the `-no-alias-deps` flag, which removes the need of declaring any map file by hand. — octachron. On 31/07/2019 23:18, Ian Zimmerman wrote: > I'm having hellish time with them. > > I'm trying to build a simple library Aaa; let's assume bytecode only at > this point. It should make available submodules like Aaa.Strutils, > Aaa.Listutils et cetera from other packages, yet when building the > library I want cross-module references look like Strutils , Listutils et > cetera. This seems to be precisely the situation these knobs were meant > for; and yet I just cannot make it work. > > It doesn't help that the two pieces of the manual explaining this, > namely sections 14.2 and 8.9, are in less than perfect alignment: 8.9 > seems to suggest that the "map" file should be Aaa.ml (ie. an > implementation file), and that there should be no corresponding > interface file, but 14.2 shows -map mylib.mli passed to ocamldep. > > Here's my latest attempt. First, the Makefile: > > #! /usr/bin/make -f > > SHELL = /bin/sh > PATH != eval "`opam env`" ; echo "$${PATH}" > export PATH > > OCAMLFLAGS = -no-alias-deps -w -49 # add other options for ocamlc here > > # The list of object files for AAA > AAA_SUBMODULES != echo Aaa__*.ml > AAA_INTERFACES = $(AAA_SUBMODULES:.ml=.mli) > > AAA_NATIVEOBJS != ./linkorder.sh native Aaa $(AAA_SUBMODULES) $(AAA_INTERFACES) > AAA_BYTEOBJS != ./linkorder.sh byte Aaa $(AAA_SUBMODULES) $(AAA_INTERFACES) > > .PHONY: byte native > > byte: Aaa.cma > > native: Aaa.cmxa > > Aaa.cma: $(AAA_BYTEOBJS) Aaa.cmo > ocamlc -a -o Aaa.cma $(OCAMLFLAGS) $(AAA_BYTEOBJS) Aaa.cmo > > Aaa.cmxa: $(AAA_NATIVEOBJS) Aaa.cmx > ocamlopt -a -o Aaa.cmxa $(OCAMLFLAGS) $(AAA_NATIVEOBJS) Aaa.cmx > > # Common rules > .SUFFIXES: .ml .mli .cmo .cmi .cmx > > .ml.cmo: > ocamlc $(OCAMLFLAGS) -open Aaa -c $< > > .ml.cmx: > ocamlopt $(OCAMLFLAGS) -open Aaa -c $< > > Aaa.cmo: Aaa.ml > ocamlc $(OCAMLFLAGS) -c Aaa.ml > > Aaa.cmx: Aaa.ml > ocamlopt $(OCAMLFLAGS) -c Aaa.ml > > .mli.cmi: > ocamlc $(OCAMLFLAGS) -open Aaa -c $< > > # Dependencies > .depend: Makefile $(AAA_INTERFACES) $(AAA_SUBMODULES) Aaa.ml > ocamldep -map Aaa.ml $(AAA_INTERFACES) $(AAA_SUBMODULES) -as-map Aaa.ml > .depend > > include .depend > > # Test suite > RunTests: Aaa.cma RunTests.ml > ocamlfind ocamlc -package qcheck-core -package qcheck-core.runner -o RunTests -linkpkg Aaa.cma RunTests.ml > > .PHONY: clean test > > test: RunTests > ./RunTests > > clean: > rm -f *.cma *.cmxa *.cmo *.o *.cmx *.cmi .depend RunTests > > # makefile ends here > > Here's Aaa.ml: > > module Colorspec = Aaa__Colorspec > module Exnutils = Aaa__Exnutils > module HashedString = Aaa__HashedString > module Ioutils = Aaa__Ioutils > module Listutils = Aaa__Listutils > module Resultx = Aaa__Resultx > module Sm = Aaa__Sm > module Strutils = Aaa__Strutils > > ... and in this iteration, there is no Aaa.mli. > > This produces the following output: > > matica!91 aaa$ make > Fatal error: exception Failure("Aaa.mli : empty map file or parse error") > Fatal error: exception Failure("Aaa.mli : empty map file or parse error") > ocamldep -map Aaa.ml Aaa__Colorspec.mli Aaa__Exnutils.mli Aaa__HashedString.mli Aaa__Ioutils.mli Aaa__Listutils.mli Aaa__Resultx.mli Aaa__Sm.mli Aaa__Strutils.mli Aaa__Colorspec.ml Aaa__Exnutils.ml Aaa__HashedString.ml Aaa__Ioutils.ml Aaa__Listutils.ml Aaa__Resultx.ml Aaa__Sm.ml Aaa__Strutils.ml -as-map Aaa.ml > .depend > Fatal error: exception Failure("Aaa.mli : empty map file or parse error") > Fatal error: exception Failure("Aaa.mli : empty map file or parse error") > ocamlc -no-alias-deps -w -49 -c Aaa.ml > ocamlc -a -o Aaa.cma -no-alias-deps -w -49 Aaa.cmo > matica!92 aaa$ ls > Aaa.cma Aaa__Colorspec.mli Aaa__Ioutils.ml Aaa__Resultx.mli LICENSE install.sh > Aaa.cmi Aaa__Exnutils.ml Aaa__Ioutils.mli Aaa__Sm.ml META linkorder.sh > Aaa.cmo Aaa__Exnutils.mli Aaa__Listutils.ml Aaa__Sm.mli Makefile > Aaa.ml Aaa__HashedString.ml Aaa__Listutils.mli Aaa__Strutils.ml ORIGINAL_VERSION > Aaa__Colorspec.ml Aaa__HashedString.mli Aaa__Resultx.ml Aaa__Strutils.mli RunTests.ml > > So, an archive file gets created, but obviously doesn't contain any real > code. > > Virtual hugs for setting me on the right path. >