Skip to contentSkip to conversation

iscsi: always link libm into the module

PATCH In review Paolo Bonzini 3 participants 5 messages Jun 3, 2021 – Jun 4, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover iscsi: always link libm into the module

Depending on the configuration of QEMU, some binaries might not need libm at all. In that case libiscsi, which uses exp(), will fail to load. This series makes sure that libm is linked in the module explicitly.

Paolo

Paolo Bonzini (2):
meson: allow optional dependencies for block modules
iscsi: link libm into the module

 block/meson.build | 18 +++++++++---------
 meson.build       |  4 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 meson: allow optional dependencies for block modules

Right now all dependencies for block modules are passed to module_ss.add(when: ...), so they are mandatory. In the next patch we will need to add a libm dependency to a module, but libm does not exist on all systems. So, modify the creation of module_ss and modsrc so that dependencies can also be passed to module_ss.add(if_true: ...).

While touching the array, remove the useless dependency of the curl module on glib. glib is always linked in QEMU and in fact all other block modules also need it, but they don't have to specify it.

---
 block/meson.build | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
block/meson.build +9 -9
index e687c54dbc..9e3388f633 100644
@@ -71,19 +71,19 @@ block_modules = {}
 
 modsrc = []
 foreach m : [
-  [curl, 'curl', [curl, glib], 'curl.c'],
-  [glusterfs, 'gluster', glusterfs, 'gluster.c'],
-  [libiscsi, 'iscsi', libiscsi, 'iscsi.c'],
-  [libnfs, 'nfs', libnfs, 'nfs.c'],
-  [libssh, 'ssh', libssh, 'ssh.c'],
-  [rbd, 'rbd', rbd, 'rbd.c'],
+  [curl, 'curl', files('curl.c')],
+  [glusterfs, 'gluster', files('gluster.c')],
+  [libiscsi, 'iscsi', files('iscsi.c')],
+  [libnfs, 'nfs', files('nfs.c')],
+  [libssh, 'ssh', files('ssh.c')],
+  [rbd, 'rbd', files('rbd.c')],
 ]
   if m[0].found()
+    module_ss = ss.source_set()
+    module_ss.add(when: m[0], if_true: m[2])
     if enable_modules
-      modsrc += files(m[3])
+      modsrc += module_ss.all_sources()
     endif
-    module_ss = ss.source_set()
-    module_ss.add(when: m[2], if_true: files(m[3]))
     block_modules += {m[1] : module_ss}
   endif
 endforeach
Signature · 1 line
2.31.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] meson: allow optional dependencies for block modules

Quoted 11 lines · Paolo Bonzini

Right now all dependencies for block modules are passed to module_ss.add(when: ...), so they are mandatory. In the next patch we will need to add a libm dependency to a module, but libm does not exist on all systems. So, modify the creation of module_ss and modsrc so that dependencies can also be passed to module_ss.add(if_true: ...).

While touching the array, remove the useless dependency of the curl module on glib. glib is always linked in QEMU and in fact all other block modules also need it, but they don't have to specify it.

Signature · 2 lines
Best regards,
Vladimir
#3 lore raw

PATCH 2/2 iscsi: link libm into the module

In reply to Paolo Bonzini

Depending on the configuration of QEMU, some binaries might not need libm at all. In that case libiscsi, which uses exp(), will fail to load. Link it in the module explicitly.

---
 block/meson.build | 2 +-
 meson.build       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
block/meson.build +1 -1
index 9e3388f633..01861e1545 100644
@@ -73,7 +73,7 @@ modsrc = []
 foreach m : [
   [curl, 'curl', files('curl.c')],
   [glusterfs, 'gluster', files('gluster.c')],
-  [libiscsi, 'iscsi', files('iscsi.c')],
+  [libiscsi, 'iscsi', [files('iscsi.c'), libm]],
   [libnfs, 'nfs', files('nfs.c')],
   [libssh, 'ssh', files('ssh.c')],
   [rbd, 'rbd', files('rbd.c')],
meson.build +2 -2
index a45f1a844f..913cf2a41a 100644
@@ -163,7 +163,7 @@ if targetos != 'linux' and get_option('multiprocess').enabled()
 endif
 multiprocess_allowed = targetos == 'linux' and not get_option('multiprocess').disabled()
 
-m = cc.find_library('m', required: false)
+libm = cc.find_library('m', required: false)
 util = cc.find_library('util', required: false)
 winmm = []
 socket = []
@@ -1899,7 +1899,7 @@ util_ss.add_all(trace_ss)
 util_ss = util_ss.apply(config_all, strict: false)
 libqemuutil = static_library('qemuutil',
                              sources: util_ss.sources() + stub_ss.sources() + genh,
-                             dependencies: [util_ss.dependencies(), m, glib, socket, malloc, pixman])
+                             dependencies: [util_ss.dependencies(), libm, glib, socket, malloc, pixman])
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res)
 
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] iscsi: link libm into the module

Quoted 10 lines · Paolo Bonzini

Depending on the configuration of QEMU, some binaries might not need libm at all. In that case libiscsi, which uses exp(), will fail to load. Link it in the module explicitly.

---
 block/meson.build | 2 +-
 meson.build       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)