diff mbox series

ui: compile dbus-display1.c with -fPIC as necessary

Message ID 20240319092927.1872777-1-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series ui: compile dbus-display1.c with -fPIC as necessary | expand

Commit Message

Marc-André Lureau March 19, 2024, 9:29 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Building dbus-display1.c explicitly as a static library drops -fPIC by
default, which may not be correct if it ends up linked to a shared
library.

Let the target decide how to build the unit, with or without -fPIC. This
makes commit 186acfbaf7 ("tests/qtest: Depend on dbus_display1_dep") no
longer relevant, as dbus-display1.c will be recompiled.

Fixes: c172136ea33 ("meson: ensure dbus-display generated code is built
before other units")

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/meson.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Michael Tokarev March 19, 2024, 1:26 p.m. UTC | #1
19.03.2024 12:29, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Building dbus-display1.c explicitly as a static library drops -fPIC by
> default, which may not be correct if it ends up linked to a shared
> library.
> 
> Let the target decide how to build the unit, with or without -fPIC. This
> makes commit 186acfbaf7 ("tests/qtest: Depend on dbus_display1_dep") no
> longer relevant, as dbus-display1.c will be recompiled.
> 
> Fixes: c172136ea33 ("meson: ensure dbus-display generated code is built
> before other units")

Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>

And yes, this fixes the reported issue, thank you!

This change can be picked up for master as a bugfix (it should be in 9.0).

/mjt

> Reported-by: Olaf Hering <olaf@aepfle.de>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   ui/meson.build | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/ui/meson.build b/ui/meson.build
> index 0b7e2b6f6b..a5ce22a678 100644
> --- a/ui/meson.build
> +++ b/ui/meson.build
> @@ -90,8 +90,7 @@ if dbus_display
>                                             '--interface-prefix', 'org.qemu.',
>                                             '--c-namespace', 'QemuDBus',
>                                             '--generate-c-code', '@BASENAME@'])
> -  dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
> -  dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, sources: dbus_display1[0])
> +  dbus_display1_dep = declare_dependency(sources: dbus_display1, dependencies: gio)
>     dbus_ss.add(when: [gio, dbus_display1_dep],
>                 if_true: [files(
>                   'dbus-chardev.c',
diff mbox series

Patch

diff --git a/ui/meson.build b/ui/meson.build
index 0b7e2b6f6b..a5ce22a678 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -90,8 +90,7 @@  if dbus_display
                                           '--interface-prefix', 'org.qemu.',
                                           '--c-namespace', 'QemuDBus',
                                           '--generate-c-code', '@BASENAME@'])
-  dbus_display1_lib = static_library('dbus-display1', dbus_display1, dependencies: gio)
-  dbus_display1_dep = declare_dependency(link_with: dbus_display1_lib, sources: dbus_display1[0])
+  dbus_display1_dep = declare_dependency(sources: dbus_display1, dependencies: gio)
   dbus_ss.add(when: [gio, dbus_display1_dep],
               if_true: [files(
                 'dbus-chardev.c',