[PATCH v2] qga-win: choose the right libpcre version to include in MSI package

Andrey Drobyshev via posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20221213151343.90235-1-andrey.drobyshev@virtuozzo.com
Maintainers: Konstantin Kostiuk <kkostiuk@redhat.com>, Michael Roth <michael.roth@amd.com>
qga/installer/qemu-ga.wxs | 12 +++++++++---
qga/meson.build           |  6 ++++++
2 files changed, 15 insertions(+), 3 deletions(-)
[PATCH v2] qga-win: choose the right libpcre version to include in MSI package
Posted by Andrey Drobyshev via 1 year, 4 months ago
According to GLib changelog [1], since version 2.73.2 GLib is using
libpcre2 instead of libpcre.  As a result, qemu-ga MSI installation
fails due to missing DLL when linked with the newer GLib.

This commit makes wixl to put the right libpcre version into the MSI
bundle: either libpcre-1.dll or libpcre2-8-0.dll, depending on the
present version of GLib.

[1] https://gitlab.gnome.org/GNOME/glib/-/releases#2.73.2

Previous version:
https://lists.nongnu.org/archive/html/qemu-trivial/2022-11/msg00237.html

Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
---
 qga/installer/qemu-ga.wxs | 12 +++++++++---
 qga/meson.build           |  6 ++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs
index e344c38e74..9f0bacae81 100644
--- a/qga/installer/qemu-ga.wxs
+++ b/qga/installer/qemu-ga.wxs
@@ -101,9 +101,15 @@
           <Component Id="libwinpthread" Guid="{6C117C78-0F47-4B07-8F34-6BEE11643829}">
             <File Id="libwinpthread_1.dll" Name="libwinpthread-1.dll" Source="$(var.BIN_DIR)/libwinpthread-1.dll" KeyPath="yes" DiskId="1"/>
           </Component>
-          <Component Id="libpcre" Guid="{7A86B45E-A009-489A-A849-CE3BACF03CD0}">
-            <File Id="libpcre_1.dll" Name="libpcre-1.dll" Source="$(var.BIN_DIR)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
-          </Component>
+          <?if $(var.LIBPCRE) = "libpcre1"?>
+            <Component Id="libpcre" Guid="{7A86B45E-A009-489A-A849-CE3BACF03CD0}">
+              <File Id="libpcre_1.dll" Name="libpcre-1.dll" Source="$(var.BIN_DIR)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
+            </Component>
+          <?else?>
+            <Component Id="libpcre" Guid="{F92A3804-B59C-419D-8F29-99A30352C156}">
+              <File Id="libpcre2_8_0.dll" Name="libpcre2-8-0.dll" Source="$(var.BIN_DIR)/libpcre2-8-0.dll" KeyPath="yes" DiskId="1"/>
+            </Component>
+          <?endif?>
           <Component Id="registry_entries" Guid="{D075D109-51CA-11E3-9F8B-000C29858960}">
             <RegistryKey Root="HKLM"
                          Key="Software\$(var.QEMU_GA_MANUFACTURER)\$(var.QEMU_GA_DISTRO)\Tools\QemuGA">
diff --git a/qga/meson.build b/qga/meson.build
index 1ff159edc1..ad17dc7dca 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -140,6 +140,11 @@ if targetos == 'windows'
       qemu_ga_msi_vss = ['-D', 'InstallVss']
       deps += qga_vss
     endif
+    if glib.version() < '2.73.2'
+      libpcre = 'libpcre1'
+    else
+      libpcre = 'libpcre2'
+    endif
     qga_msi = custom_target('QGA MSI',
                             input: files('installer/qemu-ga.wxs'),
                             output: 'qemu-ga-@0@.msi'.format(host_arch),
@@ -153,6 +158,7 @@ if targetos == 'windows'
                               '-D', 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
                               '-D', 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
                               '-D', 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
+                              '-D', 'LIBPCRE=' + libpcre,
                             ])
     all_qga += [qga_msi]
     alias_target('msi', qga_msi)
-- 
2.34.3
Re: [PATCH v2] qga-win: choose the right libpcre version to include in MSI package
Posted by Konstantin Kostiuk 1 year, 4 months ago
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
Tested-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Tue, Dec 13, 2022 at 5:13 PM Andrey Drobyshev <
andrey.drobyshev@virtuozzo.com> wrote:

