[PATCH] plugins: fix win plugin tests on cross compile

Greg Manning posted 1 patch 1 year ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231109091337.415-1-gmanning@rapitasystems.com
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>
There is a newer version of this series
.gitlab-ci.d/crossbuilds.yml | 2 +-
contrib/plugins/Makefile     | 2 +-
plugins/meson.build          | 2 +-
tests/plugin/meson.build     | 3 ++-
4 files changed, 5 insertions(+), 4 deletions(-)
[PATCH] plugins: fix win plugin tests on cross compile
Posted by Greg Manning 1 year ago
fixes #1927.

Cross compile gcc is more picky about argument order than msys. Changed
the meson command to take the (now renamed) libqemu_plugin_api.a as a
lib, rather than an object. This puts it in the right place on both
native and cross compile gcc commands

Reenable plugins on crossbuilds
---
 .gitlab-ci.d/crossbuilds.yml | 2 +-
 contrib/plugins/Makefile     | 2 +-
 plugins/meson.build          | 2 +-
 tests/plugin/meson.build     | 3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index ac71a2abd3..56dd603a86 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -165,7 +165,7 @@ cross-win32-system:
     job: win32-fedora-cross-container
   variables:
     IMAGE: fedora-win32-cross
-    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal --disable-plugins
+    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal
     CROSS_SKIP_TARGETS: alpha-softmmu avr-softmmu hppa-softmmu m68k-softmmu
                         microblazeel-softmmu mips64el-softmmu nios2-softmmu
   artifacts:
diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index 1783750cf6..0b64d2c1e3 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -49,7 +49,7 @@ all: $(SONAMES)
 	$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
 
 ifeq ($(CONFIG_WIN32),y)
-lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/qemu_plugin_api.lib
+lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
 	$(CC) -shared -o $@ $^ $(LDLIBS)
 else ifeq ($(CONFIG_DARWIN),y)
 lib%$(SO_SUFFIX): %.o
diff --git a/plugins/meson.build b/plugins/meson.build
index 40d24529c0..6b2d7a9292 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -28,7 +28,7 @@ if get_option('plugins')
     # then use dlltool to assemble a delaylib.
     win32_qemu_plugin_api_lib = configure_file(
       input: win32_plugin_def,
-      output: 'qemu_plugin_api.lib',
+      output: 'libqemu_plugin_api.a',
       command: [dlltool, '--input-def', '@INPUT@',
                 '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
     )
diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build
index 528bb9d86c..28a929dbcc 100644
--- a/tests/plugin/meson.build
+++ b/tests/plugin/meson.build
@@ -4,7 +4,8 @@ if get_option('plugins')
     if targetos == 'windows'
       t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
                         include_directories: '../../include/qemu',
-                        objects: [win32_qemu_plugin_api_lib],
+                        link_depends: [win32_qemu_plugin_api_lib],
+                        link_args: ['-Lplugins', '-lqemu_plugin_api'],
                         dependencies: glib)
 
     else
-- 
2.42.0.windows.1
Re: [PATCH] plugins: fix win plugin tests on cross compile
Posted by Philippe Mathieu-Daudé 1 year ago
Hi Greg,

On 9/11/23 10:13, Greg Manning wrote:
> fixes #1927.

Does this match the GitLab pattern? See
https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#default-closing-pattern

We usually write:
"Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1927"

So there is no confusion between forked repositories, or when
commits are cherry-picked by stable distributions.

Are you sure this is #1927 "SPARC64 pci-bridge kernel panic"?

> Cross compile gcc is more picky about argument order than msys. Changed
> the meson command to take the (now renamed) libqemu_plugin_api.a as a
> lib, rather than an object. This puts it in the right place on both
> native and cross compile gcc commands
>
> Reenable plugins on crossbuilds

Missing your Signed-off-by tag, see:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line

Otherwise LGTM, thanks for working on this issue!

Phil.


