Skip to contentSkip to conversation

stub: Fix build failure with --enable-user --disable-system --enable-tools

PATCH Applied Zhao Liu 2 participants 2 messages Jan 21, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Zhao Liu

author
#0 lore raw

PATCH 1/1 stub: Fix build failure with --enable-user --disable-system --enable-tools

Configuring "--enable-user --disable-system --enable-tools" causes the build failure with the following information:

/usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function `device_finalize':
/qemu/build/../hw/core/qdev.c:688: undefined reference to `qapi_event_send_device_deleted'
collect2: error: ld returned 1 exit status

To fix the above issue, add qdev.c stub when build with have_tools.

With this fix, QEMU could be successfully built in the following cases:
--enable-user --disable-system --enable-tools
--enable-user --disable-system --disable-tools --enable-user --disable-system

Fixes 388b849fb6c3 ("stubs: avoid duplicate symbols in libqemuutil.a")

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

---
 stubs/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
stubs/meson.build +2 -2
index e91614a874dc..a8b3aeb56450 100644
@@ -57,8 +57,8 @@ if have_user
   stub_ss.add(files('cpu-synchronize-state.c'))
 
   # 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)
+  # they are not built at all for --disable-system builds.
+  if not have_system
     stub_ss.add(files('qdev.c'))
   endif
 endif
Signature · 1 line
2.34.1
#1 lore raw
Quoted 27 lines · Zhao Liu

Configuring "--enable-user --disable-system --enable-tools" causes the build failure with the following information:

/usr/bin/ld: libhwcore.a.p/hw_core_qdev.c.o: in function `device_finalize':
/qemu/build/../hw/core/qdev.c:688: undefined reference to `qapi_event_send_device_deleted'
collect2: error: ld returned 1 exit status

To fix the above issue, add qdev.c stub when build with have_tools.

With this fix, QEMU could be successfully built in the following cases:
--enable-user --disable-system --enable-tools --enable-user --disable-system --disable-tools --enable-user --disable-system

Fixes 388b849fb6c3 ("stubs: avoid duplicate symbols in libqemuutil.a")

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

---
  stubs/meson.build | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
stubs/meson.build +0 -0
index e91614a874dc..a8b3aeb56450 100644

stubs/meson.build if have_user · line 63

Quoted 9 lines
stubs/meson.build +2 -2
@@ -57,8 +57,8 @@ if have_user
    stub_ss.add(files('cpu-synchronize-state.c'))
 
    # 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)
+  # they are not built at all for --disable-system builds.
+  if not have_system
      stub_ss.add(files('qdev.c'))
    endif

Matches

if have_system
qapi_all_modules += [

    'acpi',
    'audio',
    'cryptodev',
    'qdev',
    'pci',
    'rocker',
    'tpm',

]
endif

Queued, thanks.

Paolo