Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libvirt: 6.6.0 -> 6.8.0 #103309

Closed
wants to merge 1 commit into from
Closed

libvirt: 6.6.0 -> 6.8.0 #103309

wants to merge 1 commit into from

Conversation

teto
Copy link
Member

@teto teto commented Nov 10, 2020

Motivation for this change

I suffer from https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1764171.html / https://gitlab.com/libvirt/libvirt/-/issues/73 with 6.6 so I tried to bump it but they changed the buildsystem to meson (which is my first time playing with).

I've made some good progress until
meson.build:1561:2: ERROR: Problem encountered: You must install dbus to compile libvirt with polkit-1
it doesn't seem to detect dbus. I am a bit short on time to look into it right now will try later but I will welcome hints. Looks like it is looking for headers from dbus.dev

Related PRs:

changelog https://libvirt.org/news.html

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@teto
Copy link
Member Author

teto commented Nov 10, 2020

apparently, libvirt checks for the presence of dbus/dubs.h ( if cc.has_type(type, dependencies: dbus_dep, prefix: '#include <dbus/dbus.h>')) while our dbus pkg-config points at /nix/store/zsrmm38z5jjyrzdza3ww4k6lb7pvahl9-dbus-1.12.16-dev/include with

$ ls /nix/store/zsrmm38z5jjyrzdza3ww4k6lb7pvahl9-dbus-1.12.16-dev/include
dbus-1.0 

so maybe our dbus package needs ajustments too

@jtojnar
Copy link
Contributor

jtojnar commented Nov 10, 2020

That is correct #include pragma, the pkg-config file has -I flag that points to $dev/include/dbus-1.0.

The error actually comes from dbus_dep.found() being false here:

https://gitlab.com/libvirt/libvirt/-/blob/v6.7.0/meson.build#L1558

which should be found easily

https://gitlab.com/libvirt/libvirt/-/blob/v6.7.0/meson.build#L1027-1028

as long pkg-config is in nativeBuildInputs and dbus in buildInputs.

] ++ optionals stdenv.isDarwin [
"--with-init-script=none"
"-Dinit_script=none"
];

installFlags = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

installFlags will not do anything – ninja does not allow install time configuration.

'';

configureScript = "../configure";

dontAddDisableDepTrack = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dontAddDisableDepTrack is useless with Meson and enableParallelBuilding is redundant.

"-Dauto_features=disabled"
"-Drunstatedir=/run"
"-Dlocalstatedir=/var"
"-Dsysconfdir=/var/lib"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is weird, --sysconfdir should typically be /etc. Also note that you might need a patch like this one since ninja does not allow configuring variables at installation time.

"-Ddriver_esx=enabled"
"-Ddriver_remote=enabled"
"-Dpolkit=enabled"
"-Dbus=enabled"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, your issue might something to do with

Dependency dbus-1 skipped: feature dbus disabled

Likely this typo is causing it.

@teto
Copy link
Member Author

teto commented Nov 10, 2020

-I flag that points to $dev/include/dbus-1.0 ha nice I was really going through it quickly good catch.

Thanks for the review, it is very helpful.

@teto teto changed the title libvirt: 6.6.0 -> 6.7.0 libvirt: 6.6.0 -> 6.8.0 Nov 10, 2020
@teto
Copy link
Member Author

teto commented Nov 10, 2020

some more progress, yet still some problematic paths:

  PermissionError: [Errno 13] Permission denied: '/run'
  FAILED: install script '/build/libvirt/scripts/meson-python.sh /nix/store/gvkhgh813chlsvdsnxgwhv72xns08xcp-python3-3.8.6/bin/python3 /build/libvirt/scripts/meson-install-dirs.py /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/log/libvirt /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/lockd /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/lockd/files /run/libvirt/lockd /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/network /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/dnsmasq /run/libvirt/network /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/lxc /run/libvirt/lxc /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/log/libvirt/lxc /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/qemu /run/libvirt/qemu /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/cache/libvirt/qemu /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/log/libvirt/qemu /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/swtpm /run/libvirt/qemu/swtpm /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/log/swtpm/libvirt/qemu /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/cache/libvirt /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/images /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/filesystems /nix/store/4p81d8fg8xr7k20i1zccyginklylzs4m-libvirt-6.8.0/$(TMPDIR)/var/lib/libvirt/boot' exit code 1, stopped

networkmanager use

    "--sysconfdir=/etc"
    "--localstatedir=/var"

in its mesonFlags so I tried to do the same, but not sure that's correct.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 10, 2020

Meson supports both CMake-style and Autotools style options for GNU directory paths, so either will work.

Unfortunately, you are experiencing the issue that we want software to load sysconfig, localstate, etc. from / but install it to $out. We achieved that with Make by overriding the relevant variables for installation in installFlags but, as I mentioned, this is not possible with Ninja. You will need to replace the install_dirs by a patch like we do for fwupd or use an extremely ugly DESTDIR hack like we do for GDM.

@teto
Copy link
Member Author

teto commented Nov 11, 2020

the meson build system looks complex (too much for me to patch at least) so instead I've just patched our current libvirtd to fix my current issue:

  patches = [
    (fetchpatch {
      name = "fix-cow-on-write";
      url = "https://github.com/libvirt/libvirt/commit/2edd63a0dbd445112db23596ee0128521e8f1ff5.patch";
      sha256 = "sha256-rYJ3WLk5evyglv1BZDJh9I8/tnMV5xBpX1c/7/V3xHw=";
    })
  ];

feel free to pickup.

@Ma27
Copy link
Member

Ma27 commented Jan 8, 2021

Seems to be relevant for CVE-2020-25637. (see #100306, #100308)

@euank euank mentioned this pull request Jan 14, 2021
10 tasks
@euank
Copy link
Member

euank commented Jan 14, 2021

I ran into the issue you did too, @teto. Since this PR seems to have stalled out, I tried to carry it forward over here: #109332. I think I got everything to work on that one. Thanks for the initial PR to work from, I didn't have to make many changes at all to get it working!

Thanks as well for the pointers about meson, @jtojnar, they were immensely helpful!

euank added a commit to euank/nixpkgs that referenced this pull request Jan 14, 2021
The previous commit updates to a newer libvirt with a newer build setup.

This commit carries forward that work into a mergeable state.

Based on the suggestion in
NixOS#103309 (comment), I
did a fwupd-like patch for the various meson.build files.
@teto
Copy link
Member Author

teto commented Jan 14, 2021

very happy you could get a working build ! closing this one then

@teto teto closed this Jan 14, 2021
jonringer pushed a commit that referenced this pull request Jan 14, 2021
The previous commit updates to a newer libvirt with a newer build setup.

This commit carries forward that work into a mergeable state.

Based on the suggestion in
#103309 (comment), I
did a fwupd-like patch for the various meson.build files.
@teto teto deleted the libvirt67 branch September 5, 2021 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants