stubs/meson: Fix qemuutil build when --disable-system
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.
--- stubs/meson.build | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
stubs/meson.build +3 -7
@@ -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
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.1Compiling without system, user, tools or guest-agent fails with the following error message:
./configure --disable-system --disable-user --disable-tools \
--disable-guest-agenterror 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 toerror_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in functionvreport':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:215: undefined reference to `error_vprintf'
collect2: error: ld returned 1 exit statusThis is because tests/bench and tests/unit both need qemuutil, which requires
error_vprintfstub when system is disabled.Add
error_vprintfstub intostub_ssfor all cases other than disabling system.Fixes 3a15604900c4 ("stubs: include stubs only if needed")Reported-by Daniel P. Berrangé <[email protected]>Signed-off-by Zhao Liu <[email protected]>--- stubs/meson.build | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)stubs/meson.build +0
-7@@ -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
-0if have_system or have_userSignature · 1 line
2.34.1
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-agenterror 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 toerror_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in functionvreport':
/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_vprintfstub when system is disabled.Add
error_vprintfstub intostub_ssfor 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_userstubs/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
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-systemQuoted 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-agenterror 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 toerror_vprintf' /usr/bin/ld: libqemuutil.a.p/util_error-report.c.o: in functionvreport':
/media/liuzhao/data/qemu-cook/build/../util/error-report.c:215: undefined reference to `error_vprintf'
collect2: error: ld returned 1 exit statusQuoted 5 lines
This is because tests/bench and tests/unit both need qemuutil, which requires
error_vprintfstub when system is disabled.Add
error_vprintfstub intostub_ssfor 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.cto the unconditional section at the top of the file. I queued the patch with that change.
Thanks!! I can delete my v2 branch now. :-)