Permalink
Browse files

An example of incorrectly compiled library

if one tries to compile the foo_bar.cma library with:

ocamlbuild -classic-display -Is src,src/bar src/bar/foo_bar.cma

the last line says:

ocamlfind ocamlc -a src/m.cmo src/bar/foo_bar.cmo -o src/bar/foo_bar.cma

which is incorrect because the module M is not part of the library. If
several such libraries exist (here, like the foo_baz library), the
compiler complains that both libraries will contain the module M. The
next commit will show how to fix that.
  • Loading branch information...
1 parent dc996cf commit 090acd582b437d17249c9a0bca840c4706980f95 @pveber committed Dec 15, 2012
@@ -0,0 +1,38 @@
+# OASIS_START
+# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
+
+SETUP = ocaml setup.ml
+
+build: setup.data
+ $(SETUP) -build $(BUILDFLAGS)
+
+doc: setup.data build
+ $(SETUP) -doc $(DOCFLAGS)
+
+test: setup.data build
+ $(SETUP) -test $(TESTFLAGS)
+
+all:
+ $(SETUP) -all $(ALLFLAGS)
+
+install: setup.data
+ $(SETUP) -install $(INSTALLFLAGS)
+
+uninstall: setup.data
+ $(SETUP) -uninstall $(UNINSTALLFLAGS)
+
+reinstall: setup.data
+ $(SETUP) -reinstall $(REINSTALLFLAGS)
+
+clean:
+ $(SETUP) -clean $(CLEANFLAGS)
+
+distclean:
+ $(SETUP) -distclean $(DISTCLEANFLAGS)
+
+setup.data:
+ $(SETUP) -configure $(CONFIGUREFLAGS)
+
+.PHONY: build doc test all install uninstall reinstall clean distclean configure
+
+# OASIS_STOP
View
@@ -0,0 +1,43 @@
+OASISFormat: 0.3
+OCamlVersion: >= 3.12
+Name: foo
+Version: 1.0
+Synopsis: Foo
+Authors: Philippe Veber
+License: GPL
+LicenseFile: LICENCE
+Plugins: META (0.3), DevFiles (0.3)
+BuildTools: ocamlbuild
+
+
+Library foo
+ Path: src
+ Modules: M
+
+Library foo_bar
+ Path: src/bar
+ Pack: true
+ Modules: A
+# FindlibParent: foo
+# FindlibName: bar
+ BuildDepends: foo
+
+Library foo_baz
+ Path: src/baz
+ Pack: true
+ Modules: B
+# FindlibParent: foo
+# FindlibName: baz
+ BuildDepends: foo
+
+Library foo_qux
+ Path: src/qux
+ Modules: C
+ BuildDepends: foo
+
+Executable test
+ Path: src/test
+ MainIs: test.ml
+ BuildDepends: foo_bar#, foo_baz, foo_qux
+ BuildTools: ocamlbuild
+ Install: false
View
@@ -0,0 +1,34 @@
+# OASIS_START
+# DO NOT EDIT (digest: 873f873b3e1d482dac22f8c09b2aff04)
+# Ignore VCS directories, you can use the same kind of rule outside
+# OASIS_START/STOP if you want to exclude directories that contains
+# useless stuff for the build process
+<**/.svn>: -traverse
+<**/.svn>: not_hygienic
+".bzr": -traverse
+".bzr": not_hygienic
+".hg": -traverse
+".hg": not_hygienic
+".git": -traverse
+".git": not_hygienic
+"_darcs": -traverse
+"_darcs": not_hygienic
+# Library foo
+"src/foo.cmxs": use_foo
+# Library foo_bar
+"src/bar/foo_bar.cmxs": use_foo_bar
+"src/bar/a.cmx": for-pack(Foo_bar)
+<src/bar/*.ml{,i}>: use_foo
+# Library foo_baz
+"src/baz/foo_baz.cmxs": use_foo_baz
+"src/baz/b.cmx": for-pack(Foo_baz)
+<src/baz/*.ml{,i}>: use_foo
+# Library foo_qux
+"src/qux/foo_qux.cmxs": use_foo_qux
+<src/qux/*.ml{,i}>: use_foo
+# Executable test
+"src/test/test.byte": use_foo_bar
+"src/test/test.byte": use_foo
+<src/test/*.ml{,i}>: use_foo_bar
+<src/test/*.ml{,i}>: use_foo
+# OASIS_STOP
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# OASIS_START
+# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7)
+set -e
+
+FST=true
+for i in "$@"; do
+ if $FST; then
+ set --
+ FST=false
+ fi
+
+ case $i in
+ --*=*)
+ ARG=${i%%=*}
+ VAL=${i##*=}
+ set -- "$@" "$ARG" "$VAL"
+ ;;
+ *)
+ set -- "$@" "$i"
+ ;;
+ esac
+done
+
+ocaml setup.ml -configure "$@"
+# OASIS_STOP
Oops, something went wrong.

0 comments on commit 090acd5

Please sign in to comment.