From f70071e41da960a1d68d3cef0cb1e2e4d0d93fbf Mon Sep 17 00:00:00 2001 From: dramforever Date: Thu, 9 Feb 2023 21:18:40 +0800 Subject: [PATCH 1/2] qemu: fix cross compilation, again The python dependencies were fixed for cross in #147692, but the changes are reversed #190560 due to concerns of accidentally mixing python versions. Compromise by using python3Packages.python. --- pkgs/applications/virtualization/qemu/default.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index e68cf7048b56a..6d40ba2660e3f 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, fetchpatch, python3, zlib, pkg-config, glib, buildPackages +{ lib, stdenv, fetchurl, fetchpatch, python3Packages, zlib, pkg-config, glib, buildPackages , perl, pixman, vde2, alsa-lib, texinfo, flex , bison, lzo, snappy, libaio, libtasn1, gnutls, nettle, curl, ninja, meson, sigtool , makeWrapper, runtimeShell, removeReferencesTo @@ -51,7 +51,13 @@ stdenv.mkDerivation rec { depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ makeWrapper removeReferencesTo pkg-config flex bison meson ninja perl python3 python3.pkgs.sphinx python3.pkgs.sphinx-rtd-theme ] + nativeBuildInputs = [ + makeWrapper removeReferencesTo + pkg-config flex bison meson ninja perl + + # Don't change this to python3 and python3.pkgs.*, breaks cross-compilation + python3Packages.python python3Packages.sphinx python3Packages.sphinx-rtd-theme + ] ++ lib.optionals gtkSupport [ wrapGAppsHook ] ++ lib.optionals stdenv.isDarwin [ sigtool ]; From 08e6d08acea8ac91619c5be4223d44e49f6476a7 Mon Sep 17 00:00:00 2001 From: dramforever Date: Sat, 4 Feb 2023 11:39:08 +0800 Subject: [PATCH 2/2] qemu: Remove --cpu= flag './configure --cpu=$(uname -m)' (essentially) breaks the case of riscv, where the configure script expects '--cpu=riscv', but 'uname -m' gives 'riscv{32,64}'. This eventually leads to user-mode emulation being disabled. Since the configure script can auto-detect the parameter based on compilers, remove this flag. Originally added in #147692, but apparently it's not needed and @NickCao couldn't remember why it was added. See also mailing list discussion at https://lore.kernel.org/qemu-devel/20230204112502.2558739-1-mjt@msgid.tls.msk.ru/T/ --- pkgs/applications/virtualization/qemu/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/applications/virtualization/qemu/default.nix b/pkgs/applications/virtualization/qemu/default.nix index 6d40ba2660e3f..c20a2c53d6002 100644 --- a/pkgs/applications/virtualization/qemu/default.nix +++ b/pkgs/applications/virtualization/qemu/default.nix @@ -149,7 +149,6 @@ stdenv.mkDerivation rec { # have our patches and will be subtly broken because of that. "--meson=meson" "--cross-prefix=${stdenv.cc.targetPrefix}" - "--cpu=${stdenv.hostPlatform.uname.processor}" (lib.enableFeature guestAgentSupport "guest-agent") ] ++ lib.optional numaSupport "--enable-numa" ++ lib.optional seccompSupport "--enable-seccomp"