Set up Spice-Gtk 0.7.4X with usb redirection support on Ubuntu 11.10 ( beta 2)

Following bellow is attempt to reproduce Hans de Goede blog entry
at http://planet.spice-space.org/ on Ubuntu 11.10 just to fix bug with Windows 7 KVM after set up Spice&KVM Server via PPA “Qemu-kvm-0.15.0+noroms(spice enabled), Spice Server&Client 0.9.1, Spice-Gtk-0.7-2(via Debian)” ([2]). I’ve removed from local system all libspice_* packages after theirs install from mentioned PPA with intent to build and install new Spice-Gtk-0.7 system, based on the most recent snapshot of git://anongit.freedesktop.org/spice/spice-gtk, working stable with Spice 0.9.1. For bug description view [FFE] Please sync spice-gtk (0.7-2) from debian unstable (main) ([3]) #21. Second part of this post is describing Ubuntu PPA with packaged versions of pre (1.0.9) libusb, usbredir 0.3.1 and Spice-Gtk-0.7.4X has been built up on mentioned above git repository with GTK2

$ sudo apt-get install libpixman-1-dev libssl-dev \
libjpeg62-dev libgtk2.0-dev libgtk-3-dev \
libglib2.0-dev libcairo2-dev libpulse-dev \
libsasl2-dev libtext-csv-perl python-pyparsing \
python-gtk2-dev gobject-introspection \
libgirepository1.0-dev libcurl4-gnutls-dev \
librsvg2-dev iasl libaio-dev libasound2-dev \
libgnutls-dev libncurses5-dev libpci-dev \
libsdl1.2-dev libx11-dev nasm perl quilt \
sysv-rc uuid-dev zlib1g-dev \
libgudev-1.0-dev valac libtool gtk-doc-tools

First two steps per Hans de Goede ([1])

*******
Step 1
*******

git clone git://people.freedesktop.org/~jwrdegoede/libusb
cd libusb
git checkout -B for109 origin/for109
./autogen.sh
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
make -j2
sudo make install

ln -s /usr/lib/x86_64-linux-gnu/libusb-1.0.so /usr/lib/libusb.so

*******
Step 2
*******

tar xvfj usbredir-0.3.1.tar.bz2
cd usbredir-0.3.1
make -j2 PREFIX=/usr LIBDIR=/usr/lib
sudo make PREFIX=/usr LIBDIR=/usr/lib install

*******
Step 3
*******

$ git clone git://anongit.freedesktop.org/spice/spice-gtk
$ cd spice-gtk
$ cat setUSBREDIR.sh
export LIBUSB_CFLAGS="-I/usr/include/libusb-1.0"
export LIBUSB_LIBS="-L/usr/lib/x86_64-linux-gnu -lusb-1.0"
export LIBUSBREDIRHOST_CFLAGS="-I/usr/include"
export LIBUSBREDIRHOST_LIBS="-L/usr/lib -lusbredirhost"
$. ./setUSBREDIR.sh
$ env |grep LIB
LIBUSBREDIRHOST_LIBS=-L/usr/lib -lusbredirhost
LIBUSBREDIRHOST_CFLAGS=-I/usr/include
LIBUSB_LIBS=-L/usr/lib/x86_64-linux-gnu -lusb-1.0
LIBUSB_CFLAGS=-I/usr/include/libusb-1.0

Then run

$ ./autogen.sh --enable-vala --disable-smartcard \
--enable-introspection --enable-werror=no \
--with-gtk="2.0" --prefix=/usr --libdir=/usr/lib