> According to GLib changelog [1], since version 2.73.2 GLib is using
> libpcre2 instead of libpcre.  As a result, qemu-ga MSI installation
> fails due to missing DLL when linked with the newer GLib.
>
> This commit makes wixl to put the right libpcre version into the MSI
> bundle: either libpcre-1.dll or libpcre2-8-0.dll, depending on the
> present version of GLib.
>
> [1] https://gitlab.gnome.org/GNOME/glib/-/releases#2.73.2
>
> Previous version:
> https://lists.nongnu.org/archive/html/qemu-trivial/2022-11/msg00237.html
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
> ---
>  qga/installer/qemu-ga.wxs | 12 +++++++++---
>  qga/meson.build           |  6 ++++++
>  2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs
> index e344c38e74..9f0bacae81 100644
> --- a/qga/installer/qemu-ga.wxs
> +++ b/qga/installer/qemu-ga.wxs
> @@ -101,9 +101,15 @@
>            <Component Id="libwinpthread"
> Guid="{6C117C78-0F47-4B07-8F34-6BEE11643829}">
>              <File Id="libwinpthread_1.dll" Name="libwinpthread-1.dll"
> Source="$(var.BIN_DIR)/libwinpthread-1.dll" KeyPath="yes" DiskId="1"/>
>            </Component>
> -          <Component Id="libpcre"
> Guid="{7A86B45E-A009-489A-A849-CE3BACF03CD0}">
> -            <File Id="libpcre_1.dll" Name="libpcre-1.dll"
> Source="$(var.BIN_DIR)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
> -          </Component>
> +          <?if $(var.LIBPCRE) = "libpcre1"?>
> +            <Component Id="libpcre"
> Guid="{7A86B45E-A009-489A-A849-CE3BACF03CD0}">
> +              <File Id="libpcre_1.dll" Name="libpcre-1.dll"
> Source="$(var.BIN_DIR)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
> +            </Component>
> +          <?else?>
> +            <Component Id="libpcre"
> Guid="{F92A3804-B59C-419D-8F29-99A30352C156}">
> +              <File Id="libpcre2_8_0.dll" Name="libpcre2-8-0.dll"
> Source="$(var.BIN_DIR)/libpcre2-8-0.dll" KeyPath="yes" DiskId="1"/>
> +            </Component>
> +          <?endif?>
>            <Component Id="registry_entries"
> Guid="{D075D109-51CA-11E3-9F8B-000C29858960}">
>              <RegistryKey Root="HKLM"
>
> Key="Software\$(var.QEMU_GA_MANUFACTURER)\$(var.QEMU_GA_DISTRO)\Tools\QemuGA">
> diff --git a/qga/meson.build b/qga/meson.build
> index 1ff159edc1..ad17dc7dca 100644
> --- a/qga/meson.build
> +++ b/qga/meson.build
> @@ -140,6 +140,11 @@ if targetos == 'windows'
>        qemu_ga_msi_vss = ['-D', 'InstallVss']
>        deps += qga_vss
>      endif
> +    if glib.version() < '2.73.2'
> +      libpcre = 'libpcre1'
> +    else
> +      libpcre = 'libpcre2'
> +    endif
>      qga_msi = custom_target('QGA MSI',
>                              input: files('installer/qemu-ga.wxs'),
>                              output: 'qemu-ga-@0@.msi'.format(host_arch),
> @@ -153,6 +158,7 @@ if targetos == 'windows'
>                                '-D', 'QEMU_GA_VERSION=' +
> config_host['QEMU_GA_VERSION'],
>                                '-D', 'QEMU_GA_MANUFACTURER=' +
> config_host['QEMU_GA_MANUFACTURER'],
>                                '-D', 'QEMU_GA_DISTRO=' +
> config_host['QEMU_GA_DISTRO'],
> +                              '-D', 'LIBPCRE=' + libpcre,
>                              ])
>      all_qga += [qga_msi]
>      alias_target('msi', qga_msi)
> --
> 2.34.3
>
>
Re: [PATCH v2] qga-win: choose the right libpcre version to include in MSI package
Posted by Konstantin Kostiuk 1 year, 4 months ago
the series was merged

Best Regards,
Konstantin Kostiuk.


On Tue, Dec 13, 2022 at 9:20 PM Konstantin Kostiuk <kkostiuk@redhat.com>
wrote:

> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>
> Tested-by: Konstantin Kostiuk <kkostiuk@redhat.com>
>
> On Tue, Dec 13, 2022 at 5:13 PM Andrey Drobyshev <
> andrey.drobyshev@virtuozzo.com> wrote:
>
>> According to GLib changelog [1], since version 2.73.2 GLib is using
>> libpcre2 instead of libpcre.  As a result, qemu-ga MSI installation
>> fails due to missing DLL when linked with the newer GLib.
>>
>> This commit makes wixl to put the right libpcre version into the MSI
>> bundle: either libpcre-1.dll or libpcre2-8-0.dll, depending on the
>> present version of GLib.
>>
>> [1] https://gitlab.gnome.org/GNOME/glib/-/releases#2.73.2
>>
>> Previous version:
>> https://lists.nongnu.org/archive/html/qemu-trivial/2022-11/msg00237.html
>>
>> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
>> ---
>>  qga/installer/qemu-ga.wxs | 12 +++++++++---
>>  qga/meson.build           |  6 ++++++
>>  2 files changed, 15 insertions(+), 3 deletions(-)
>>
>> diff --git a/qga/installer/qemu-ga.wxs b/qga/installer/qemu-ga.wxs
>> index e344c38e74..9f0bacae81 100644
>> --- a/qga/installer/qemu-ga.wxs
>> +++ b/qga/installer/qemu-ga.wxs
>> @@ -101,9 +101,15 @@
>>            <Component Id="libwinpthread"
>> Guid="{6C117C78-0F47-4B07-8F34-6BEE11643829}">
>>              <File Id="libwinpthread_1.dll" Name="libwinpthread-1.dll"
>> Source="$(var.BIN_DIR)/libwinpthread-1.dll" KeyPath="yes" DiskId="1"/>
>>            </Component>
>> -          <Component Id="libpcre"
>> Guid="{7A86B45E-A009-489A-A849-CE3BACF03CD0}">
>> -            <File Id="libpcre_1.dll" Name="libpcre-1.dll"
>> Source="$(var.BIN_DIR)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
>> -          </Component>
>> +          <?if $(var.LIBPCRE) = "libpcre1"?>
>> +            <Component Id="libpcre"
>> Guid="{7A86B45E-A009-489A-A849-CE3BACF03CD0}">
>> +              <File Id="libpcre_1.dll" Name="libpcre-1.dll"
>> Source="$(var.BIN_DIR)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
>> +            </Component>
>> +          <?else?>
>> +            <Component Id="libpcre"
>> Guid="{F92A3804-B59C-419D-8F29-99A30352C156}">
>> +              <File Id="libpcre2_8_0.dll" Name="libpcre2-8-0.dll"
>> Source="$(var.BIN_DIR)/libpcre2-8-0.dll" KeyPath="yes" DiskId="1"/>
>> +            </Component>
>> +          <?endif?>
>>            <Component Id="registry_entries"
>> Guid="{D075D109-51CA-11E3-9F8B-000C29858960}">
>>              <RegistryKey Root="HKLM"
>>
>> Key="Software\$(var.QEMU_GA_MANUFACTURER)\$(var.QEMU_GA_DISTRO)\Tools\QemuGA">
>> diff --git a/qga/meson.build b/qga/meson.build
>> index 1ff159edc1..ad17dc7dca 100644
>> --- a/qga/meson.build
>> +++ b/qga/meson.build
>> @@ -140,6 +140,11 @@ if targetos == 'windows'
>>        qemu_ga_msi_vss = ['-D', 'InstallVss']
>>        deps += qga_vss
>>      endif
>> +    if glib.version() < '2.73.2'
>> +      libpcre = 'libpcre1'
>> +    else
>> +      libpcre = 'libpcre2'
>> +    endif
>>      qga_msi = custom_target('QGA MSI',
>>                              input: files('installer/qemu-ga.wxs'),
>>                              output: 'qemu-ga-@0@.msi'.format(host_arch),
>> @@ -153,6 +158,7 @@ if targetos == 'windows'
>>                                '-D', 'QEMU_GA_VERSION=' +
>> config_host['QEMU_GA_VERSION'],
>>                                '-D', 'QEMU_GA_MANUFACTURER=' +
>> config_host['QEMU_GA_MANUFACTURER'],
>>                                '-D', 'QEMU_GA_DISTRO=' +
>> config_host['QEMU_GA_DISTRO'],
>> +                              '-D', 'LIBPCRE=' + libpcre,
>>                              ])
>>      all_qga += [qga_msi]
>>      alias_target('msi', qga_msi)
>> --
>> 2.34.3
>>
>>