[libvirt PATCH 0.5/2] meson: link libm

Laine Stump posted 1 patch 3 years, 8 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200826203510.211592-1-laine@redhat.com
meson.build          | 3 +++
src/util/meson.build | 1 +
2 files changed, 4 insertions(+)
[libvirt PATCH 0.5/2] meson: link libm
Posted by Laine Stump 3 years, 8 months ago
****************
(So here is a separate patch to add linking of libm. Care to ACK it?
Also, what are peoples' opinions of pushing these patches now, so that
they'll be in the upcoming release? I've put them on a private gitlab
branch so that the CI is run (and found two mingw build problems :-)),
except I haven't been able to make the cirrus-ci thing that builds
freebsd and macos to work.)
****************

On some platforms libm (needed for the pow() function) isn't being
linked in somehow. This patch adds the necessary bits to assure that
it's linked in when necessary.

Suggested-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Laine Stump <laine@redhat.com>
---
 meson.build          | 3 +++
 src/util/meson.build | 1 +
 2 files changed, 4 insertions(+)

diff --git a/meson.build b/meson.build
index dabd4196e6..81668a6681 100644
--- a/meson.build
+++ b/meson.build
@@ -1176,6 +1176,9 @@ endif
 libxml_version = '2.9.1'
 libxml_dep = dependency('libxml-2.0', version: '>=' + libxml_version)
 
+cc = meson.get_compiler('c')
+m_dep = cc.find_library('m', required : false)
+
 use_macvtap = false
 if not get_option('macvtap').disabled()
   if (cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_BRIDGE') and
diff --git a/src/util/meson.build b/src/util/meson.build
index a7017f459f..f7092cc3f1 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -188,6 +188,7 @@ virt_util_lib = static_library(
     devmapper_dep,
     gnutls_dep,
     libnl_dep,
+    m_dep,
     numactl_dep,
     secdriver_dep,
     src_dep,
-- 
2.26.2

Re: [libvirt PATCH 0.5/2] meson: link libm
Posted by Daniel P. Berrangé 3 years, 8 months ago
On Wed, Aug 26, 2020 at 04:35:10PM -0400, Laine Stump wrote:
> ****************
> (So here is a separate patch to add linking of libm. Care to ACK it?
> Also, what are peoples' opinions of pushing these patches now, so that
> they'll be in the upcoming release? I've put them on a private gitlab
> branch so that the CI is run (and found two mingw build problems :-)),
> except I haven't been able to make the cirrus-ci thing that builds
> freebsd and macos to work.)
> ****************

Given that our CI currently succeeds, we clearly don't have any bug
which neeeds fixing. Either the C library contains the functions, or
we're getting linkage to libm indirectly. With glibc it appears to be
the former. Fedora / RHEL linker probably gets libm indirectly, but
the Ubuntu/Debian linker wont.

Either way, it isn't important for the release since we're not showing
any broken builds currently.

> 
> On some platforms libm (needed for the pow() function) isn't being
> linked in somehow. This patch adds the necessary bits to assure that
> it's linked in when necessary.
> 
> Suggested-by: Michal Privoznik <mprivozn@redhat.com>
> Signed-off-by: Laine Stump <laine@redhat.com>
> ---
>  meson.build          | 3 +++
>  src/util/meson.build | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index dabd4196e6..81668a6681 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1176,6 +1176,9 @@ endif
>  libxml_version = '2.9.1'
>  libxml_dep = dependency('libxml-2.0', version: '>=' + libxml_version)
>  
> +cc = meson.get_compiler('c')
> +m_dep = cc.find_library('m', required : false)
> +
>  use_macvtap = false
>  if not get_option('macvtap').disabled()
>    if (cc.has_header_symbol('linux/if_link.h', 'MACVLAN_MODE_BRIDGE') and
> diff --git a/src/util/meson.build b/src/util/meson.build
> index a7017f459f..f7092cc3f1 100644
> --- a/src/util/meson.build
> +++ b/src/util/meson.build
> @@ -188,6 +188,7 @@ virt_util_lib = static_library(
>      devmapper_dep,
>      gnutls_dep,
>      libnl_dep,
> +    m_dep,
>      numactl_dep,
>      secdriver_dep,
>      src_dep,

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|