mbox series

[00/12] Enable building plugins on Windows with Clang

Message ID 20241031040426.772604-1-pierrick.bouvier@linaro.org (mailing list archive)
Headers show
Series Enable building plugins on Windows with Clang | expand

Message

Pierrick Bouvier Oct. 31, 2024, 4:04 a.m. UTC
For now, it was only possible to build plugins using GCC on Windows. However,
windows-aarch64 only supports Clang.

The first patches (already posted and normally pulled) are fixes and
prerequisite to build plugins with meson. They are integrated here because it's
not possible to have two based-on in the cover letter.

Then, we fix compilation warnings on Windows.
After that, we can enable linking with Clang on Windows.

Finally, we enhanced the plugin symbols export list (automatically generated,
and not a static file), and we report some of the information we discovered on
the path in the documentation.

Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64
hosts.

Pierrick Bouvier (12):
  scripts: remove erroneous file that breaks git clone on Windows
  contrib/plugins/cflow: fix warning
  meson: build contrib/plugins with meson
  contrib/plugins: remove Makefile for contrib/plugins
  qga: fix -Wsometimes-uninitialized windows warning
  qga: fix missing static and prototypes windows warnings
  win32: use compiler option instead of attribute gcc_struct
  plugins: enable linking with clang/lld
  plugins: add missing export for qemu_plugin_num_vcpus
  plugins: detect qemu plugin API symbols from header
  plugins: eradicate qemu-plugins.symbols static file
  docs: add information on how to setup build environments

 MAINTAINERS                               |   1 +
 docs/about/build-platforms.rst            |   4 +-
 docs/devel/build-system.rst               | 100 ++++++++++++++++++++++
 configure                                 |  18 ----
 Makefile                                  |  10 ---
 meson.build                               |  14 ++-
 include/qemu/compiler.h                   |   7 +-
 include/qemu/qemu-plugin.h                |   1 +
 subprojects/libvhost-user/libvhost-user.h |   6 +-
 contrib/plugins/cflow.c                   |   6 +-
 qga/commands-windows-ssh.c                |   2 +-
 contrib/plugins/Makefile                  |  87 -------------------
 contrib/plugins/meson.build               |  28 ++++++
 plugins/meson.build                       |  36 ++++++--
 plugins/qemu-plugins.symbols              |  59 -------------
 qga/vss-win32/install.cpp                 |   6 +-
 qga/vss-win32/provider.cpp                |   5 +-
 qga/vss-win32/requester.cpp               |   8 +-
 scripts/meson-buildoptions.               |   0
 scripts/qemu-plugin-symbols.py            |  45 ++++++++++
 tests/tcg/plugins/meson.build             |   3 +-
 21 files changed, 238 insertions(+), 208 deletions(-)
 delete mode 100644 contrib/plugins/Makefile
 create mode 100644 contrib/plugins/meson.build
 delete mode 100644 plugins/qemu-plugins.symbols
 delete mode 100644 scripts/meson-buildoptions.
 create mode 100755 scripts/qemu-plugin-symbols.py

Comments

Pierrick Bouvier Nov. 6, 2024, 5:13 p.m. UTC | #1
On 10/30/24 21:04, Pierrick Bouvier wrote:
> For now, it was only possible to build plugins using GCC on Windows. However,
> windows-aarch64 only supports Clang.
> 
> The first patches (already posted and normally pulled) are fixes and
> prerequisite to build plugins with meson. They are integrated here because it's
> not possible to have two based-on in the cover letter.
> 
> Then, we fix compilation warnings on Windows.
> After that, we can enable linking with Clang on Windows.
> 
> Finally, we enhanced the plugin symbols export list (automatically generated,
> and not a static file), and we report some of the information we discovered on
> the path in the documentation.
> 
> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64
> hosts.
> 
> Pierrick Bouvier (12):
>    scripts: remove erroneous file that breaks git clone on Windows
>    contrib/plugins/cflow: fix warning
>    meson: build contrib/plugins with meson
>    contrib/plugins: remove Makefile for contrib/plugins
>    qga: fix -Wsometimes-uninitialized windows warning
>    qga: fix missing static and prototypes windows warnings
>    win32: use compiler option instead of attribute gcc_struct
>    plugins: enable linking with clang/lld
>    plugins: add missing export for qemu_plugin_num_vcpus
>    plugins: detect qemu plugin API symbols from header
>    plugins: eradicate qemu-plugins.symbols static file
>    docs: add information on how to setup build environments
> 
>   MAINTAINERS                               |   1 +
>   docs/about/build-platforms.rst            |   4 +-
>   docs/devel/build-system.rst               | 100 ++++++++++++++++++++++
>   configure                                 |  18 ----
>   Makefile                                  |  10 ---
>   meson.build                               |  14 ++-
>   include/qemu/compiler.h                   |   7 +-
>   include/qemu/qemu-plugin.h                |   1 +
>   subprojects/libvhost-user/libvhost-user.h |   6 +-
>   contrib/plugins/cflow.c                   |   6 +-
>   qga/commands-windows-ssh.c                |   2 +-
>   contrib/plugins/Makefile                  |  87 -------------------
>   contrib/plugins/meson.build               |  28 ++++++
>   plugins/meson.build                       |  36 ++++++--
>   plugins/qemu-plugins.symbols              |  59 -------------
>   qga/vss-win32/install.cpp                 |   6 +-
>   qga/vss-win32/provider.cpp                |   5 +-
>   qga/vss-win32/requester.cpp               |   8 +-
>   scripts/meson-buildoptions.               |   0
>   scripts/qemu-plugin-symbols.py            |  45 ++++++++++
>   tests/tcg/plugins/meson.build             |   3 +-
>   21 files changed, 238 insertions(+), 208 deletions(-)
>   delete mode 100644 contrib/plugins/Makefile
>   create mode 100644 contrib/plugins/meson.build
>   delete mode 100644 plugins/qemu-plugins.symbols
>   delete mode 100644 scripts/meson-buildoptions.
>   create mode 100755 scripts/qemu-plugin-symbols.py
> 

I won't make a v2 of this series, as the build with clang is currently 
impossible, due to use of gcc_struct attribute. Maintainers have a 
strong preference to wait for official support in clang.

Most of the interesting patches (build system, warning fix) have been 
pulled or will be though.