[Libguestfs] [PATCH] common/mlstdutils: Fix parallel builds of bytes.ml.

Richard W.M. Jones rjones at redhat.com
Mon Jul 24 13:51:42 UTC 2017


From: "Richard W.M. Jones" <rjones at redhat.com>

With OCaml < 4.02 when using the alternate Bytes module, this module
would be compiled twice during parallel builds, resulting in
occasional corruption.  The reason for this is that the ocamldep file
mentions ‘bytes.cmo’ whereas the ‘$(OCAML_BYTES_COMPAT_ML)’ macro
expands to ‘../../common/mlstdutils/bytes.ml’.  Make doesn't recognize
these as the same file.

Use an alternate way to specify this file to fix this.
---
 common/mlstdutils/Makefile.am | 9 +++++++--
 m4/guestfs_ocaml.m4           | 2 ++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/common/mlstdutils/Makefile.am b/common/mlstdutils/Makefile.am
index 968a03d..e569154 100644
--- a/common/mlstdutils/Makefile.am
+++ b/common/mlstdutils/Makefile.am
@@ -27,9 +27,14 @@ SOURCES_MLI = \
 	stringMap.mli \
 	stringSet.mli
 
-SOURCES_ML = \
+if HAVE_BYTES_COMPAT_ML
+SOURCES_ML = bytes.ml
+else
+SOURCES_ML =
+endif
+
+SOURCES_ML += \
 	guestfs_config.ml \
-	$(OCAML_BYTES_COMPAT_ML) \
 	libdir.ml \
 	stringMap.ml \
 	stringSet.ml \
diff --git a/m4/guestfs_ocaml.m4 b/m4/guestfs_ocaml.m4
index a7334cd..d0f3349 100644
--- a/m4/guestfs_ocaml.m4
+++ b/m4/guestfs_ocaml.m4
@@ -123,6 +123,8 @@ EOF
 ])
 AC_SUBST([OCAML_BYTES_COMPAT_CMO])
 AC_SUBST([OCAML_BYTES_COMPAT_ML])
+AM_CONDITIONAL([HAVE_BYTES_COMPAT_ML],
+	       [test "x$OCAML_BYTES_COMPAT_ML" != "x"])
 
 dnl Flags we want to pass to every OCaml compiler call.
 OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX-3"
-- 
1.8.3.1




More information about the Libguestfs mailing list