Skip to contentSkip to conversation

qga: Allow building of the guest agent without system emulators or tools

PATCH In review Thomas Huth 2 participants 2 messages Nov 10, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qga: Allow building of the guest agent without system emulators or tools

If configuring with "--disable-system --disable-user --enable-guest-agent" the linking currently fails with:

qga/qemu-ga.p/commands.c.o: In function `qmp_command_info':
build/../../home/thuth/devel/qemu/qga/commands.c:70: undefined reference to qmp_command_name' build/../../home/thuth/devel/qemu/qga/commands.c:71: undefined reference to qmp_command_is_enabled' build/../../home/thuth/devel/qemu/qga/commands.c:72: undefined reference to qmp_has_success_response' qga/qemu-ga.p/commands.c.o: In function qmp_guest_info':
build/../../home/thuth/devel/qemu/qga/commands.c:82: undefined reference to qmp_for_each_command' qga/qemu-ga.p/commands.c.o: In function qmp_guest_exec':
build/../../home/thuth/devel/qemu/qga/commands.c:410: undefined reference to qbase64_decode' qga/qemu-ga.p/channel-posix.c.o: In function ga_channel_open':
build/../../home/thuth/devel/qemu/qga/channel-posix.c:214: undefined reference to unix_listen' build/../../home/thuth/devel/qemu/qga/channel-posix.c:228: undefined reference to socket_parse' build/../../home/thuth/devel/qemu/qga/channel-posix.c:234: undefined reference to socket_listen' qga/qemu-ga.p/commands-posix.c.o: In function qmp_guest_file_write':
build/../../home/thuth/devel/qemu/qga/commands-posix.c:527: undefined reference to `qbase64_decode'

Let's make sure that we also compile and link the required files if the system emulators have not been enabled.

---
v2: Refine the file list in the util/ folder (as suggested by Philippe)

 qapi/meson.build  |  2 +-
 stubs/meson.build |  2 +-
 util/meson.build  | 20 ++++++++++++--------
 3 files changed, 14 insertions(+), 10 deletions(-)
qapi/meson.build +1 -1
index 9a36c15c04..fbdb442fdf 100644
@@ -13,7 +13,7 @@ util_ss.add(files(
 if have_system
   util_ss.add(files('qapi-type-helpers.c'))
 endif
-if have_system or have_tools
+if have_system or have_tools or have_ga
   util_ss.add(files(
     'qmp-dispatch.c',
     'qmp-event.c',
stubs/meson.build +1 -1
index 4314161f5f..c96a74f095 100644
@@ -49,7 +49,7 @@ stub_ss.add(files('vmstate.c'))
 stub_ss.add(files('vm-stop.c'))
 stub_ss.add(files('win32-kbd-hook.c'))
 stub_ss.add(files('cpu-synchronize-state.c'))
-if have_block
+if have_block or have_ga
   stub_ss.add(files('replay-tools.c'))
 endif
 if have_system
util/meson.build +12 -8
index 59c1f467bb..25b9b61f98 100644
@@ -68,20 +68,25 @@ if have_system
   util_ss.add(when: 'CONFIG_LINUX', if_true: files('userfaultfd.c'))
 endif
 
-if have_block
-  util_ss.add(files('aiocb.c', 'async.c', 'aio-wait.c'))
+if have_block or have_ga
+  util_ss.add(files('aiocb.c', 'async.c'))
   util_ss.add(files('base64.c'))
+  util_ss.add(files('lockcnt.c'))
+  util_ss.add(files('main-loop.c'))
+  util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-coroutine-io.c'))
+  util_ss.add(files('coroutine-@[email protected]'.format(config_host['CONFIG_COROUTINE_BACKEND'])))
+  util_ss.add(files('thread-pool.c', 'qemu-timer.c'))
+  util_ss.add(files('qemu-sockets.c'))
+endif
+if have_block
+  util_ss.add(files('aio-wait.c'))
   util_ss.add(files('buffer.c'))
   util_ss.add(files('bufferiszero.c'))
-  util_ss.add(files('coroutine-@[email protected]'.format(config_host['CONFIG_COROUTINE_BACKEND'])))
   util_ss.add(files('hbitmap.c'))
   util_ss.add(files('hexdump.c'))
   util_ss.add(files('iova-tree.c'))
-  util_ss.add(files('iov.c', 'qemu-sockets.c', 'uri.c'))
-  util_ss.add(files('lockcnt.c'))
-  util_ss.add(files('main-loop.c'))
+  util_ss.add(files('iov.c', 'uri.c'))
   util_ss.add(files('nvdimm-utils.c'))
-  util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-coroutine-io.c'))
   util_ss.add(when: 'CONFIG_LINUX', if_true: [
     files('vhost-user-server.c'), vhost_user
   ])
@@ -89,7 +94,6 @@ if have_block
   util_ss.add(files('qemu-coroutine-sleep.c'))
   util_ss.add(files('qemu-co-shared-resource.c'))
   util_ss.add(files('qemu-co-timeout.c'))
-  util_ss.add(files('thread-pool.c', 'qemu-timer.c'))
   util_ss.add(files('readline.c'))
   util_ss.add(files('throttle.c'))
   util_ss.add(files('timed-average.c'))
Signature · 1 line
2.31.1
Reviewed-by Tested-by on v2 1/1
#1 lore raw
Quoted 21 lines · Thomas Huth

If configuring with "--disable-system --disable-user --enable-guest-agent" the linking currently fails with:

qga/qemu-ga.p/commands.c.o: In function `qmp_command_info':
build/../../home/thuth/devel/qemu/qga/commands.c:70: undefined reference to qmp_command_name' build/../../home/thuth/devel/qemu/qga/commands.c:71: undefined reference to qmp_command_is_enabled' build/../../home/thuth/devel/qemu/qga/commands.c:72: undefined reference to qmp_has_success_response' qga/qemu-ga.p/commands.c.o: In function qmp_guest_info':
build/../../home/thuth/devel/qemu/qga/commands.c:82: undefined reference to qmp_for_each_command' qga/qemu-ga.p/commands.c.o: In function qmp_guest_exec':
build/../../home/thuth/devel/qemu/qga/commands.c:410: undefined reference to qbase64_decode' qga/qemu-ga.p/channel-posix.c.o: In function ga_channel_open':
build/../../home/thuth/devel/qemu/qga/channel-posix.c:214: undefined reference to unix_listen' build/../../home/thuth/devel/qemu/qga/channel-posix.c:228: undefined reference to socket_parse' build/../../home/thuth/devel/qemu/qga/channel-posix.c:234: undefined reference to socket_listen' qga/qemu-ga.p/commands-posix.c.o: In function qmp_guest_file_write':
build/../../home/thuth/devel/qemu/qga/commands-posix.c:527: undefined reference to `qbase64_decode'

Let's make sure that we also compile and link the required files if the system emulators have not been enabled.

Quoted 8 lines

---
v2: Refine the file list in the util/ folder (as suggested by Philippe)

  qapi/meson.build  |  2 +-
  stubs/meson.build |  2 +-
  util/meson.build  | 20 ++++++++++++--------
  3 files changed, 14 insertions(+), 10 deletions(-)