Even if ocamlopt is available, always build a bytecode version of
‘common/mlstdutils’.
The generator is always built as bytecode. The generator depends on
‘../common/mlstdutils/guestfs_config.cmo’ and
‘../common/mlstdutils/std_utils.cmo’, but if these have not been built
already then the generator races to build the .cmi files. Since the
generator doesn't have the dependencies covering for the
‘common/mlstdutils’ directory you can get a broken link on fast
machines:
File "../common/mlstdutils/std_utils.ml", line 1:
Error: Corrupted compiled interface
../common/mlstdutils/guestfs_config.cmi
make[2]: *** [Makefile:1993: ../common/mlstdutils/std_utils.cmo] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/builddir/build/BUILD/libguestfs-1.37.17/generator'
---
common/mlstdutils/Makefile.am | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index 9e0b34d42..d965f433e 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -48,7 +48,9 @@ else
MLSTDUTILS_CMA = mlstdutils.cmxa
endif
-noinst_DATA = $(MLSTDUTILS_CMA)
+# Just for this library, we need to build both bytecode and native
+# code because the generator always requires the bytecode version.
+noinst_DATA = mlstdutils.cma mlstdutils.cmxa
libmlstdutils_a_SOURCES = dummy.c
libmlstdutils_a_CPPFLAGS = \
@@ -79,8 +81,11 @@ endif
libmlstdutils_a_DEPENDENCIES = $(OBJECTS)
-$(MLSTDUTILS_CMA): $(OBJECTS)
- $(OCAMLFIND) mklib $(OCAMLPACKAGES) $(OBJECTS) -o mlstdutils
+mlstdutils.cma: $(BOBJECTS)
+ $(OCAMLFIND) mklib $(OCAMLPACKAGES) $^ -o mlstdutils
+
+mlstdutils.cmxa: $(XOBJECTS)
+ $(OCAMLFIND) mklib $(OCAMLPACKAGES) $^ -o mlstdutils
# This OCaml module has to be generated by make (configure will put
# unexpanded prefix macro in).
--
2.13.2