Otherwise
guestfs-tools$ ../libguestfs/run make check
produces errors like
GEN tools_utils_tests
/usr/bin/ld: cannot find -lguestfs
/usr/bin/ld: cannot find -lguestfs
collect2: error: ld returned 1 exit status
File "caml_startup", line 1:
Error: Error during linking (exit code 1)
in the "mltools" and "mlvisit" modules.
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
---
mltools/Makefile.am | 24 ++++++++++++++++++------
mlvisit/Makefile.am | 9 ++++++++-
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/mltools/Makefile.am b/mltools/Makefile.am
index 5cec178e4a78..26e466835732 100644
--- a/mltools/Makefile.am
+++ b/mltools/Makefile.am
@@ -262,9 +262,15 @@ tools_utils_tests_DEPENDENCIES = \
../mlpcre/mlpcre.$(MLARCHIVE) \
$(MLTOOLS_CMA) \
$(top_srcdir)/ocaml-link.sh
+tools_utils_tests_OCAMLCLIBS = \
+ -pthread -lpthread \
+ -lutils \
+ $(LIBXML2_LIBS) \
+ -lgnu \
+ $(LIBGUESTFS_LIBS)
tools_utils_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread -lutils $(LIBXML2_LIBS) -lgnu' -- \
+ -cclib '$(tools_utils_tests_OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(tools_utils_tests_THEOBJECTS) -o $@
@@ -276,9 +282,15 @@ getopt_tests_DEPENDENCIES = \
../mlpcre/mlpcre.$(MLARCHIVE) \
$(MLTOOLS_CMA) \
$(top_srcdir)/ocaml-link.sh
+getopt_tests_OCAMLCLIBS = \
+ -pthread -lpthread \
+ -lutils \
+ $(LIBXML2_LIBS) \
+ -lgnu \
+ $(LIBGUESTFS_LIBS)
getopt_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread -lutils $(LIBXML2_LIBS) -lgnu' -- \
+ -cclib '$(getopt_tests_OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(getopt_tests_THEOBJECTS) -o $@
@@ -292,7 +304,7 @@ JSON_tests_DEPENDENCIES = \
$(top_srcdir)/ocaml-link.sh
JSON_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread' -- \
+ -cclib '-pthread -lpthread $(LIBGUESTFS_LIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(JSON_tests_THEOBJECTS) -o $@
@@ -306,7 +318,7 @@ JSON_parser_tests_DEPENDENCIES = \
$(top_srcdir)/ocaml-link.sh
JSON_parser_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread $(OCAMLCLIBS)' -- \
+ -cclib '-pthread -lpthread $(OCAMLCLIBS) $(LIBGUESTFS_LIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(JSON_parser_tests_THEOBJECTS) -o $@
@@ -320,7 +332,7 @@ machine_readable_tests_DEPENDENCIES = \
$(top_srcdir)/ocaml-link.sh
machine_readable_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread -lutils -lgnu' -- \
+ -cclib '-pthread -lpthread -lutils -lgnu $(LIBGUESTFS_LIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(machine_readable_tests_THEOBJECTS) -o $@
@@ -334,7 +346,7 @@ tools_messages_tests_DEPENDENCIES = \
$(top_srcdir)/ocaml-link.sh
tools_messages_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread -lutils -lgnu' -- \
+ -cclib '-pthread -lpthread -lutils -lgnu $(LIBGUESTFS_LIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(tools_messages_tests_THEOBJECTS) -o $@
diff --git a/mlvisit/Makefile.am b/mlvisit/Makefile.am
index 64108ebfbbc7..beff0bc64cdc 100644
--- a/mlvisit/Makefile.am
+++ b/mlvisit/Makefile.am
@@ -115,9 +115,16 @@ visit_tests_DEPENDENCIES = \
../mlutils/mlcutils.$(MLARCHIVE) \
$(MLVISIT_CMA) \
$(top_srcdir)/ocaml-link.sh
+visit_tests_OCAMLCLIBS = \
+ -pthread -lpthread \
+ -lvisit \
+ -lstructs \
+ -lutils \
+ $(LIBXML2_LIBS) \
+ $(LIBGUESTFS_LIBS)
visit_tests_LINK = \
$(top_srcdir)/ocaml-link.sh \
- -cclib '-pthread -lpthread -lvisit -lstructs -lutils $(LIBXML2_LIBS)' -- \
+ -cclib '$(visit_tests_OCAMLCLIBS)' -- \
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLLINKFLAGS) \
$(OCAMLPACKAGES) $(OCAMLPACKAGES_TESTS) \
$(visit_tests_THEOBJECTS) -o $@
--
2.19.1.3.g30247aa5d201