caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] How to use -map , -no-alias-deps and friends?
@ 2019-07-31 21:18 Ian Zimmerman
  2019-07-31 21:52 ` Nicolás Ojeda Bär
  2019-07-31 22:07 ` [Caml-list] How to use -map , -no-alias-deps and friends? Florian Angeletti
  0 siblings, 2 replies; 14+ messages in thread
From: Ian Zimmerman @ 2019-07-31 21:18 UTC (permalink / raw)
  To: Caml Mailinglist

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 (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


.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

		ocamlc $(OCAMLFLAGS) -open Aaa -c $<

		ocamlopt $(OCAMLFLAGS) -open Aaa -c $<

		ocamlc $(OCAMLFLAGS) -c

		ocamlopt $(OCAMLFLAGS) -c

		ocamlc $(OCAMLFLAGS) -open Aaa -c $<

# Dependencies
		ocamldep -map $(AAA_INTERFACES) $(AAA_SUBMODULES) -as-map > .depend

include .depend

# Test suite
RunTests: Aaa.cma
		ocamlfind ocamlc -package qcheck-core -package qcheck-core.runner -o RunTests -linkpkg Aaa.cma

.PHONY: clean test

test: RunTests

		rm -f *.cma *.cmxa *.cmo *.o *.cmx *.cmi .depend RunTests

# makefile ends here


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__Colorspec.mli Aaa__Exnutils.mli Aaa__HashedString.mli Aaa__Ioutils.mli Aaa__Listutils.mli Aaa__Resultx.mli Aaa__Sm.mli Aaa__Strutils.mli -as-map > .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
ocamlc -a -o Aaa.cma -no-alias-deps -w -49     Aaa.cmo
 matica!92 aaa$ ls
Aaa.cma		   Aaa__Colorspec.mli     Aaa__Resultx.mli	 LICENSE
Aaa.cmi	  Aaa__Ioutils.mli	 META
Aaa.cmo		   Aaa__Exnutils.mli   Aaa__Sm.mli	 Makefile   Aaa__Listutils.mli	 ORIGINAL_VERSION  Aaa__HashedString.mli     Aaa__Strutils.mli

So, an archive file gets created, but obviously doesn't contain any real

Virtual hugs for setting me on the right path.

Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-11-15  0:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-31 21:18 [Caml-list] How to use -map , -no-alias-deps and friends? Ian Zimmerman
2019-07-31 21:52 ` Nicolás Ojeda Bär
2019-08-06 18:47   ` Ian Zimmerman
2019-08-07 20:32     ` [Caml-list] opam and dune [Was: How to use -map] Ian Zimmerman
2019-08-08  1:38       ` Rudi Grinberg
2019-08-08 17:48         ` Hendrik Boom
2019-08-08 17:53           ` Rudi Grinberg
2019-08-08 19:38             ` Daniel Bünzli
2019-11-15  0:32         ` Ian Zimmerman
2019-08-08 18:05       ` Yawar Amin
2019-08-08 19:03         ` Josh Berdine
2019-07-31 22:07 ` [Caml-list] How to use -map , -no-alias-deps and friends? Florian Angeletti
2019-07-31 23:14   ` Ian Zimmerman
2019-08-01  9:40     ` Florian Angeletti

caml-list - the Caml user's mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 caml-list caml-list/ \
	public-inbox-index caml-list

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone