GNU bug report logs - #41074
[PATCH] gnu: qemu-minimal: Only build for the host's architecture.

Previous Next

Package: guix-patches;

Reported by: Efraim Flashner <efraim <at> flashner.co.il>

Date: Mon, 4 May 2020 10:27:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#41074: closed ([PATCH] gnu: qemu-minimal: Only build for the
 host's architecture.)
Date: Thu, 14 May 2020 14:26:03 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 14 May 2020 17:24:36 +0300
with message-id <20200514142436.GQ918 <at> E5400>
and subject line Re: [bug#41074] [PATCH] gnu: qemu-minimal: Only build for the host's architecture.
has caused the debbugs.gnu.org bug report #41074,
regarding [PATCH] gnu: qemu-minimal: Only build for the host's architecture.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
41074: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=41074
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Efraim Flashner <efraim <at> flashner.co.il>
To: guix-patches <at> gnu.org
Cc: Efraim Flashner <efraim <at> flashner.co.il>
Subject: [PATCH] gnu: qemu-minimal: Only build for the host's architecture.
Date: Mon,  4 May 2020 13:25:15 +0300
* gnu/packages/virtualization.scm (qemu-minimal)[arguments]: Adjust
configure-flags so that each architecture only builds for its native
architectures.
[synopsis]: Adjust to clarify it's only for the host's architecture.
---

I tested this with building grub and a vm-image and both seem to have
worked without any regressions.

---
 gnu/packages/virtualization.scm | 31 +++++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index b9ac18820f..e5d678e685 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw <at> netris.org>
-;;; Copyright © 2016, 2017, 2018. 2019 Efraim Flashner <efraim <at> flashner.co.il>
+;;; Copyright © 2016, 2017, 2018. 2019, 2020 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2017 Alex Vong <alexvong1995 <at> gmail.com>
 ;;; Copyright © 2017 Andy Patterson <ajpatter <at> uwaterloo.ca>
@@ -99,7 +99,8 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils)
-  #:use-module (srfi srfi-1))
+  #:use-module (srfi srfi-1)
+  #:use-module (ice-9 match))
 
 (define (qemu-patch commit file-name sha256)
   "Return an origin for COMMIT."
@@ -274,15 +275,33 @@ server and embedded PowerPC, and S390 guests.")
     (supported-systems (delete "mips64el-linux" %supported-systems))))
 
 (define-public qemu-minimal
-  ;; QEMU without GUI support.
+  ;; QEMU without GUI support, only supporting the host's architecture
   (package (inherit qemu)
     (name "qemu-minimal")
-    (synopsis "Machine emulator and virtualizer (without GUI)")
+    (synopsis
+     "Machine emulator and virtualizer (without GUI) for the host architecture")
     (arguments
      (substitute-keyword-arguments (package-arguments qemu)
        ((#:configure-flags _ '(list))
-        ;; Restrict to the targets supported by Guix.
-        ''("--target-list=i386-softmmu,x86_64-softmmu,mips64el-softmmu,arm-softmmu,aarch64-softmmu"))))
+        ;; Restrict to the host's architecture.
+        `(,@(match (or (%current-system)
+                       (%current-target-system))
+             ("x86-64-linux"
+              ''("--target-list=i386-softmmu,x86_64-softmmu"))
+             ("i686-linux"
+              ''("--target-list=i386-softmmu"))
+             ("mips64el-linux"
+              ''("--target-list=mips64el-softmmu"))
+             ("aarch64-linux"
+              ''("--target-list=arm-softmmu,aarch64-softmmu"))
+             ("armhf-linux"
+              ''("--target-list=arm-softmmu"))
+             ((or "powerpc64-linux" "powerpc64le-linux")
+              ''("--target-list=ppc-softmmu,ppc64-softmmu"))
+             ("powerpc-linux"
+              ''("--target-list=ppc-softmmu"))
+             (_ ; An empty list actually builds all the targets.
+              ''()))))))
 
     ;; Remove dependencies on optional libraries, notably GUI libraries.
     (native-inputs (fold alist-delete (package-native-inputs qemu)
-- 
2.26.2



[Message part 3 (message/rfc822, inline)]
From: Efraim Flashner <efraim <at> flashner.co.il>
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 41074-done <at> debbugs.gnu.org
Subject: Re: [bug#41074] [PATCH] gnu: qemu-minimal: Only build for the host's
 architecture.
Date: Thu, 14 May 2020 17:24:36 +0300
[Message part 4 (text/plain, inline)]
On Fri, May 08, 2020 at 12:01:22PM +0200, Mathieu Othacehe wrote:
> 
> Hello Efraim,
> 
> > +        `(,@(match (or (%current-system)
> > +                       (%current-target-system))
> 
> If cross-compiling for aarch64, %current-system will be #f and
> %current-target-system will be "aarch64-linux-gnu" which does not match
> anything below.
> 
> I think "system->linux-architecture" could help you here. Otherwise,
> this seems fine.
> 

Thanks for the tip. I integrated the system->linux-architecture code
into qemu-minimal and it works nicely.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 5 years and 65 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.