Patchwork [3/5] gnu: qemu: Enable spice support.

login
register
mail settings
Submitter David Craven
Date Aug. 2, 2016, 1:45 p.m.
Message ID <20160802134531.19272-3-david@craven.ch>
Download mbox | patch
Permalink /patch/14243/
State New
Headers show

Comments

David Craven - Aug. 2, 2016, 1:45 p.m.
* gnu/packages/qemu.scm (qemu)[inputs]: Add SPICE and VIRGLRENDERER.
  [arguments]: Pass --enable-spice.
---
 gnu/packages/qemu.scm | 4 ++++
 1 file changed, 4 insertions(+)
Leo Famulari - Aug. 5, 2016, 6:33 p.m.
On Tue, Aug 02, 2016 at 03:45:29PM +0200, David Craven wrote:
> * gnu/packages/qemu.scm (qemu)[inputs]: Add SPICE and VIRGLRENDERER.
>   [arguments]: Pass --enable-spice.

Do spice and virglrenderer belong in qemu-minimal, or should they be
removed from it?

> ---
>  gnu/packages/qemu.scm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/gnu/packages/qemu.scm b/gnu/packages/qemu.scm
> index 6b5a41b..97642af 100644
> --- a/gnu/packages/qemu.scm
> +++ b/gnu/packages/qemu.scm
> @@ -33,6 +33,7 @@
>    #:use-module (gnu packages pkg-config)
>    #:use-module (gnu packages python)
>    #:use-module (gnu packages sdl)
> +  #:use-module (gnu packages spice)
>    #:use-module (gnu packages texinfo)
>    #:use-module (gnu packages xdisorg)
>    #:use-module (guix build-system gnu)
> @@ -91,6 +92,7 @@
>                           ,(string-append "--cc=" (which "gcc"))
>                           "--disable-debug-info" ; save build space
>                           "--enable-virtfs"      ; just to be sure
> +                         "--enable-spice"
>                           ,(string-append "--prefix=" out)
>                           ,@configure-flags))))))
>           (add-after 'install 'install-info
> @@ -132,8 +134,10 @@
>         ;; ("pciutils" ,pciutils)
>         ("pixman" ,pixman)
>         ("sdl" ,sdl)
> +       ("spice" ,spice)
>         ("util-linux" ,util-linux)
>         ;; ("vde2" ,vde2)
> +       ("virglrenderer" ,virglrenderer)
>         ("zlib" ,zlib)))
>      (native-inputs `(("glib:bin" ,glib "bin") ; gtester, etc.
>                       ("perl" ,perl)
> -- 
> 2.9.0
>
Mark H Weaver - Aug. 6, 2016, 2 a.m.
David Craven <david@craven.ch> writes:
> * gnu/packages/qemu.scm (qemu)[inputs]: Add SPICE and VIRGLRENDERER.
>   [arguments]: Pass --enable-spice.

Unfortunately, 'spice' only builds successfully on x86_64, so with this
patch, i686 and armhf lose 'qemu'.

One problem is that 'spice' depends on 'usbredir', and 'usbredir' only
builds successfully on x86_64.

     Mark
David Craven - Aug. 6, 2016, 8:53 a.m.
> Unfortunately, 'spice' only builds successfully on x86_64, so with this
> patch, i686 and armhf lose 'qemu'.

'usbredir' is needed by 'spice-gtk' which is only needed to run the tests
for spice. This can be fixed by removing the automated tests configure-flag
and removing spice-gtk from the dependencies on i686.

If supported-systems is set correctly, will guix try to build without
the required
package? This is useful in case the dependency is only optional.

Trying to build with guix build --system=armhf-linux tells me that I'm
x86-64-linux and the same for --system=mipsel-linux. It would be
nice if guix build would spin up a qemu instance in this case. It will
take me a while to test.
David Craven - Aug. 6, 2016, 11:12 a.m.
> Trying to build with guix build --system=armhf-linux tells me that I'm
> x86-64-linux and the same for --system=mipsel-linux. It would be
> nice if guix build would spin up a qemu instance in this case. It will
> take me a while to test.

Before reinventing the wheel or deploying my own hydra build farm
(or cuirass), is there a simple way to build a package for all supported
platforms?

> If supported-systems is set correctly, will guix try to build without
> the required package? This is useful in case the dependency is
> only optional.

It looks like guix ignores the supported-systems property and
doesn't make use of it anywhere. Say it doesn't prevent building
a package on i686-linux when only x86_64-linux is in the list.
Mark H Weaver - Aug. 6, 2016, 4:07 p.m.
Hi David,

David Craven <david@craven.ch> writes:

>> Unfortunately, 'spice' only builds successfully on x86_64, so with this
>> patch, i686 and armhf lose 'qemu'.
>
> 'usbredir' is needed by 'spice-gtk' which is only needed to run the tests
> for spice. This can be fixed by removing the automated tests configure-flag
> and removing spice-gtk from the dependencies on i686.

I would prefer to fix 'usbredir' on i686.  The same error occurs on all
non-x86_64 systems, so if you can fix it on i686, there's a good chance
it will work on mips64el and armhf as well.  Hydra will check that.

In any case, i686 is the most important for now.  You can see the failed
build log via this link:

  https://hydra.gnu.org/job/gnu/master/usbredir-0.7.1.i686-linux

Here's the relevant excerpt:

--8<---------------cut here---------------start------------->8---
  CC       libusbredirhost_la-usbredirhost.lo
usbredirhost.c: In function ‘usbredirhost_can_write_iso_package’:
usbredirhost.c:1023:13: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format=]
             DEBUG("START dropping isoc packets %lu buffer > %lu hi threshold",
             ^
usbredirhost.c:1023:13: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Werror=format=]
usbredirhost.c:1028:13: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format=]
             DEBUG("STOP dropping isoc packets %lu buffer < %lu low threshold",
             ^
usbredirhost.c:1028:13: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Werror=format=]
usbredirhost.c: In function ‘usbredirhost_set_iso_threshold’:
usbredirhost.c:1162:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t’ [-Werror=format=]
     DEBUG("higher threshold is %lu bytes | lower threshold is %lu bytes",
     ^
usbredirhost.c:1162:5: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64_t’ [-Werror=format=]
cc1: all warnings being treated as errors
--8<---------------cut here---------------end--------------->8---

> If supported-systems is set correctly, will guix try to build without
> the required package?

No.  A package is considered "unsupported" on a given architecture if
any of its transitive inputs are unsupported there.  See
'package-transitive-supported-systems' and 'supported-package?'
in guix/packages.scm.

> Trying to build with guix build --system=armhf-linux tells me that I'm
> x86-64-linux and the same for --system=mipsel-linux. It would be
> nice if guix build would spin up a qemu instance in this case.

I agree that would be very nice, but no one has implemented it yet.

> Before reinventing the wheel or deploying my own hydra build farm
> (or cuirass), is there a simple way to build a package for all supported
> platforms?

No, it currently requires having access to a system of the desired
architecture running Guix.  If you have this, then you can arrange for
builds to be automatically "offloaded" to that machine as needed.  See
section 2.4.2 (Using the Offload Facility) in the Guix manual for
details.

Note that if GuixSD included support for mips64el or armhf running qemu,
then you could use "guix system vm" to create a virtual system of the
desired system, and then configure Guix to offload builds to it, and
this could be automated.  However, at present, you'd need to install a
different distro within qemu, install Guix within it, and then set up
offloading manually.

Anyway, it is always possible to build for i686 on an x86_64 system
without offloading, and fortunately that should be sufficient to make
progress on this issue.

> It looks like guix ignores the supported-systems property and
> doesn't make use of it anywhere.

It's used to determine which build jobs are attempted on Hydra, affects
the output of "guix package --list-available", and maybe a few other
things.

> Say it doesn't prevent building a package on i686-linux when only
> x86_64-linux is in the list.

Yes, Guix will attempt a build if you ask it to, even if the package is
listed as unsupported on your system.

Thanks for your efforts!

     Regards,
       Mark

Patch

diff --git a/gnu/packages/qemu.scm b/gnu/packages/qemu.scm
index 6b5a41b..97642af 100644
--- a/gnu/packages/qemu.scm
+++ b/gnu/packages/qemu.scm
@@ -33,6 +33,7 @@ 
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages sdl)
+  #:use-module (gnu packages spice)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages xdisorg)
   #:use-module (guix build-system gnu)
@@ -91,6 +92,7 @@ 
                          ,(string-append "--cc=" (which "gcc"))
                          "--disable-debug-info" ; save build space
                          "--enable-virtfs"      ; just to be sure
+                         "--enable-spice"
                          ,(string-append "--prefix=" out)
                          ,@configure-flags))))))
          (add-after 'install 'install-info
@@ -132,8 +134,10 @@ 
        ;; ("pciutils" ,pciutils)
        ("pixman" ,pixman)
        ("sdl" ,sdl)
+       ("spice" ,spice)
        ("util-linux" ,util-linux)
        ;; ("vde2" ,vde2)
+       ("virglrenderer" ,virglrenderer)
        ("zlib" ,zlib)))
     (native-inputs `(("glib:bin" ,glib "bin") ; gtester, etc.
                      ("perl" ,perl)