[Buildroot] [PATCH] package/qemu: fix Qemu stub builds

Subsystems: the rest

4 messages, 3 authors, 2025-01-09 · open the first message on its own page

[Buildroot] [PATCH] package/qemu: fix Qemu stub builds

From: Romain Naour via buildroot <hidden>
Date: 2025-01-07 21:09:35

Since commit "stubs: avoid duplicate symbols in libqemuutil.a" [1],
Qemu doesn't build with:

  ./configure --enable-user --disable-system --enable-tools

  /usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function 'device_finalize':
  [...]output/build/host-qemu-9.2.0/build/../hw/core/qdev.c:689:(.text+0x75c): undefined reference to 'qapi_event_send_device_deleted'
  collect2: error: ld returned 1 exit status

Indeed, with have_system = false and have_tools = true, Qemu needs the
stubs for QAPI events added by stub_ss.add(files('qdev.c')) to provide
qapi_event_send_device_deleted().

Fixes: 388b849fb6c33882b481123568995a749a54f648.

[1] https://gitlab.com/qemu-project/qemu/-/commit/388b849fb6c33882b481123568995a749a54f648

Reported: https://gitlab.com/qemu-project/qemu/-/issues/2766

Fixes:
http://autobuild.buildroot.org/results/260/2608b7cfcedc21269f08063493fe66c0381357f9

Signed-off-by: Romain Naour <redacted>
---

With commit reverted (duplicate symbols in libqemuutil.a):
nm -an test/random/build/host-qemu-9.2.0/build/libqemuutil.a | grep qapi_event_send_device_deleted
0000000000000030 T qapi_event_send_device_deleted
0000000000000000 T qapi_event_send_device_deleted

With patch 0002-stubs-only-build-stubs-for-QAPI-events-when-needed.patch:

With Qemu system enabled (non stub qapi_event_send_device_deleted()):
nm -an test/random/build/host-qemu-9.2.0/build/libqemuutil.a | grep qapi_event_send_device_deleted
0000000000000030 T qapi_event_send_device_deleted

With Qemu system disabled (stub qapi_event_send_device_deleted()):
nm -an test/random/build/host-qemu-9.2.0/build/libqemuutil.a | grep qapi_event_send_device_deleted
0000000000000000 T qapi_event_send_device_deleted
---
 ...ld-stubs-for-QAPI-events-when-needed.patch | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/qemu/0002-stubs-only-build-stubs-for-QAPI-events-when-needed.patch
diff --git a/package/qemu/0002-stubs-only-build-stubs-for-QAPI-events-when-needed.patch b/package/qemu/0002-stubs-only-build-stubs-for-QAPI-events-when-needed.patch
new file mode 100644
index 0000000000..e31eb11909
--- /dev/null
+++ b/package/qemu/0002-stubs-only-build-stubs-for-QAPI-events-when-needed.patch
@@ -0,0 +1,45 @@
+From ffd5e7cbc0cf2d1c0984bb453cc9e125c7259436 Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@smile.fr>
+Date: Tue, 7 Jan 2025 21:52:51 +0100
+Subject: [PATCH] stubs: only build stubs for QAPI events when needed
+
+Since commit "stubs: avoid duplicate symbols in libqemuutil.a" [1],
+Qemu doesn't build with:
+
+  ./configure --enable-user --disable-system --enable-tools
+
+  /usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function 'device_finalize':
+  [...]output/build/host-qemu-9.2.0/build/../hw/core/qdev.c:689:(.text+0x75c): undefined reference to 'qapi_event_send_device_deleted'
+  collect2: error: ld returned 1 exit status
+
+Indeed, with have_system = false and have_tools = true, Qemu needs the
+stubs for QAPI events added by stub_ss.add(files('qdev.c')) to provide
+qapi_event_send_device_deleted().
+
+Fixes: 388b849fb6c33882b481123568995a749a54f648.
+
+[1] https://gitlab.com/qemu-project/qemu/-/commit/388b849fb6c33882b481123568995a749a54f648
+
+Upstream: https://gitlab.com/qemu-project/qemu/-/issues/2766
+
+Signed-off-by: Romain Naour <romain.naour@smile.fr>
+---
+ stubs/meson.build | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/stubs/meson.build b/stubs/meson.build
+index e91614a874..838a8ca3e3 100644
+--- a/stubs/meson.build
++++ b/stubs/meson.build
+@@ -58,7 +58,7 @@ if have_user
+ 
+   # Stubs for QAPI events.  Those can always be included in the build, but
+   # they are not built at all for --disable-system --disable-tools builds.
+-  if not (have_system or have_tools)
++  if not have_system and have_tools
+     stub_ss.add(files('qdev.c'))
+   endif
+ endif
+-- 
+2.47.1
+
-- 
2.47.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

