[Libguestfs] [PATCH common] common: Use LIBGUESTFS_CFLAGS when compiling.

Pino Toscano ptoscano at redhat.com
Wed Mar 11 16:39:50 UTC 2020


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20200311/87c076c9/attachment.sig>


More information about the Libguestfs mailing list