> ---
>   .gitlab-ci.d/crossbuilds.yml | 2 +-
>   contrib/plugins/Makefile     | 2 +-
>   plugins/meson.build          | 2 +-
>   tests/plugin/meson.build     | 3 ++-
>   4 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
> index ac71a2abd3..56dd603a86 100644
> --- a/.gitlab-ci.d/crossbuilds.yml
> +++ b/.gitlab-ci.d/crossbuilds.yml
> @@ -165,7 +165,7 @@ cross-win32-system:
>       job: win32-fedora-cross-container
>     variables:
>       IMAGE: fedora-win32-cross
> -    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal --disable-plugins
> +    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal
>       CROSS_SKIP_TARGETS: alpha-softmmu avr-softmmu hppa-softmmu m68k-softmmu
>                           microblazeel-softmmu mips64el-softmmu nios2-softmmu
>     artifacts:
> diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
> index 1783750cf6..0b64d2c1e3 100644
> --- a/contrib/plugins/Makefile
> +++ b/contrib/plugins/Makefile
> @@ -49,7 +49,7 @@ all: $(SONAMES)
>       $(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
>
>   ifeq ($(CONFIG_WIN32),y)
> -lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/qemu_plugin_api.lib
> +lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
>       $(CC) -shared -o $@ $^ $(LDLIBS)
>   else ifeq ($(CONFIG_DARWIN),y)
>   lib%$(SO_SUFFIX): %.o
> diff --git a/plugins/meson.build b/plugins/meson.build
> index 40d24529c0..6b2d7a9292 100644
> --- a/plugins/meson.build
> +++ b/plugins/meson.build
> @@ -28,7 +28,7 @@ if get_option('plugins')
>       # then use dlltool to assemble a delaylib.
>       win32_qemu_plugin_api_lib = configure_file(
>         input: win32_plugin_def,
> -      output: 'qemu_plugin_api.lib',
> +      output: 'libqemu_plugin_api.a',
>         command: [dlltool, '--input-def', '@INPUT@',
>                   '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
>       )
> diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build
> index 528bb9d86c..28a929dbcc 100644
> --- a/tests/plugin/meson.build
> +++ b/tests/plugin/meson.build
> @@ -4,7 +4,8 @@ if get_option('plugins')
>       if targetos == 'windows'
>         t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
>                           include_directories: '../../include/qemu',
> -                        objects: [win32_qemu_plugin_api_lib],
> +                        link_depends: [win32_qemu_plugin_api_lib],
> +                        link_args: ['-Lplugins', '-lqemu_plugin_api'],
>                           dependencies: glib)
>
>       else
Re: [PATCH] plugins: fix win plugin tests on cross compile
Posted by Philippe Mathieu-Daudé 1 year ago
Hi Greg,

On 9/11/23 10:13, Greg Manning wrote:
> fixes #1927.

Does this match GitLab pattern? See
https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#default-closing-pattern

We usually write:
"Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1927"

So there is no confusion between forked repositories, or when
commits are cherry-picked by stable distributions.

Are you sure this is #1927 "SPARC64 pci-bridge kernel panic"?

> Cross compile gcc is more picky about argument order than msys. Changed
> the meson command to take the (now renamed) libqemu_plugin_api.a as a
> lib, rather than an object. This puts it in the right place on both
> native and cross compile gcc commands
> 
> Reenable plugins on crossbuilds

Missing your Signed-off-by tag, see:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#patch-emails-must-include-a-signed-off-by-line

Otherwise LGTM, thanks for working on this issue!

Phil.

> ---
>   .gitlab-ci.d/crossbuilds.yml | 2 +-
>   contrib/plugins/Makefile     | 2 +-
>   plugins/meson.build          | 2 +-
>   tests/plugin/meson.build     | 3 ++-
>   4 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
> index ac71a2abd3..56dd603a86 100644
> --- a/.gitlab-ci.d/crossbuilds.yml
> +++ b/.gitlab-ci.d/crossbuilds.yml
> @@ -165,7 +165,7 @@ cross-win32-system:
>       job: win32-fedora-cross-container
>     variables:
>       IMAGE: fedora-win32-cross
> -    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal --disable-plugins
> +    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal
>       CROSS_SKIP_TARGETS: alpha-softmmu avr-softmmu hppa-softmmu m68k-softmmu
>                           microblazeel-softmmu mips64el-softmmu nios2-softmmu
>     artifacts:
> diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
> index 1783750cf6..0b64d2c1e3 100644
> --- a/contrib/plugins/Makefile
> +++ b/contrib/plugins/Makefile
> @@ -49,7 +49,7 @@ all: $(SONAMES)
>   	$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
>   
>   ifeq ($(CONFIG_WIN32),y)
> -lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/qemu_plugin_api.lib
> +lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
>   	$(CC) -shared -o $@ $^ $(LDLIBS)
>   else ifeq ($(CONFIG_DARWIN),y)
>   lib%$(SO_SUFFIX): %.o
> diff --git a/plugins/meson.build b/plugins/meson.build
> index 40d24529c0..6b2d7a9292 100644
> --- a/plugins/meson.build
> +++ b/plugins/meson.build
> @@ -28,7 +28,7 @@ if get_option('plugins')
>       # then use dlltool to assemble a delaylib.
>       win32_qemu_plugin_api_lib = configure_file(
>         input: win32_plugin_def,
> -      output: 'qemu_plugin_api.lib',
> +      output: 'libqemu_plugin_api.a',
>         command: [dlltool, '--input-def', '@INPUT@',
>                   '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
>       )
> diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build
> index 528bb9d86c..28a929dbcc 100644
> --- a/tests/plugin/meson.build
> +++ b/tests/plugin/meson.build
> @@ -4,7 +4,8 @@ if get_option('plugins')
>       if targetos == 'windows'
>         t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
>                           include_directories: '../../include/qemu',
> -                        objects: [win32_qemu_plugin_api_lib],
> +                        link_depends: [win32_qemu_plugin_api_lib],
> +                        link_args: ['-Lplugins', '-lqemu_plugin_api'],
>                           dependencies: glib)
>   
>       else