Re: [Buildroot] [PATCH] package/qemu: fix Qemu stub builds

From: Julien Olivain <hidden>
Date: 2025-01-07 21:51:34

On 07/01/2025 22:09, Romain Naour via buildroot wrote:
Since commit "stubs: avoid duplicate symbols in libqemuutil.a" [1],
Qemu doesn't build with:

  ./configure --enable-user --disable-system --enable-tools

  /usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function 'device_finalize':
  
[...]output/build/host-qemu-9.2.0/build/../hw/core/qdev.c:689:(.text+0x75c): undefined reference to 'qapi_event_send_device_deleted'
  collect2: error: ld returned 1 exit status

Indeed, with have_system = false and have_tools = true, Qemu needs the
stubs for QAPI events added by stub_ss.add(files('qdev.c')) to provide
qapi_event_send_device_deleted().

Fixes: 388b849fb6c33882b481123568995a749a54f648.

[1] https://gitlab.com/qemu-project/qemu/-/commit/388b849fb6c33882b481123568995a749a54f648

Reported: https://gitlab.com/qemu-project/qemu/-/issues/2766

Fixes:
http://autobuild.buildroot.org/results/260/2608b7cfcedc21269f08063493fe66c0381357f9

Signed-off-by: Romain Naour <redacted>
Applied to master, thanks.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

Re: [Buildroot] [PATCH] package/qemu: fix Qemu stub builds

From: Peter Korsgaard <peter@korsgaard.com>
Date: 2025-01-09 09:21:51

On 1/7/25 22:51, Julien Olivain wrote:
On 07/01/2025 22:09, Romain Naour via buildroot wrote:
quoted
Since commit "stubs: avoid duplicate symbols in libqemuutil.a" [1],
Qemu doesn't build with:

  ./configure --enable-user --disable-system --enable-tools

  /usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function 'device_finalize':
[...]output/build/host-qemu-9.2.0/build/../hw/core/qdev.c:689: (.text+0x75c): undefined reference to 'qapi_event_send_device_deleted'
  collect2: error: ld returned 1 exit status

Indeed, with have_system = false and have_tools = true, Qemu needs the
stubs for QAPI events added by stub_ss.add(files('qdev.c')) to provide
qapi_event_send_device_deleted().

Fixes: 388b849fb6c33882b481123568995a749a54f648.
FYI, this should have been edfc67fb1a5f0fe67ba9de91e90b06a44902c231 ("package/qemu: bump to version 9.2.0")

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

Re: [Buildroot] [PATCH] package/qemu: fix Qemu stub builds

From: Romain Naour via buildroot <hidden>
Date: 2025-01-09 10:50:59

Hello Peter, All,

Le 09/01/2025 à 10:21, Peter Korsgaard a écrit :
On 1/7/25 22:51, Julien Olivain wrote:
quoted
On 07/01/2025 22:09, Romain Naour via buildroot wrote:
quoted
Since commit "stubs: avoid duplicate symbols in libqemuutil.a" [1],
Qemu doesn't build with:

  ./configure --enable-user --disable-system --enable-tools

  /usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function 'device_finalize':
[...]output/build/host-qemu-9.2.0/build/../hw/core/qdev.c:689: (.text+0x75c):
undefined reference to 'qapi_event_send_device_deleted'
  collect2: error: ld returned 1 exit status

Indeed, with have_system = false and have_tools = true, Qemu needs the
stubs for QAPI events added by stub_ss.add(files('qdev.c')) to provide
qapi_event_send_device_deleted().

Fixes: 388b849fb6c33882b481123568995a749a54f648.
FYI, this should have been edfc67fb1a5f0fe67ba9de91e90b06a44902c231 ("package/
qemu: bump to version 9.2.0")
Indeed, this is actually the git hash in the Qemu repo...

My bad.

Best regards,
Romain

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help