autoreconf: Entering directory `.’
autoreconf: running: autopoint –force
Copying file po/Makefile.in.in
autoreconf: running: aclocal –force -I m4
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize –install –copy –force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux’.
libtoolize: copying file `build-aux/config.guess’
libtoolize: copying file `build-aux/config.sub’
libtoolize: copying file `build-aux/install-sh’
libtoolize: copying file `build-aux/ltmain.sh’
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4′.
libtoolize: copying file `m4/libtool.m4′
libtoolize: copying file `m4/ltoptions.m4′
libtoolize: copying file `m4/ltsugar.m4′
libtoolize: copying file `m4/ltversion.m4′
libtoolize: copying file `m4/lt~obsolete.m4′
autoreconf: running: /usr/bin/autoconf –force
autoreconf: running: /usr/bin/autoheader –force
autoreconf: running: automake –add-missing –copy –force-missing
autoreconf: Leaving directory `.’
You should update your ‘aclocal.m4’ by running aclocal.
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
checking how to print strings… printf
checking for style of include used by make… GNU
checking for gcc… gcc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… no
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking dependency style of gcc… gcc3
checking for a sed that does not truncate output… /bin/sed
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for fgrep… /bin/grep -F
checking for ld used by gcc… /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld… yes
checking for BSD- or MS-compatible name lister (nm)… /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface… BSD nm
checking whether ln -s works… yes
checking the maximum length of command line arguments… 1572864
checking whether the shell understands some XSI constructs… yes
checking whether the shell understands “+=”… yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format… func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format… func_convert_file_noop
checking for /usr/bin/ld option to reload object files… -r
checking for objdump… objdump
checking how to recognize dependent libraries… pass_all
checking for dlltool… no
checking how to associate runtime and link libraries… printf %s\n
checking for ar… ar
checking for archiver @FILE support… @
checking for strip… strip
checking for ranlib… ranlib
checking command to parse /usr/bin/nm -B output from gcc object… ok
checking for sysroot… no
checking for mt… mt
checking if mt is a manifest tool… no
checking how to run the C preprocessor… gcc -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking for dlfcn.h… yes
checking for objdir… .libs
checking if gcc supports -fno-rtti -fno-exceptions… no
checking for gcc option to produce PIC… -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works… yes
checking if gcc static flag -static works… yes
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.o… (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries… yes
checking whether -lc should be explicitly linked in… no
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking whether to enable maintainer-specific portions of Makefiles… yes
checking whether NLS is requested… yes
checking for intltool >= 0.40.0… 0.41.1 found
checking for intltool-update… /usr/bin/intltool-update
checking for intltool-merge… /usr/bin/intltool-merge
checking for intltool-extract… /usr/bin/intltool-extract
checking for xgettext… /usr/bin/xgettext
checking for msgmerge… /usr/bin/msgmerge
checking for msgfmt… /usr/bin/msgfmt
checking for gmsgfmt… /usr/bin/msgfmt
checking for perl… /usr/bin/perl
checking for perl >= 5.8.1… 5.12.4
checking for XML::Parser… ok
checking for msgfmt… (cached) /usr/bin/msgfmt
checking for gmsgfmt… (cached) /usr/bin/msgfmt
checking for xgettext… (cached) /usr/bin/xgettext
checking for msgmerge… (cached) /usr/bin/msgmerge
checking for ld used by GCC… /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld… yes
checking for shared library run path origin… done
checking for CFPreferencesCopyAppValue… no
checking for CFLocaleCopyCurrent… no
checking for GNU gettext in libc… yes
checking whether to use NLS… yes
checking where the gettext function comes from… libc
checking for pkg-config… /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0… yes
checking for gtkdoc-check… /usr/bin/gtkdoc-check
checking for gtkdoc-rebase… /usr/bin/gtkdoc-rebase
checking for gtkdoc-mkpdf… /usr/bin/gtkdoc-mkpdf
checking whether to build gtk-doc documentation… no
checking for gcc… (cached) gcc
checking whether we are using the GNU C compiler… (cached) yes
checking whether gcc accepts -g… (cached) yes
checking for gcc option to accept ISO C89… (cached) none needed
checking dependency style of gcc… (cached) gcc3
checking for gcc option to accept ISO C99… -std=gnu99
checking whether gcc -std=gnu99 and cc understand -c and -o together… yes
checking whether byte ordering is bigendian… no
checking for python2… no
checking for python… /usr/bin/python
checking if -Wl,–version-script works… yes
checking for native Win32… no
checking sys/ipc.h usability… yes
checking sys/ipc.h presence… yes
checking for sys/ipc.h… yes
checking sys/shm.h usability… yes
checking sys/shm.h presence… yes
checking for sys/shm.h… yes
checking sys/socket.h usability… yes
checking sys/socket.h presence… yes
checking for sys/socket.h… yes
checking netinet/in.h usability… yes
checking netinet/in.h presence… yes
checking for netinet/in.h… yes
checking arpa/inet.h usability… yes
checking arpa/inet.h presence… yes
checking for arpa/inet.h… yes
checking for PROTOCOL… yes
checking for PIXMAN… yes
checking for CELT051… yes
checking for SSL… yes
checking sasl/sasl.h usability… yes
checking sasl/sasl.h presence… yes
checking for sasl/sasl.h… yes
checking for sasl_client_init in -lsasl2… yes
checking which gtk+ version to compile against… 2.0
checking for GTK… yes
checking for XRANDR… yes
checking X11/XKBlib.h usability… yes
checking X11/XKBlib.h presence… yes
checking for X11/XKBlib.h… yes
checking What rendering backend to use….. cairo
checking for GLIB2… yes
checking for GOBJECT2… yes
checking for GIO… yes
checking for CAIRO… yes
checking for GTHREAD… yes
checking for PULSE… yes
checking for jpeg_destroy_decompress in -ljpeg… yes
checking for jpeglib.h…
checking for deflate in -lz… yes
checking for GUDEV… yes
checking for LIBUSB… yes
checking for LIBUSBREDIRHOST… yes
checking for makecontext… yes
checking for swapcontext… yes
checking for getcontext… yes
checking for GOBJECT_INTROSPECTION… yes
checking for gobject-introspection… yes
checking for valac… /usr/bin/valac
checking /usr/bin/valac is at least version 0.11.7… yes
checking for PYGTK… yes
checking for python version… 2.7
checking for python platform… linux2
checking for python script directory… ${prefix}/lib/python2.7/dist-packages
checking for python extension module directory… ${exec_prefix}/lib/python2.7/dist-packages
checking whether /usr/bin/python version >= 2.0… yes
checking for headers required to compile python extensions… found
checking for supported warning flags…
checking whether gcc -std=gnu99 supports -Wall… yes
checking whether gcc -std=gnu99 supports -Wno-sign-compare… yes
checking whether gcc -std=gnu99 supports -Wno-deprecated-declarations… yes
checking which warning flags were supported… -Wall -Wno-sign-compare -Wno-deprecated-declarations
configure: creating ./config.status
config.status: creating Makefile
config.status: creating spice-client-glib-2.0.pc
config.status: creating spice-client-gtk-2.0.pc
config.status: creating spice-client-gtk-3.0.pc
config.status: creating spice-controller.pc
config.status: creating common/Makefile
config.status: creating common/win/Makefile
config.status: creating common/win/my_getopt-1.5/Makefile
config.status: creating data/Makefile
config.status: creating data/spicy.desktop.in
config.status: creating data/spicy.nsis
config.status: creating po/Makefile.in
config.status: creating python_modules/Makefile
config.status: creating gtk/Makefile
config.status: creating gtk/controller/Makefile
config.status: creating doc/Makefile
config.status: creating doc/reference/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing po/stamp-it commands
configure:

Spice-Gtk 0.7.44-3867-dirty
==============

prefix: /usr
c compiler: gcc -std=gnu99

Coroutine: ucontext
Audio: pulse
Target: Unix
SASL support: yes
Smartcard support: no
USB redirection support: yes
Gtk: 2.0

Now type ‘make’ to build spice-gtk

$ make -j3
$ sudo make install



Ubuntu Oneiric’s packaged version version of Spice-Gtk-0.7.4X is built up on current snapshot of git://anongit.freedesktop.org/spice/spice-gtk with GTK2 and GTK3 as two builds.Libusb-1.0-2:1.0.9-3ubuntu9 is built up on git://people.freedesktop.org/~jwrdegoede/libusb (pre 1.0.9). Usbredir-0.3.1-1ubuntu5 is built up on official release usbredir-0.3.1.tar.gz. Of course no usb redirection really happens due to version of Qemu-kvm 0.15.0,compare with series of qxl and usbredir patches on top of 0.15.0 in Fedora 16. However, this version of Spice-Gtk >= 0.7.39 and should work stable with Spice 0.9.1

GTK2 build debian/rules contains :-

override_dh_auto_configure:
./autogen.sh \
--enable-vala --disable-smartcard \
--enable-introspection --enable-werror=no \
--with-gtk="2.0" --prefix=/usr --libdir=/usr/lib \
LIBUSB_CFLAGS=-I/usr/include/libusb-1.0 \
LIBUSB_LIBS='-L/usr/lib/*-linux-gnu -lusb-1.0' \
LIBUSBREDIRHOST_CFLAGS=-I/usr/include \
LIBUSBREDIRHOST_LIBS='-L/usr/lib -lusbredirhost'

GTK3 build debian/rules contains :-

override_dh_auto_configure:
./autogen.sh \
--enable-vala --disable-smartcard \
--enable-introspection --enable-werror=no \
--with-gtk="3.0" --prefix=/usr --libdir=/usr/lib \
LIBUSB_CFLAGS=-I/usr/include/libusb-1.0 \
LIBUSB_LIBS='-L/usr/lib/*-linux-gnu -lusb-1.0' \
LIBUSBREDIRHOST_CFLAGS=-I/usr/include \
LIBUSBREDIRHOST_LIBS='-L/usr/lib -lusbredirhost'

*****************************
To install packages from PPA
*****************************
$ sudo add-apt-repository ppa:bderzhavets/lib-usbredir3
$ sudo apt-get update
$ sudo apt-get install qemu-kvm qemu qemu-common \
spice-client seabios \
libusb-1.0-0 libusb-1.0-0-dev \
libusbredir libusbredir-dev \
libspice-protocol-dev libspice-server-dev \
libspice-client-glib-2.0-4 libspice-client-glib-2.0-dev \
libspice-client-gtk-2.0-1 libspice-client-gtk-2.0-dev \
libspice-client-gtk-3.0-1 libspice-client-gtk-3.0-dev \
python-spice-client-gtk spice-client-gtk

To install Libvirt and virtinst tools :-

$ sudo apt-get install virtinst virt-manager virt-viewer

You might have to disable apparmor profile for libvirtd

$ sudo ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
$ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
$ sudo adduser $USER kvm

Link to PPA
References
1.http://planet.spice-space.org/
2.https://launchpad.net/~bderzhavets/+archive/spice-test3
3.https://bugs.launchpad.net/ubuntu/oneiric/+bug/828785

Leave a comment