Windows下编译spice客户端

时间:2022-11-01 08:31:11

目录

 

1 安装msys2

1.1 更新软件包

pacman -Syu
path suffx desc
mingw64\include .h
mingw64\lib .dll .a
mingw64\bin .exe .dll
mingw64\etc
mingw64\libexec .exe
mingw64\share

1.2 安装开发工具

pacman -S  base-devel

   1) asciidoc  2) autoconf  3) autoconf2.13  4) autogen  5) automake-wrapper
   6) automake1.10  7) automake1.11  8) automake1.12  9) automake1.13
   10) automake1.14  11) automake1.15  12) automake1.16  13) automake1.6
   14) automake1.7  15) automake1.8  16) automake1.9  17) bison  18) diffstat
   19) diffutils  20) dos2unix  21) file  22) flex  23) gawk  24) gdb
   25) gettext  26) gettext-devel  27) gperf  28) grep  29) groff  30) help2man
   31) intltool  32) lemon  33) libtool  34) libunrar  35) libunrar-devel
   36) m4  37) make  38) man-db  39) pacman  40) pactoys-git  41) patch
   42) patchutils  43) perl  44) pkg-config  45) pkgfile  46) quilt  47) rcs
   48) scons  49) sed  50) swig  51) texinfo  52) texinfo-tex  53) ttyrec
   54) unrar  55) wget  56) xmlto

1.3 安装工具链

pacman -S  mingw-w64-x86_64-toolchain
or
pacman -S mingw-w64-i686-toolchain

   1) mingw-w64-x86_64-binutils  2) mingw-w64-x86_64-crt-git
   3) mingw-w64-x86_64-gcc  4) mingw-w64-x86_64-gcc-ada
   5) mingw-w64-x86_64-gcc-fortran  6) mingw-w64-x86_64-gcc-libgfortran
   7) mingw-w64-x86_64-gcc-libs  8) mingw-w64-x86_64-gcc-objc
   9) mingw-w64-x86_64-gdb  10) mingw-w64-x86_64-headers-git
   11) mingw-w64-x86_64-libmangle-git  12) mingw-w64-x86_64-libwinpthread-git
   13) mingw-w64-x86_64-make  14) mingw-w64-x86_64-pkg-config
   15) mingw-w64-x86_64-tools-git  16) mingw-w64-x86_64-winpthreads-git
   17) mingw-w64-x86_64-winstorecompat-git

2 编译remote-viewer

2.1 编译spice-protocol

tar -jxvf spice-protocol-0.12.13.tar.bz2
cd spice-protocol-0.12.13
./configure
make 
make install

# 默认安装在mingw64
/usr/bin/mkdir -p '/mingw64/include/spice-1/spice
/usr/bin/install -c -m 644 spice-protocol.pc '/mingw64/share/pkgconfig

2.2 安装usbredir

pacman -S mingw-w64-x86_64-usbredir
软件包 (2) mingw-w64-x86_64-libusb-1.0.22-1  mingw-w64-x86_64-usbredir-0.8.0-1

如果需要 libusb-1.0.21 + usbredir-0.7.1,分别下载源码,然后make install。

2.3 安装gstreamer

pacman -S \
mingw-w64-x86_64-gst-libav \
mingw-w64-x86_64-gst-plugins-bad \
mingw-w64-x86_64-gst-plugins-base \
mingw-w64-x86_64-gst-plugins-good \
mingw-w64-x86_64-gst-plugins-ugly \
mingw-w64-x86_64-gstreamer

2.4 编译spice-gtk

$ pacman -Ss spice-gtk
mingw64/mingw-w64-x86_64-spice-gtk 0.35-3
    GTK3 widget for SPICE clients (mingw-w64)

$ pacman -S mingw-w64-x86_64-spice-gtk
软件包 (29) mingw-w64-x86_64-cyrus-sasl-2.1.27.rc8-1  mingw-w64-x86_64-dbus-1.12.12-1  mingw-w64-x86_64-dbus-glib-0.110-1  mingw-w64-x86_64-devil-1.8.0-4  mingw-w64-x86_64-gdbm-1.18.1-1
            mingw-w64-x86_64-gobject-introspection-1.58.2-1  mingw-w64-x86_64-gobject-introspection-runtime-1.58.2-1  mingw-w64-x86_64-graphviz-2.40.1-5  mingw-w64-x86_64-gtk2-2.24.32-3
            mingw-w64-x86_64-gtkglext-1.2.0-3  mingw-w64-x86_64-icu-62.1-1  mingw-w64-x86_64-libgd-2.2.5-1  mingw-w64-x86_64-libglade-2.6.4-5  mingw-w64-x86_64-libimagequant-2.12.2-1  mingw-w64-x86_64-libmng-2.0.3-4
            mingw-w64-x86_64-libsquish-1.15-1  mingw-w64-x86_64-lz4-1.8.3-1  mingw-w64-x86_64-nspr-4.20-1  mingw-w64-x86_64-nss-3.41-1  mingw-w64-x86_64-phodav-2.2-1  mingw-w64-x86_64-poppler-0.72.0-1
            mingw-w64-x86_64-poppler-data-0.4.9-1  mingw-w64-x86_64-python3-beaker-1.10.0-2  mingw-w64-x86_64-python3-mako-1.0.7-3  mingw-w64-x86_64-python3-markupsafe-1.1.0-1
            mingw-w64-x86_64-spice-protocol-0.12.14-1  mingw-w64-x86_64-vala-0.42.4-1  mingw-w64-x86_64-xpm-nox-4.2.0-5  mingw-w64-x86_64-spice-gtk-0.35-3

