Commit Graph

216 Commits

Author SHA1 Message Date
Michal Privoznik
e0c6691e78 meson: Declare GLIB_VERSION_* macros at configure
So far we have three places where glib version is recorded:
meson.build and then in config.h. The latter is so well hidden
that it's easy to miss when bumping minimal glib version in the
former. With a bit of python^Wmeson string magic
GLIB_VERSION_MIN_REQUIRED and GLIB_VERSION_MAX_ALLOWED macros can
be defined to match glib_version from meson.build.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-05-03 12:08:26 +02:00
Jiri Denemark
f953e37846 Post-release version bump to 7.4.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-05-03 11:08:50 +02:00
Daniel P. Berrangé
3c3c55be66 meson: don't probe for -Werror if --werror is enabled
Meson has its own mechanism to turn on -Werror with the --werror option.
If this is set, then there is no reason for libvirt to check for -Werror
itself.

We remove the summary line output because it is potentially misleading
when libvirt hasn't enabled -Werror, but meson has.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:13:56 +01:00
Daniel P. Berrangé
a9461d456c meson: honour meson warning_level option
Meson defines a warning_level option which has the following behaviour
with C code

 0:  no warning flags
 1: -Wall
 2: -Wall -Wextra
 3: -Wall -Wextra -Wpedantic

Currently we add our extra warning flags unconditionally if the compiler
supports them, regardless of the meson warning_level setting. This has
effectively nullified the warning_level setting in meson, and also
results in meson printing these messages:

  meson.build:498: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
  meson.build:498: WARNING: Consider using the built-in warning_level option instead of using "-Wextra".

Semantically we can think of our huge list of flags as being an "extra"
set of warnings, and thus we ought to only add them when meson would
itself use -Wextra. aka warning_level == 2 or 3.

In practice libvirt code can't be built with -Wpedantic so we can ignore
meson warning_level 3, and only add our flags when warning_level==2.

In doing this change, we no longer have to check -Wall/-Wextra ourselves
as we can assume meson already set them.

-W is an alias of -Wextra so it is removed too.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
8f28944fd5 meson: avoid checking compiler flags twice
In several cases we check if a compiler flag is supported, and then add
it to the 'cc_flags' array. The entire 'cc_flags' array is then later
tested to see if each flag is supported, which duplicates the check in
some cases.

Move the check of cc_flags earlier, and for the extra flags append
directly to supported_cc_flags to avoid the duplicate check

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
8394f08e9d meson: merge all cc_flags arrays into one
The split of arrays is fairly arbitrary and a hang over from the way we
had to structure lists of flags when we used GNULIB's compiler flag
checking m4 logic.

The separate lists leads to cases where we enable a flag in one list and
have contradictory setting in another list, which leads to confusion.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
2e85a83abe meson: remove obsolete comment about stack frame size
The virStrerror function no longer exists in libvirt so is not a
constraint. At the current stack limit of 4k, and default Linux
stack size of 8 MB, we have a recursion limit of 2048 in the
absolute worst case, and much higher in common case. Even with
smaller stack sizes, we're going to be fine as we don't deeply
recurse in code.

Thus it is not worth spending effort to optimize below our current
4k worst case limit. Removing the comment will stop encouraging
people to spend time on this in future.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:53 +01:00
Daniel P. Berrangé
36489081b0 meson: actually check for -Wframe-larger-than
All other warning flags are checked for compiler support, so we
shouldn't blindly assume this one always exists.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:52 +01:00
Daniel P. Berrangé
a0e5aca072 meson: get rid of list of unused warning flags
We're not using these warning flags with libvirt, and it is not worth
keeping them just to issue a warning if someone tries to enable them.
If someone does try to enable them, either libvirt will build cleanly
or it won't.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-23 16:12:52 +01:00
Pavel Hrdina
7e88184b8e meson: don't check collie as program for sheepdog
Upstream sheepdog changed collie to dog back in 2013 in version 0.7.0.
Looking into repology that version is no longer used by any distribution
supported by libvirt.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-04-21 14:19:54 +02:00
Andrea Bolognani
1635dca26f meson: Drop readline kludge
Both FreeBSD ports and Homebrew on macOS have readline 8.1 now,
and that version contains a correct pkg-config file so the kludge
is no longer necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-04-12 09:55:27 +02:00
Olaf Hering
2fc3a704e7 libxl: use API 4.13 to support domUs with more than 4TB
To support domUs with more than 4TB memory it is required to use
LIBXL_API_VERSION >= 0x040800, which uses uint64_t for certained guest
memory related quantities.

Unfortunately this change is not straight forward. While most of the
code in libxl.h handles the various LIBXL_API_VERSION variants
correctly, the check for valid a LIBXL_API_VERSION at the beginning of
the file was broken between Xen 4.7 and 4.13 - it did not cover for
API changes introduced in Xen 4.7 and 4.8. This was fixed with
xen-project/xen@c3999835df, which for libvirt means in practice either
the libxl API from Xen 4.5 or 4.13+ can be used.

This change uses pkgconfig to decide which API can be safely selected.
Xen provides a pkgconfig file since Xen 4.6, which is also the lowest
version expected by libvirt.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
2021-04-01 14:01:06 -06:00
Jiri Denemark
caaadd28a1 Post-release version bump to 7.3.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-04-01 12:21:23 +02:00
Daniel P. Berrangé
695bdb3841 src: ensure GSource background unref happens in correct event loop
The g_idle_add function adds a callback to the primary GMainContext.

To workaround the GSource unref bugs, we need to add our callbacks
to the GMainContext that is associated with the GSource being
unref'd. Thus code using the per-VM virEventThread must use its
private GMainContext.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-17 09:16:05 +00:00
Michal Privoznik
53454b7b34 meson: Don't check for addr2line
In the past, we used to have this oomtrace.pl script that
attempted to print the stack trace of where an OOM error
occurred and it used addr2line for that. But since v5.8.0-rc1~189
we don't really care about OOM anymore and the script is long
gone so there's no need to check for addr2line program either.

Fixes: 2c52ecd960
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-03-15 20:37:51 +01:00
Chris Mayo
ee4a392dda meson: Add documentation installation directory option
Allow the directory to be chosen at installation time, to support local
conventions e.g. versioning.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-03-09 12:13:38 +01:00
Martin Kletzander
8964564550 util: Move glib event loop workaround to glibcompat
This way it can be used from other places as well.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-03-05 10:17:26 +01:00
Jim Fehlig
9386eadad4 build: Require glib >= 2.56
There are a few uses of g_autoslist in the qemu driver and likely more
will come throughout the codebase in the future. g_autoslist first
appeared in glib 2.56, so bump the minimum version

https://developer.gnome.org/glib/stable/glib-Miscellaneous-Macros.html#g-autoslist

Bumping the minimum version is an opportune time to update the list of
minimum glib versions found on the distros targeted by libvirt's
platform support policy

   RHEL-7: 2.56.1
   RHEL-8: 2.56.4
   Debian (Buster): 2.58.3
   OpenBSD (Ports): 2.66.7
   FreeBSD (Ports): 2.66.7
   openSUSE Leap 15.2, SLE15-SP2: 2.62.6
   Ubuntu (Bionic): 2.56.1
   macOS (Homebrew): 2.66.7

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2021-03-04 10:32:45 -07:00
Jiri Denemark
62bd8833db Post-release version bump to 7.2.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-03-01 11:58:58 +01:00
Michal Privoznik
1f8e6a6172 esx: Bump minimal version of curl
According to meson.build the minimal version of curl needed is
7.18.0 which was released in January 2008. If the minimal version
is bumped to 7.19.1 (released in November 2008) we can drop some
workarounds because this newer version provides APIs we need.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-02-17 10:21:26 +01:00
Andrea Bolognani
82ffb81c9c cpu: Only include <sys/auxv.h> if available
This header is not present on several non-Linux targets that
nonetheless support aarch64.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2021-02-09 09:14:05 +01:00
Laine Stump
06169a115d build: support explicitly disabling netcf
placing "-Dnetcf=disabled" on the meson commandline was ignored,
meaning that even with that option the build would get WITH_NETCF if
the netcf-devel package was found - the only way to disable it was to
uninstall netcf-devel.

