diff mbox series

contrib/plugins: ensure build does not pick up a system copy of plugin header

Message ID Zu4063fjfHC5hHUl@humpty.home.comstyle.com (mailing list archive)
State New
Headers show
Series contrib/plugins: ensure build does not pick up a system copy of plugin header | expand

Commit Message

Brad Smith Sept. 21, 2024, 2:52 a.m. UTC
contrib/plugins: ensure build does not pick up a system copy of plugin header

With the ordering of the header path if a copy of QEMU is installed it
will pickup the system copy of the header before the build paths copy
and the build will fail.

Signed-off-by: Brad Smith <brad@comstyle.com>
---
 contrib/plugins/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Alex Bennée Sept. 21, 2024, 12:55 p.m. UTC | #1
Brad Smith <brad@comstyle.com> writes:

> contrib/plugins: ensure build does not pick up a system copy of plugin
> header

I'm confused because this changes the ordering of the GLIB inclusion. We
shouldn't be including the whole QEMU include path.

How does this fail?

> With the ordering of the header path if a copy of QEMU is installed it
> will pickup the system copy of the header before the build paths copy
> and the build will fail.
>
> Signed-off-by: Brad Smith <brad@comstyle.com>
> ---
>  contrib/plugins/Makefile | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
> index 05a2a45c5c..52fc390376 100644
> --- a/contrib/plugins/Makefile
> +++ b/contrib/plugins/Makefile
> @@ -41,9 +41,10 @@ SONAMES := $(addsuffix $(SO_SUFFIX),$(addprefix lib,$(NAMES)))
>  
>  # The main QEMU uses Glib extensively so it is perfectly fine to use it
>  # in plugins (which many example do).
> -PLUGIN_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
> -PLUGIN_CFLAGS += -fPIC -Wall
> +GLIB_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
>  PLUGIN_CFLAGS += -I$(TOP_SRC_PATH)/include/qemu

Not withstanding the fact I've just borrowed bswap.h for a test plugin
maybe we should actually copy qemu-plugin.h to an entirely new location
during the build and then include from there to avoid any other
potential pollutions?

> +PLUGIN_CFLAGS += $(GLIB_CFLAGS)
> +PLUGIN_CFLAGS += -fPIC -Wall
>  
>  # Helper that honours V=1 so we get some output when compiling
>  quiet-@ = $(if $(V),,@$(if $1,printf "  %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))
diff mbox series

Patch

diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index 05a2a45c5c..52fc390376 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -41,9 +41,10 @@  SONAMES := $(addsuffix $(SO_SUFFIX),$(addprefix lib,$(NAMES)))
 
 # The main QEMU uses Glib extensively so it is perfectly fine to use it
 # in plugins (which many example do).
-PLUGIN_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
-PLUGIN_CFLAGS += -fPIC -Wall
+GLIB_CFLAGS := $(shell $(PKG_CONFIG) --cflags glib-2.0)
 PLUGIN_CFLAGS += -I$(TOP_SRC_PATH)/include/qemu
+PLUGIN_CFLAGS += $(GLIB_CFLAGS)
+PLUGIN_CFLAGS += -fPIC -Wall
 
 # Helper that honours V=1 so we get some output when compiling
 quiet-@ = $(if $(V),,@$(if $1,printf "  %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))