Skip to contentSkip to conversation

stubs/meson: Fix qemuutil build when --disable-system

PATCH In review Zhao Liu 2 participants 4 messages Jun 5, 2024 – Jun 6, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Zhao Liu

author
#0 lore raw

PATCH 1/1 stubs/meson: Fix qemuutil build when --disable-system

Compiling without system, user, tools or guest-agent fails with the following error message:

./configure --disable-system --disable-user --disable-tools \
--disable-guest-agent

error message:

/usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function `error_printf':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:38: undefined reference to error_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function vreport':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:215: undefined reference to `error_vprintf'
collect2: error: ld returned 1 exit status

This is because tests/bench and tests/unit both need qemuutil, which requires error_vprintf stub when system is disabled.

Add error_vprintf stub into stub_ss for all cases other than disabling system.

Fixes 3a15604900c4 ("stubs: include stubs only if needed")
---
 stubs/meson.build | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
stubs/meson.build +3 -7
index 3b9d42023cb2..a99522ab6bbf 100644
@@ -45,17 +45,10 @@ if have_block or have_ga
   stub_ss.add(files('qmp-quit.c'))
 endif
 
-if have_ga
-  stub_ss.add(files('error-printf.c'))
-endif
-
 if have_block or have_user
   stub_ss.add(files('qtest.c'))
   stub_ss.add(files('vm-stop.c'))
   stub_ss.add(files('vmstate.c'))
-
-  # more symbols provided by the monitor
-  stub_ss.add(files('error-printf.c'))
 endif
 
 if have_user
@@ -76,6 +69,9 @@ if have_system
   stub_ss.add(files('target-monitor-defs.c'))
   stub_ss.add(files('win32-kbd-hook.c'))
   stub_ss.add(files('xen-hw-stub.c'))
+else
+  # more symbols provided by the monitor
+  stub_ss.add(files('error-printf.c'))
 endif
 
 if have_system or have_user
Signature · 1 line
2.34.1
author
#1 lore raw
Quoted 55 lines · Zhao Liu

Date: Wed, 5 Jun 2024 23:25:49 +0800
From: Zhao Liu <[email protected]>
Subject: [PATCH] stubs/meson: Fix qemuutil build when --disable-system
X-Mailer: git-send-email 2.34.1

Compiling without system, user, tools or guest-agent fails with the following error message:

./configure --disable-system --disable-user --disable-tools \
--disable-guest-agent

error message:

/usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function `error_printf':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:38: undefined reference to error_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function vreport':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:215: undefined reference to `error_vprintf'
collect2: error: ld returned 1 exit status

This is because tests/bench and tests/unit both need qemuutil, which requires error_vprintf stub when system is disabled.

Add error_vprintf stub into stub_ss for all cases other than disabling system.

Fixes 3a15604900c4 ("stubs: include stubs only if needed")
---
 stubs/meson.build | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
stubs/meson.build +0 -7
index 3b9d42023cb2..a99522ab6bbf 100644
@@ -45,17 +45,10 @@ if have_block or have_ga
   stub_ss.add(files('qmp-quit.c'))
 endif
 
-if have_ga
-  stub_ss.add(files('error-printf.c'))
-endif
-
 if have_block or have_user
   stub_ss.add(files('qtest.c'))
   stub_ss.add(files('vm-stop.c'))
   stub_ss.add(files('vmstate.c'))
-
-  # more symbols provided by the monitor
-  stub_ss.add(files('error-printf.c'))
 endif
 
 if have_user

stubs/meson.build if have_system · line 75

Quoted 7 lines
stubs/meson.build +3 -0
@@ -76,6 +69,9 @@ if have_system
   stub_ss.add(files('target-monitor-defs.c'))
   stub_ss.add(files('win32-kbd-hook.c'))
   stub_ss.add(files('xen-hw-stub.c'))
+else
+  # more symbols provided by the monitor
+  stub_ss.add(files('error-printf.c'))
 endif

Oops, it's not a correct fix. error-printf.c should still be added unconditionally.

Quoted 5 lines
stubs/meson.build +0 -0
 if have_system or have_user
Signature · 1 line
2.34.1
#2 lore raw
In reply to Zhao Liu
Quoted 14 lines · Zhao Liu

Compiling without system, user, tools or guest-agent fails with the following error message:

./configure --disable-system --disable-user --disable-tools \
--disable-guest-agent

error message:

/usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function `error_printf':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:38: undefined reference to error_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function vreport':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:215: undefined reference to `error_vprintf'
collect2: error: ld returned 1 exit status

Quoted 5 lines

This is because tests/bench and tests/unit both need qemuutil, which requires error_vprintf stub when system is disabled.

Add error_vprintf stub into stub_ss for all cases other than disabling system.

Should be "other than enabled system emulation", but...

stubs/meson.build if have_block or have_ga · line 52

Quoted 12 lines
stubs/meson.build +0 -7
-if have_ga
-  stub_ss.add(files('error-printf.c'))
-endif
-
  if have_block or have_user
    stub_ss.add(files('qtest.c'))
    stub_ss.add(files('vm-stop.c'))
    stub_ss.add(files('vmstate.c'))
-
-  # more symbols provided by the monitor
-  stub_ss.add(files('error-printf.c'))
  endif

... these should be left in, since it's possible to build with --enable-guest-agent --enable-system.

The best and easiest solution is simply to move error-printf.c to the unconditional section at the top of the file. I queued the patch with that change.

Paolo

Quoted 11 lines

if have_user

stubs/meson.build +3 -0
@@ -76,6 +69,9 @@ if have_system
    stub_ss.add(files('target-monitor-defs.c'))
    stub_ss.add(files('win32-kbd-hook.c'))
    stub_ss.add(files('xen-hw-stub.c'))
+else
+  # more symbols provided by the monitor
+  stub_ss.add(files('error-printf.c'))
  endif
 
  if have_system or have_user
author
#3 lore raw
Quoted 43 lines · Paolo Bonzini

Date: Thu, 6 Jun 2024 09:41:47 +0200
From: Paolo Bonzini <[email protected]>
Subject: Re: [PATCH] stubs/meson: Fix qemuutil build when --disable-system

Quoted 14 lines · Zhao Liu

Compiling without system, user, tools or guest-agent fails with the following error message:

./configure --disable-system --disable-user --disable-tools \
--disable-guest-agent

error message:

/usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function `error_printf':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:38: undefined reference to error_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in function vreport':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:215: undefined reference to `error_vprintf'
collect2: error: ld returned 1 exit status

Quoted 5 lines

This is because tests/bench and tests/unit both need qemuutil, which requires error_vprintf stub when system is disabled.

Add error_vprintf stub into stub_ss for all cases other than disabling system.

Should be "other than enabled system emulation", but...

stubs/meson.build if have_block or have_ga · line 52

Quoted 12 lines
stubs/meson.build +0 -7
-if have_ga
-  stub_ss.add(files('error-printf.c'))
-endif
-
  if have_block or have_user
    stub_ss.add(files('qtest.c'))
    stub_ss.add(files('vm-stop.c'))
    stub_ss.add(files('vmstate.c'))
-
-  # more symbols provided by the monitor
-  stub_ss.add(files('error-printf.c'))
  endif

... these should be left in, since it's possible to build with --enable-guest-agent --enable-system.

Quoted 3 lines

The best and easiest solution is simply to move error-printf.c to the unconditional section at the top of the file. I queued the patch with that change.

Thanks!! I can delete my v2 branch now. :-)