This patch adds the small bit of logic to check the netcf meson
commandline option (in addition to whether netcf-devel is installed)
before defining WITH_NETCF.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-31 02:43:31 -05:00
Helmut Grohne
44b348134c meson: Fix cross-building of dtrace probes
dtrace invokes the C compiler, so when cross-building we need
to make sure that $CC is set in the environment and that it
points to the cross-compiler rather than the native one.

Until https://github.com/mesonbuild/meson/issues/266
is addressed, the workaround is to call dtrace via env(1).

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=980334

Signed-off-by: Helmut Grohne <helmut@subdivi.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-26 10:59:45 +01:00
Nikolay Shirokovskiy
2127d53f2f meson: build vstorage only on linux
This should fix CI error:

    ../dist-unpack/libvirt-7.1.0/src/storage/storage_backend_vstorage.c:10:10: fatal error: 'mntent.h' file not found
    #include <mntent.h>
    ^~~~~~~~~~

on freebsd and mac.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-19 20:25:42 +03:00
Nikolay Shirokovskiy
6503e1a0ee vstorage: remove build time checks for runtime binaries
Accoring to current agreement mentioned in list recently [1]. Now
vstorage driver will be build in default devs environment and also can
be included into CI. This also closes quite old abandoned thread on
alternative checks for binaries in case of this same driver [2].

[1] https://www.redhat.com/archives/libvir-list/2021-January/msg00750.html
[2] https://www.redhat.com/archives/libvir-list/2020-July/msg00697.html

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-01-19 15:10:11 +03:00
Jiri Denemark
0335f00d70 Post-release version bump to 7.1.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2021-01-15 09:52:51 +01:00
Michal Privoznik
6d7415272e Enable VMware driver by default
During rewrite to meson it was mistakenly disabled. Originally,
we had:

  LIBVIRT_ARG_WITH_FEATURE([VMWARE], [VMware], [yes])

which enabled the driver by default. But in meson we are checking
whether the 'driver_vmware' option is enabled without anything
enabling it automagically.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-05 11:02:23 +01:00
Daniel P. Berrangé
143d2e9bde meson: add winsock2 library on windows builds
If building for windows with curl disabled we get build failures due to
missing ws2_32 library needed for winsock2.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-12-02 12:49:05 +00:00
Jiri Denemark
38dfd3e80e Post-release version bump to 7.0.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2020-12-01 09:54:20 +01:00
Pavel Hrdina
3f2b7d3fe2 src: rework static analysis detection
Inspired by QEMU code.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-19 14:38:13 +01:00
Martin Kletzander
65491a2dfe Do not disable incompatible-pointer-types-discards-qualifiers
This reverts commit b3710e9a2a.

That check is very valuable for our code, but it causes issue with glib >=
2.67.0 when building with clang.

The reason is a combination of two commits in glib, firstly fdda405b6b1b which
adds a g_atomic_pointer_{set,get} variants that enforce stricter type
checking (by removing an extra cast) for compilers that support __typeof__, and
commit dce24dc4492d which effectively enabled the new variant of glib's atomic
code for clang.  This will not be necessary when glib's issue #600 [0] (8 years
old) is fixed.  Thankfully, MR #1719 [1], which is supposed to deal with this
issue was opened 3 weeks ago, so there is a slight sliver of hope.

[0] https://gitlab.gnome.org/GNOME/glib/-/issues/600
[1] https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2020-11-18 11:01:50 +01:00
Daniel P. Berrangé
45d714ce2e meson: bump min wireshark to 2.6.0
If using the declared min version of wireshark, 2.4.0, libvirt plugin
fails to build. This min version isn't present in any supported distros
and thus not tested by CI.

We don't support wireshark on RHEL-7 since it has 1.x.x series. The next
oldest version present in supported distros is 2.6.2 on RHEL-8.

