Richard W.M. Jones
2020-Mar-10 15:07 UTC
[Libguestfs] [PATCH common] common: Use LIBGUESTFS_CFLAGS when compiling.
Allows virt-v2v to be compiled against the libguestfs build directory. We don't actually need to link these libraries, so LIBGUESTFS_LIBS is not needed here. --- mltools/Makefile.am | 4 +++- mlutils/Makefile.am | 3 ++- options/Makefile.am | 3 ++- utils/Makefile.am | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mltools/Makefile.am b/mltools/Makefile.am index ce4d1ac..3b4172d 100644 --- a/mltools/Makefile.am +++ b/mltools/Makefile.am @@ -103,7 +103,9 @@ libmltools_a_CPPFLAGS = \ -I$(top_srcdir)/common/mlutils libmltools_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \ + $(LIBVIRT_CFLAGS) \ + $(LIBXML2_CFLAGS) \ + $(LIBGUESTFS_CFLAGS) \ $(JANSSON_CFLAGS) \ -fPIC diff --git a/mlutils/Makefile.am b/mlutils/Makefile.am index e86d7bb..38a683f 100644 --- a/mlutils/Makefile.am +++ b/mlutils/Makefile.am @@ -63,7 +63,8 @@ libmlcutils_a_CPPFLAGS = \ -I$(shell $(OCAMLC) -where) libmlcutils_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ - -fPIC + -fPIC \ + $(LIBGUESTFS_CFLAGS) BOBJECTS = $(SOURCES_ML:.ml=.cmo) XOBJECTS = $(BOBJECTS:.cmo=.cmx) diff --git a/options/Makefile.am b/options/Makefile.am index 394f668..b38fedc 100644 --- a/options/Makefile.am +++ b/options/Makefile.am @@ -45,7 +45,8 @@ liboptions_la_CPPFLAGS = \ liboptions_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(LIBCONFIG_CFLAGS) \ - $(LIBXML2_CFLAGS) + $(LIBXML2_CFLAGS) \ + $(LIBGUESTFS_CFLAGS) liboptions_la_LIBADD = \ $(top_builddir)/common/utils/libutils.la \ $(LIBCONFIG_LIBS) \ diff --git a/utils/Makefile.am b/utils/Makefile.am index 4878e3b..b47285d 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -37,4 +37,5 @@ libutils_la_CPPFLAGS = \ libutils_la_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ $(GCC_VISIBILITY_HIDDEN) \ - $(LIBXML2_CFLAGS) + $(LIBXML2_CFLAGS) \ + $(LIBGUESTFS_CFLAGS) -- 2.24.1
Pino Toscano
2020-Mar-11 16:39 UTC
Re: [Libguestfs] [PATCH common] common: Use LIBGUESTFS_CFLAGS when compiling.
On Tuesday, 10 March 2020 16:07:44 CET Richard W.M. Jones wrote:> Allows virt-v2v to be compiled against the libguestfs build directory. > > We don't actually need to link these libraries, so LIBGUESTFS_LIBS is > not needed here. > --- > mltools/Makefile.am | 4 +++- > mlutils/Makefile.am | 3 ++- > options/Makefile.am | 3 ++- > utils/Makefile.am | 3 ++- > 4 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/mltools/Makefile.am b/mltools/Makefile.am > index ce4d1ac..3b4172d 100644 > --- a/mltools/Makefile.am > +++ b/mltools/Makefile.am > @@ -103,7 +103,9 @@ libmltools_a_CPPFLAGS = \ > -I$(top_srcdir)/common/mlutils > libmltools_a_CFLAGS = \ > $(WARN_CFLAGS) $(WERROR_CFLAGS) \ > - $(LIBVIRT_CFLAGS) $(LIBXML2_CFLAGS) \ > + $(LIBVIRT_CFLAGS) \ > + $(LIBXML2_CFLAGS) \ > + $(LIBGUESTFS_CFLAGS) \ > $(JANSSON_CFLAGS) \This is OK.> diff --git a/mlutils/Makefile.am b/mlutils/Makefile.am > index e86d7bb..38a683f 100644 > --- a/mlutils/Makefile.am > +++ b/mlutils/Makefile.am > @@ -63,7 +63,8 @@ libmlcutils_a_CPPFLAGS = \ > -I$(shell $(OCAMLC) -where) > libmlcutils_a_CFLAGS = \ > $(WARN_CFLAGS) $(WERROR_CFLAGS) \ > - -fPIC > + -fPIC \ > + $(LIBGUESTFS_CFLAGS)This is not needed (see below).> diff --git a/options/Makefile.am b/options/Makefile.am > index 394f668..b38fedc 100644 > --- a/options/Makefile.am > +++ b/options/Makefile.am > @@ -45,7 +45,8 @@ liboptions_la_CPPFLAGS = \ > liboptions_la_CFLAGS = \ > $(WARN_CFLAGS) $(WERROR_CFLAGS) \ > $(LIBCONFIG_CFLAGS) \ > - $(LIBXML2_CFLAGS) > + $(LIBXML2_CFLAGS) \ > + $(LIBGUESTFS_CFLAGS)This is OK.> diff --git a/utils/Makefile.am b/utils/Makefile.am > index 4878e3b..b47285d 100644 > --- a/utils/Makefile.am > +++ b/utils/Makefile.am > @@ -37,4 +37,5 @@ libutils_la_CPPFLAGS = \ > libutils_la_CFLAGS = \ > $(WARN_CFLAGS) $(WERROR_CFLAGS) \ > $(GCC_VISIBILITY_HIDDEN) \ > - $(LIBXML2_CFLAGS) > + $(LIBXML2_CFLAGS) \ > + $(LIBGUESTFS_CFLAGS)This is not needed (see below). Two places include guestfs.h without actually requiring it. In particular, I built virt-v2v fine with the following changes: diff --git a/mlutils/c_utils-c.c b/mlutils/c_utils-c.c index ef84763..d9c1a48 100644 --- a/mlutils/c_utils-c.c +++ b/mlutils/c_utils-c.c @@ -29,7 +29,6 @@ #include <caml/mlvalues.h> #include <caml/unixsupport.h> -#include "guestfs.h" #include "guestfs-utils.h" #pragma GCC diagnostic ignored "-Wmissing-prototypes" diff --git a/utils/utils.c b/utils/utils.c index 60ae113..6f41087 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -46,7 +46,6 @@ #include "ignore-value.h" /* NB: MUST NOT include "guestfs-internal.h". */ -#include "guestfs.h" #include "guestfs-utils.h" /** -- Pino Toscano
Apparently Analagous Threads
- [PATCH 0/5] Miscellaneous refactoring of common/utils, create common/mltools
- Re: [PATCH virt-v2v] v2v: Use LIBGUESTFS_CFLAGS/LIBS when compiling and linking.
- [PATCH virt-v2v] v2v: Use LIBGUESTFS_CFLAGS/LIBS when compiling and linking.
- [PATCH v2 API PROPOSAL 0/5] inspection Add network interfaces to inspection data.
- [PATCH 00/12] Refactor utility functions.