msys2中有0.35-3,这里选择手动编译0.34

2.4.1 安装pixman
pacman -S mingw-w64-x86_64-pixman
软件包 (1) mingw-w64-x86_64-pixman-0.36.0-1
2.4.2 安装gtk3
pacman -S mingw-w64-x86_64-gtk3
软件包 (30) mingw-w64-x86_64-adwaita-icon-theme-3.30.1-1
            mingw-w64-x86_64-atk-2.30.0-1  mingw-w64-x86_64-cairo-1.16.0-1
            mingw-w64-x86_64-fontconfig-2.13.1-1
            mingw-w64-x86_64-freeglut-3.0.0-4
            mingw-w64-x86_64-freetype-2.9.1-1  mingw-w64-x86_64-fribidi-1.0.5-1
            mingw-w64-x86_64-gdk-pixbuf2-2.38.0-1
            mingw-w64-x86_64-glib2-2.58.1-1
            mingw-w64-x86_64-graphite2-1.3.12-1
            mingw-w64-x86_64-harfbuzz-2.2.0-1
            mingw-w64-x86_64-hicolor-icon-theme-0.17-1
            mingw-w64-x86_64-jasper-2.0.14-1
            mingw-w64-x86_64-json-glib-1.4.4-1
            mingw-w64-x86_64-libcroco-0.6.12-1
            mingw-w64-x86_64-libdatrie-0.2.12-1
            mingw-w64-x86_64-libepoxy-1.5.3-1
            mingw-w64-x86_64-libjpeg-turbo-2.0.1-1
            mingw-w64-x86_64-libpng-1.6.35-1
            mingw-w64-x86_64-librsvg-2.40.20-1
            mingw-w64-x86_64-libthai-0.1.28-2
            mingw-w64-x86_64-libtiff-4.0.10-1  mingw-w64-x86_64-libxml2-2.9.8-1
            mingw-w64-x86_64-lzo2-2.10-1  mingw-w64-x86_64-pango-1.42.4-2
            mingw-w64-x86_64-pcre-8.42-1
            mingw-w64-x86_64-shared-mime-info-1.10-1
            mingw-w64-x86_64-wineditline-2.205-1  mingw-w64-x86_64-zstd-1.3.7-1
            mingw-w64-x86_64-gtk3-3.24.1-1
2.4.3 编译spice-gtk
tar -jxvf spice-gtk-0.34.tar.bz2
cd spice-gtk-0.34
./configure

configure:

        Spice-Gtk 0.34
        ==============

        prefix:                   /mingw64
        c compiler:               gcc
        Target:                   Windows

        Gtk:                      3.0
        Coroutine:                winfiber
        PulseAudio:               no
        GStreamer Audio:          yes
        GStreamer Video:          yes
        SASL support:             no
        Smartcard support:        no
        USB redirection support:  yes
        DBus:                     yes
        WebDAV support:           no
        LZ4 support:              no

        Now type 'make' to build spice-gtk
 
 make
 make install
2.4.4 执行spicy
$ spicy

(spicy.exe:13972): GStreamer-WARNING **: 14:12:23.666: Failed to load plugin 
'D:\msys64\mingw64\lib\gstreamer-1.0\libgstopencv.dll': 
'D:\msys64\mingw64\lib\gstreamer-1.0\libgstopencv.dll': ▒Ҳ▒▒▒ָ▒▒▒▒ģ▒顣

(spicy.exe:13972): GSpice-CRITICAL **: 14:12:23.701: _usbdk_hider_update: 
assertion 'priv->usbdk_api != NULL' failed

Windows下编译spice客户端

2.5 virt-viewer

2.5.1 安装icoutils
pacman -S mingw-w64-x86_64-icoutils
2.5.2 编译virt-viewer
./configure

configure:
configure:      LIBXML2: -ID:/msys64/mingw64/include/libxml2 -LD:/msys64/mingw64/lib -lxml2
configure:
configure:      LIBVIRT:
configure:
configure:        OVIRT:
configure:

make
make install