Thus we should bump the min version to 2.6.0. This also lets us assume
that the "plugindir" variable exists in pkg-config.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-17 10:19:00 +00:00
Daniel P. Berrangé
7b42f33278 meson: assume pkg-config support for yajl
Per the platform support rules, we no longer need to consider SLES 12 as
a target, and so can now assume pkg-config support in yajl.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-17 10:18:48 +00:00
Olaf Hering
f76f6d1556 meson: fix yajl detection
yajl_tree_parse is declared in yajl/yajl_tree.h
autoconf is more forgiving, the error did not trigger because
yajl_tree_parse is not actually used.

Fixes: 44b8df4cb4
Fixes: 88ab32a4e5
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-11-13 11:23:13 +01:00
Andrea Bolognani
6c1ad2735a Fix capitalization "CLang" -> "Clang"
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2020-11-12 15:01:42 +01:00
Daniel P. Berrangé
b3710e9a2a Set -Wno-incompatible-pointer-types-discards-qualifiers
With Clang we're getting failures from casts in GLib macros

../dist-unpack/libvirt-6.10.0/src/util/vireventthread.c:35:1:
  error: passing 'typeof (*(&g_define_type_id__volatile)) *'
  (aka 'volatile unsigned long *') to parameter of type
  'gsize *' (aka 'unsigned long *') discards qualifiers
  [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
G_DEFINE_TYPE(virEventThread, vir_event_thread, G_TYPE_OBJECT)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The cast is valid and there's no way for libvirt to workaround
the issue, so we must disable this Clang warning flag.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-12 11:21:26 +00:00
Jiri Denemark
2c98d0f3db Post-release version bump to 6.10.0
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2020-11-02 11:18:13 +01:00
Daniel P. Berrangé
e9cfbd36c5 tests: fix stat mocking with Fedora rawhide
GLibC has a really complicated way of dealing with the 'stat' function
historically, which means our mocks in turn have to look at four
different possible functions to replace, stat, stat64, __xstat,
__xstat64.

In Fedora 33 and earlier:

 - libvirt.so links to __xstat64
 - libc.so library exports stat, stat64, __xstat, __xstat64
 - sys/stat.h header exposes stat and __xstat

In Fedora 34 rawhide:

 - libvirt.so links to stat64
 - libc.so library exports stat, stat64, __xstat, __xstat64
 - sys/stat.h header exposes stat

Historically we only looked at the exported symbols from libc.so to
decide which to mock.

In F34 though we must not consider __xstat / __xstat64 though because
they only existance for binary compatibility. Newly built binaries
won't reference them.

Thus we must introduce a header file check into our logic for deciding
which symbol to mock. We must ignore the __xstat / __xstat64 symbols
if they don't appear in the sys/stat.h header, even if they appear
in libc.so

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-29 19:52:07 +01:00
Daniel P. Berrangé
c7fa462a87 meson: remove non-pkg-config fallback for devmapper
The fallback for distros which lack pkg-config support for devmapper
references an undefined variable "tmp". It appears non of our supported
build platforms are triggering this bug and so the fallback code can be
removed entirely rather than fixed.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-20 17:50:38 +01:00
Pavel Hrdina
67f08376fd meson: add tests build option to enable/disable unit tests
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
033c5b8b0b meson: add docs option to enable/disable generating documentation
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
b714efb99f meson: move build feature options to miscellaneous summary
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
4bd0a5b180 meson: remove required libraries from summary
These are always enabled so it doesn't make any sense to have the result
in summary as meson will fail if they are missing.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
3ff879d312 meson: add missing libraries to summary
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
4b98a703ee meson: prefix kvm_dep, m_dep and util_dep with lib
We don't use the lib prefix for all libraries but in these cases it
makes sense to use the prefix.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
b3e2ef408b meson: add libnl build option
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
8485287485 meson: build nodedev driver only if libvirtd is compiled
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
fc125d7e5c meson: properly handle readline if it's explicitly disabled
If readline is detected using pkg-config it would ignore the readline
option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
c8be9ccc36 meson: properly handle libpcap if it's explicitly disabled
If libpcap is detected using pkg-config it would ignore the libpcap
option.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00
Pavel Hrdina
87e855a4e9 meson: no need to call meson.get_compiler() again
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-09 13:44:54 +02:00