Skip to contentSkip to conversation

plugins: fix win plugin tests on cross compile

PATCH Superseded Greg Manning 2 participants 4 messages Nov 9, 2023 Arm/Amlogic Meson SoC support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover plugins: fix win plugin tests on cross compile

v1-v2: Added the signed-off-by line.

Greg Manning (1):
plugins: fix win plugin tests on cross compile

 .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(-)
Signature · 1 line
2.42.0.windows.1
#1 lore raw

PATCH v2 1/1 plugins: fix win plugin tests on cross compile

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(-)
.gitlab-ci.d/crossbuilds.yml +1 -1
index ac71a2abd3..56dd603a86 100644
@@ -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:
contrib/plugins/Makefile +1 -1
index 1783750cf6..0b64d2c1e3 100644
@@ -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
plugins/meson.build +1 -1
index 40d24529c0..6b2d7a9292 100644
@@ -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']
     )
tests/plugin/meson.build +2 -1
index 528bb9d86c..28a929dbcc 100644
@@ -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
Signature · 1 line
2.42.0.windows.1
#2 lore raw

tests/plugin/meson.build if get_option('plugins') · line 9

Quoted 6 lines · Greg Manning
       t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
                         include_directories: '../../include/qemu',
tests/plugin/meson.build +2 -1
-                        objects: [win32_qemu_plugin_api_lib],
+                        link_depends: [win32_qemu_plugin_api_lib],
+                        link_args: ['-Lplugins', '-lqemu_plugin_api'],
                         dependencies: glib)

Does it work if you use win32_qemu_plugin_api_lib.full_path() for the link_args? (If so it can be fixed when applying).

Paolo

#3 lore raw
Quoted 10 lines · Greg Manning

tests/plugin/meson.build if get_option('plugins') · line 9

Quoted 6 lines
       t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
                         include_directories: '../../include/qemu',
tests/plugin/meson.build +2 -1
-                        objects: [win32_qemu_plugin_api_lib],
+                        link_depends: [win32_qemu_plugin_api_lib],
+                        link_args: ['-Lplugins', '-lqemu_plugin_api'],
                         dependencies: glib)

Does it work if you use win32_qemu_plugin_api_lib.full_path() for the link_args? (If so it can be fixed when applying).

full_path() doesn't exist on the return type of configure_file.

I've had a play around and not found a better method that works. Have tried various combinations of custom_target vs configure_file, declare_dependency and cc.find_library(), but can't get it to:
* work from unbuilt
* add the file to the installer
* typecheck

all at the same time. Possibly related is: https://github.com/mesonbuild/meson/issues/5093

Greg.