当前位置:   article > 正文

银河麒麟(5.4.18-85)源码编译spice-gtk-0.42_deprecation: cmake support for versions <3.17 is d

deprecation: cmake support for versions <3.17 is deprecated since meson 0.62

银河麒麟(5.4.18-85)源码编译spice-gtk-0.42

目录

0 前言

转载请附上原文出处链接

稀土掘金本文链接:https://juejin.cn/spost/7321540587853529122

CSDN本文链接:https://blog.csdn.net/qq_43252610/article/details/135471633

1 编译环境

系统版本:

银河麒麟V10SP1桌面版(2303):Kylin-Desktop-V10-SP1-General-Release-2303-ARM64.iso

uname -a

5.4.18-85-generic #74-KYLINOS SMP Fri Mar 24 11:20:19 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
  • 1
  • 2
  • 3
cat /etc/.kyinfo 

[dist]
name=Kylin
milestone=Desktop-V10-SP1-General-Release-2303
arch=arm64
beta=False
time=2023-04-27 15:46:53
dist_id=Kylin-Desktop-V10-SP1-General-Release-2303-arm64-2023-04-27 15:46:53

[servicekey]
key=0516013

[os]
to=
term=2024-08-01
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

2 下载spice-gtk源码

我这次使用的是spice-gtk-0.42

spice-gtk-0.42:https://gitlab.freedesktop.org/spice/spice-gtk/-/tree/v0.42

3 编译与安装

3.1 apt软件源检查与配置

银河麒麟默认提供了apt的软件源

cat /etc/apt/sources.list

# 本文件由源管理器管理,会定期检测与修复,请勿修改本文件
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1 main restricted universe multiverse
deb http://archive.kylinos.cn/kylin/KYLIN-ALL 10.1-2303-updates main universe multiverse restricted
deb http://archive2.kylinos.cn/deb/kylin/production/PART-V10-SP1/custom/partner/V10-SP1 default all
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

拉取软件包列表

sudo apt update
  • 1

3.2 安装依赖

3.2.1 apt安装依赖

源码编译spice-gtk需要安装许多依赖

# gtk-3.0
sudo apt install libgtk-3-0 libgtk-3-dev gtk-doc-tools

# ninja
sudo apt install ninja-build

# openssl
sudo apt install openssl libssl-dev

# pulse
sudo apt install libpulse-dev 

# pixman
sudo apt install libpixman-1-dev

# gobject-introspection
sudo apt install gobject-introspection

# zlib
sudo apt install zlib1g-dev

# libjpeg-turbo
sudo apt install libjpeg-turbo8-dev libturbojpeg0-dev

# sasl
sudo apt install libsasl2-dev

# gettext
sudo apt install gettext

# vala
sudo apt install libvala-0.48-dev

# python
sudo apt install python3 python3-pip python3-pyparsing

# gstreamer
sudo apt install gstreamer1.0-tools libgstreamer1.0-dev gstreamer1.0-vaapi gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-vaapi gstreamer1.0-qt5 gstreamer1.0-pulseaudio gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-alsa libgstreamermm-1.0-dev

# json-glib
sudo apt install libjson-glib-dev

# opus
sudo apt install libopus-dev

# cacard
sudo apt install libcacard-dev

# asciidoc
sudo apt install asciidoc

# valgrind
sudo apt install valgrind

# libva
sudo apt install libva-dev

# libphodav
sudo apt install libphodav-2.0-dev

# libusb
sudo apt install libusb-1.0-0-dev libusbredirhost-dev libusbredirparser-dev

# libcap-ng
sudo apt install libcap-ng-dev
kwarg

# libpolkit-gobject
sudo apt install libpolkit-gobject-1-dev

# libacl
sudo apt install libacl1-dev

# vapi
sudo apt install valac gobject-introspection libgirepository1.0-dev

# liblz4
sudo apt install liblz4-dev

# libudev
sudo apt install libudev-dev

# 汇总
sudo apt install libgtk-3-0 libgtk-3-dev gtk-doc-tools ninja-build openssl libssl-dev libpulse-dev libpixman-1-dev gobject-introspection zlib1g-dev libjpeg-turbo8-dev libturbojpeg0-dev libsasl2-dev gettext libvala-0.48-dev python3 python3-pip python3-pyparsing gstreamer1.0-tools libgstreamer1.0-dev gstreamer1.0-vaapi gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-vaapi gstreamer1.0-qt5 gstreamer1.0-pulseaudio gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-alsa libgstreamermm-1.0-dev libjson-glib-dev libopus-dev libcacard-dev asciidoc valgrind libva-dev libphodav-2.0-dev libusb-1.0-0-dev libusbredirhost-dev libusbredirparser-dev libcap-ng-dev libpolkit-gobject-1-dev libacl1-dev valac gobject-introspection libgirepository1.0-dev liblz4-dev libudev-dev
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84

上述命令实际升级了 45 个软件包,新安装了 332 个软件包。

如果存在离线环境需要下载对应的deb安装包进行离线安装,可以执行下面的命令下载对应的包

apt download asciidoc asciidoc-base asciidoc-common asciidoc-dblatex asciidoc-doc autopoint build-essential dblatex dblatex-doc debhelper dh-autoreconf dh-strip-nondeterminism docbook docbook-dsssl docbook-to-man docbook-utils docbook-xml docbook-xsl dvisvgm dwz fonts-gfs-baskerville fonts-gfs-porson fonts-lato fonts-lmodern fonts-texgyre g++ g++-9 gdb gdbserver gir1.2-atspi-2.0 gir1.2-harfbuzz-0.0 gir1.2-json-1.0 gir1.2-soup-2.4 gobject-introspection gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gtk-doc-tools icu-devtools intltool-debian libacl1-dev libalgorithm-c3-perl libapache-pom-java libarchive-cpio-perl libarchive-zip-perl libatk-bridge2.0-dev libatk1.0-dev libatspi2.0-dev libattr1-dev libauthen-sasl-perl libb-hooks-endofscope-perl libb-hooks-op-check-perl libblkid-dev libbrotli-dev libc6-dbg libcacard-dev libcacard0 libcairo-script-interpreter2 libcairo2-dev libcap-ng-dev libclass-c3-perl libclass-c3-xs-perl libclass-data-inheritable-perl libclass-method-modifiers-perl libclass-xsaccessor-perl libcommons-logging-java libcommons-parent-java libdata-optlist-perl libdatrie-dev libdbus-1-dev libdebhelper-perl libdevel-callchecker-perl libdevel-caller-perl libdevel-globaldestruction-perl libdevel-lexalias-perl libdevel-stacktrace-perl libdist-checkconflicts-perl libdynaloader-functions-perl libegl-dev libegl1-mesa-dev libemail-date-format-perl libepoxy-dev libeval-closure-perl libexception-class-perl libexpat1-dev libffi-dev libfile-homedir-perl libfile-stripnondeterminism-perl libfile-which-perl libfontbox-java libfontconfig1-dev libfreetype-dev libfreetype6-dev libfribidi-dev libgdk-pixbuf2.0-bin libgdk-pixbuf2.0-dev libgirepository1.0-dev libgl-dev libgl1-mesa-dev libgles-dev libgles1 libgles2-mesa-dev libglib2.0-dev libglib2.0-dev-bin libglibmm-2.4-dev libglvnd-dev libglx-dev libgraphene-1.0-0 libgraphite2-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgstreamermm-1.0-1 libgstreamermm-1.0-dev libgtk-3-dev libharfbuzz-dev libharfbuzz-gobject0 libice-dev libicu-dev libio-socket-ssl-perl libipc-shareable-perl libjpeg-turbo8-dev libjson-glib-dev liblog-dispatch-perl liblog-log4perl-perl libltdl-dev liblz4-dev libmail-sendmail-perl libmailtools-perl libmime-charset-perl libmime-lite-perl libmime-types-perl libmodule-implementation-perl libmodule-runtime-perl libmount-dev libmro-compat-perl libnamespace-autoclean-perl libnamespace-clean-perl libnet-smtp-ssl-perl libnet-ssleay-perl libnspr4-dev libnss3-dev libopengl-dev libopengl0 libopus-dev liborc-0.4-dev liborc-0.4-dev-bin libosp5 libostyle1c2 libpackage-stash-perl libpackage-stash-xs-perl libpadwalker-perl libpango1.0-dev libparams-classify-perl libparams-util-perl libparams-validationcompiler-perl libpcre16-3 libpcre2-32-0 libpcre2-dev libpcre2-posix2 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpdfbox-java libphodav-2.0-0 libphodav-2.0-common libphodav-2.0-dev libpixman-1-dev libpng-dev libpng-tools libpolkit-gobject-1-dev libpsl-dev libptexenc1 libpthread-stubs0-dev libpulse-dev libpython3-dev libpython3.8-dev libreadonly-perl libref-util-perl libref-util-xs-perl librole-tiny-perl libruby2.7 libsasl2-dev libselinux1-dev libsepol1-dev libset-scalar-perl libsgmls-perl libsigc++-2.0-dev libsm-dev libsombok3 libsoup2.4-dev libspecio-perl libsqlite3-dev libssl-dev libstdc++-9-dev libsub-exporter-perl libsub-exporter-progressive-perl libsub-identify-perl libsub-install-perl libsub-name-perl libsub-override-perl libsub-quote-perl libsys-hostname-long-perl libtcl8.6 libteckit0 libtexlua53 libthai-dev libtimedate-perl libtk8.6 libtool libtry-tiny-perl libturbojpeg libturbojpeg0-dev libudev-dev libunicode-linebreak-perl libusb-1.0-0-dev libusb-1.0-doc libusbredirhost-dev libusbredirhost1 libusbredirparser-dev libusbredirparser1 libva-dev libva-glx2 libvala-0.48-0 libvala-0.48-dev libvalacodegen-0.48-0 libvariable-magic-perl libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxkbcommon-dev libxml++2.6-2v5 libxml++2.6-dev libxml2-dev libxml2-utils libxrandr-dev libxrender-dev libxstring-perl libxtst-dev libyaml-tiny-perl libzzip-0-13 lmodern lynx lynx-common ninja-build openjade opensp pango1.0-tools perl-openssl-defaults pkg-config po-debconf preview-latex-style python-pip-whl python3-dev python3-mako python3-markdown python3-packaging python3-pip python3-pygments python3-pyparsing python3-wheel python3.8-dev rake ruby ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby-xmlrpc ruby2.7 rubygems-integration sgml-base sgml-data sgmlspl t1utils tcl tcl8.6 teckit tex-common tex-gyre texlive texlive-base texlive-bibtex-extra texlive-binaries texlive-extra-utils texlive-fonts-recommended texlive-formats-extra texlive-lang-greek texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-pictures texlive-plain-generic texlive-science texlive-xetex tipa tk tk8.6 uuid-dev valac valac-0.48-vapi valac-bin valgrind vim-addon-manager vim-asciidoc wayland-protocols x11proto-core-dev x11proto-dev x11proto-input-dev x11proto-randr-dev x11proto-record-dev x11proto-xext-dev x11proto-xinerama-dev xml-core xmlto xorg-sgml-doctools xsltproc xtrans-dev zlib1g-dev dbus dbus-x11 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0 gstreamer1.0-tools libblkid1 libc-dev-bin libc6 libc6-dev libdbus-1-3 libfreetype6 libglib2.0-0 libglib2.0-bin libgstreamer1.0-0 libgtk-3-0 libgtk-3-common libharfbuzz-icu0 libharfbuzz0b libmount1 libnss3 libpulse-mainloop-glib0 libpulse0 libpulsedsp libpython3.8 libpython3.8-minimal libpython3.8-stdlib libsqlite3-0 libssl1.1 libudev1 libuuid1 libva-drm2 libva-wayland2 libva-x11-2 libva2 libx11-6 libx11-xcb1 libxml2 openssl pulseaudio pulseaudio-module-bluetooth pulseaudio-utils python3.8 python3.8-minimal sqlite3 udev
  • 1
3.2.2 使用pip3安装meson

系统apt源提供的meson版本过低,使用pip3安装meson

详细排查分析见如下章节

4.1 [meson]ERROR: Unknown method “project_source_root” in object.

sudo pip3 install meson
  • 1

此时meson版本为1.3.1

meson -v
1.3.1
  • 1
  • 2

离线环境可以下载whl包进行离线安装

meson:https://pypi.org/simple/meson/meson-1.3.1-py3-none-any.whl

3.2.3 源码编译spice-protocol-0.14.3

详细排查分析见如下章节

4.3 [meson]ERROR: Dependency lookup for spice-protocol with method ‘pkgconfig’ failed: Invalid version, need ‘spice-protocol’ [‘>= 0.14.3’] found ‘0.14.0’.

下载地址:

spice-protocol:https://gitlab.freedesktop.org/spice/spice-protocol/-/tree/v0.14.3

源码编译spice-protocol-0.14.3步骤

# 解压源码包
unzip spice-protocol-v0.14.3.zip

# 进入对应目录
cd spice-protocol-v0.14.3/
  • 1
  • 2
  • 3
  • 4
  • 5

创建build目录并检查依赖

meson setup build

The Meson build system
Version: 1.3.1
Source dir: /home/kylin/spice-protocol-v0.14.3
Build dir: /home/kylin/spice-protocol-v0.14.3/build
Build type: native build
Project name: spice-protocol
Project version: 0.14.3
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/usr/bin/pkg-config) 0.29.1
Build targets in project: 0

Found ninja-1.10.0 at /usr/bin/ninja
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

安装(只有相关的.h头文件,不需要编译)

# 进入build目录
cd build

# 只有相关的.h头文件,不需要编译
# 安装
sudo ninja install

[0/1] Installing files.
Installing /home/kylin/spice-protocol-v0.14.3/spice/barrier.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/end-packed.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/enums.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/ipc_ring.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/macros.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/protocol.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/qxl_dev.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/qxl_windows.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/start-packed.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/stats.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/types.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/vd_agent.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/spice/stream-device.h to /usr/local/include/spice-1/spice
Installing /home/kylin/spice-protocol-v0.14.3/build/meson-private/spice-protocol.pc to /usr/local/share/pkgconfig
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
3.2.4 源码编译cmake-3.21.0

详细排查分析见如下章节

4.4 [meson]DEPRECATION: CMake support for versions ❤️.17 is deprecated since Meson 0.62.0.

下载地址:

cmake:https://github.com/Kitware/CMake/releases/tag/v3.21.0

源码编译cmake-3.21.0步骤

# 解压源码包
tar -xvf cmake-3.21.0.tar.gz

# 进入对应目录
cd cmake-3.21.0/

./bootstrap
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

运行bootstrap工具后,最后会出现如下打印:CMake has bootstrapped. Now run make.

# 编译cmake
make -j8

# 安装
sudo make install
  • 1
  • 2
  • 3
  • 4
  • 5

3.3 源码编译spice-gtk-0.42

解压源码包并进入对应目录

unzip spice-gtk-v0.42.zip

cd spice-gtk-v0.42/
  • 1
  • 2
  • 3

解压subprojects的源码包

详细排查分析见如下章节

4.2 [meson]ERROR: Subproject exists but has no meson.build file.

# 进入subprojects文件夹
cd subprojects

# 删除空目录
rm -rf keycodemapdb
rm -rf spice-common

# 拷贝两个子模块的zip包到subprojects文件夹
# 解压
unzip keycodemapdb-14cdba29ecd7448310fe4ff890e67830b1a40f64.zip
unzip spice-common-58d375e5eadc6fb9e587e99fd81adcb95d01e8d6.zip

# 重命名文件夹
mv keycodemapdb-14cdba29ecd7448310fe4ff890e67830b1a40f64 keycodemapdb
mv spice-common-58d375e5eadc6fb9e587e99fd81adcb95d01e8d6 spice-common
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

修改spice-commonmeson.build文件

详细排查分析见如下章节

4.11 [meson]WARNING: You should add the boolean check kwarg to the run_command call.

cd spice-common

vim meson.build

# cmd = run_command(python, '-c', 'import @0@'.format(module))
# 增加, check : true
cmd = run_command(python, '-c', 'import @0@'.format(module), check : true)

# 返回上两级目录
cd ../../
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

创建usbutils.pc文件

详细排查分析见如下章节

4.10 [meson]Run-time dependency usbutils found: NO (tried pkgconfig and cmake)

sudo vim /usr/lib/aarch64-linux-gnu/pkgconfig/usbutils.pc

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib/aarch64-linux-gnu
includedir=/usr/include
usbids=/var/lib/usbutils/usb.ids

Name: usbutils
Description: usbutils    This is a collection of USB tools for use on Linux and BSD systems\
 to query what type of USB devices are connected to the system. This is to be run on a USB host\
  (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.)

Version: 012
URL: https://github.com/gregkh/usbutils
Requires: libusb-1.0 >= 1.0.14  libudev >= 196
Conflicts:
Libs: -L/usr/lib/aarch64-linux-gnu
Libs.private: -lusb-1.0 -ludev
Cflags:  -g -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wpointer-arith -Wsign-compare -Wchar-subscripts -Wstrict-prototypes -Wshadow -Wformat=2 -Wtype-limits -O2 -I/usr/include/libusb-1.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

更新一下环境变量

source ~/.bashrc
  • 1

创建build目录并检查依赖

meson setup build -Dvalgrind=true

The Meson build system
Version: 1.3.1
Source dir: /home/kylin/spice-gtk-v0.42
Build dir: /home/kylin/spice-gtk-v0.42/build
Build type: native build
Project name: spice-gtk
Project version: UNKNOWN
C compiler for the host machine: cc (gcc 9.3.0 "cc (Ubuntu 9.3.0-10kylin2) 9.3.0")
C linker for the host machine: cc ld.bfd 2.34
Host machine cpu family: aarch64
Host machine cpu: aarch64

Executing subproject spice-common

spice-common| Project name: spice-common
spice-common| Project version: undefined
spice-common| C compiler for the host machine: cc (gcc 9.3.0 "cc (Ubuntu 9.3.0-10kylin2) 9.3.0")
spice-common| C linker for the host machine: cc ld.bfd 2.34
spice-common| Has header "alloca.h" : YES
spice-common| Has header "arpa/inet.h" : YES
spice-common| Has header "dlfcn.h" : YES
spice-common| Has header "inttypes.h" : YES
spice-common| Has header "netinet/in.h" : YES
spice-common| Has header "stdlib.h" : YES
spice-common| Has header "sys/socket.h" : YES
spice-common| Has header "sys/stat.h" : YES
spice-common| Has header "sys/types.h" : YES
spice-common| Has header "unistd.h" : YES
spice-common| Has header "regex.h" : YES
spice-common| Has header "sys/mman.h" : YES
spice-common| Checking for function "alloca" : YES
spice-common| Checking for function "sigaction" : YES
spice-common| Checking for function "drand48" : YES
spice-common| Checking for function "setlinebuf" : YES
spice-common| Library m found: YES
spice-common| Found pkg-config: YES (/usr/bin/pkg-config) 0.29.1
spice-common| Run-time dependency spice-protocol found: YES 0.14.3
spice-common| Run-time dependency glib-2.0 found: YES 2.64.6
spice-common| Run-time dependency pixman-1 found: YES 0.38.4
spice-common| Run-time dependency openssl found: YES 1.1.1f
spice-common| Run-time dependency gio-2.0 found: YES 2.64.6
spice-common| Run-time dependency opus found: YES 1.3.1
spice-common| Program python3 found: YES (/usr/bin/python3)
spice-common| Message: Checking for python module six
spice-common| Message: Checking for python module pyparsing
spice-common| Run-time dependency libcacard found: YES 2.6.1
spice-common| Compiler for C supports arguments -DG_LOG_DOMAIN="Spice": YES
spice-common| Compiler for C supports arguments -Wno-unused-parameter: YES
spice-common| Compiler for C supports arguments -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_38: YES
spice-common| Compiler for C supports arguments -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_38: YES
spice-common| Run-time dependency gdk-pixbuf-2.0 found: YES 2.40.0
spice-common| Program asciidoc found: YES (/usr/bin/asciidoc)
spice-common| Configuring config.h using configuration
spice-common| Build targets in project: 16
spice-common| Subproject spice-common finished.


Executing subproject keycodemapdb

keycodemapdb| Project name: keycodemapdb
keycodemapdb| Project version: undefined
keycodemapdb| Program tools/keymap-gen found: YES (/home/kylin/spice-gtk-v0.42/subprojects/keycodemapdb/tools/keymap-gen)
keycodemapdb| Build targets in project: 16
keycodemapdb| Subproject keycodemapdb finished.

Program tools/keymap-gen found: YES (overridden)
Has header "termios.h" : YES
Has header "X11/XKBlib.h" : YES
Has header "sys/socket.h" : YES (cached)
Has header "sys/types.h" : YES (cached)
Has header "netinet/in.h" : YES (cached)
Has header "arpa/inet.h" : YES (cached)
Has header "valgrind/valgrind.h" : YES
Has header "sys/disk.h" : NO
Has header "epoxy/egl.h" : YES
Checking for function "clearenv" : YES
Checking for function "strtok_r" : YES
Dependency spice-protocol found: YES 0.14.3 (cached)
Dependency glib-2.0 found: YES 2.64.6 (cached)
Dependency gio-2.0 found: YES 2.64.6 (cached)
Run-time dependency gobject-2.0 found: YES 2.64.6
Dependency pixman-1 found: YES 0.38.4 (cached)
Dependency openssl found: YES 1.1.1f (cached)
Run-time dependency libjpeg found: YES 2.0.3
Run-time dependency zlib found: YES 1.2.11
Run-time dependency json-glib-1.0 found: YES 1.4.4
Run-time dependency gio-unix-2.0 found: YES 2.64.6
Dependency opus found: YES 1.3.1 (cached)
Run-time dependency gtk+-3.0 found: YES 3.24.23
Run-time dependency epoxy found: YES 1.5.4
Run-time dependency x11 found: YES 1.6.9
Run-time dependency libva-x11 found: YES 1.7.0
Has header "gtk-3.0/gdk/gdkwayland.h" : YES
Run-time dependency wayland-protocols found: YES 1.20
Build-time dependency wayland-scanner found: YES 1.18.0
Program /usr/bin/wayland-scanner found: YES (/usr/bin/wayland-scanner)
Run-time dependency wayland-server found: YES 1.18.0
Run-time dependency wayland-cursor found: YES 1.18.0
Run-time dependency wayland-client found: YES 1.18.0
Found CMake: /usr/local/bin/cmake (3.21.0)
Run-time dependency libphodav-3.0 found: NO (tried pkgconfig and cmake)
Run-time dependency libphodav-2.0 found: YES 2.4
Run-time dependency libsoup-2.4 found: YES 2.70.0
Run-time dependency gstreamer-1.0 found: YES 1.16.3
Run-time dependency gstreamer-base-1.0 found: YES 1.16.3
Run-time dependency gstreamer-app-1.0 found: YES 1.16.3
Run-time dependency gstreamer-audio-1.0 found: YES 1.16.3
Run-time dependency gstreamer-video-1.0 found: YES 1.16.3
Run-time dependency libusbredirparser-0.5 found: YES 0.8.0
Run-time dependency libusbredirhost found: YES 0.8.0
Run-time dependency libusb-1.0 found: YES 1.0.23
Run-time dependency libcap-ng found: YES 0.7.9
Run-time dependency polkit-gobject-1 found: YES 0.105
Checking for function "acl_get_file" : NO
Library acl found: YES
Checking for function "acl_get_file" with dependency -lacl: YES
Dependency gio-unix-2.0 found: YES 2.64.6 (cached)
Run-time dependency usbutils found: YES 012
Checking for function "makecontext" : YES
Checking for function "swapcontext" : YES
Checking for function "getcontext" : YES
Run-time dependency gobject-introspection-1.0 found: YES 1.64.0
Run-time dependency vapigen found: YES 0.48.3
Run-time dependency liblz4 found: YES 1.9.2
Run-time dependency libsasl2 found: YES 2.1.27
Dependency libcacard found: YES 2.6.1 (cached)
Compiler for C supports arguments -DHAVE_CONFIG_H: YES
Compiler for C supports arguments -DSPICE_COMPILATION: YES
Compiler for C supports arguments -DG_LOG_DOMAIN="GSpice": YES
Compiler for C supports arguments -Wno-sign-compare: YES
Compiler for C supports arguments -Wno-unused-parameter: YES (cached)
Compiler for C supports arguments -Wno-cast-function-type: YES
Compiler for C supports arguments -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_52: YES
Compiler for C supports arguments -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_52: YES
Compiler for C supports arguments -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_22: YES
Compiler for C supports arguments -DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_22: YES
Configuring config.h using configuration
Configuring spice-version.h using configuration
Dependency glib-2.0 found: YES 2.64.6 (cached)
Program /usr/bin/glib-genmarshal found: YES (/usr/bin/glib-genmarshal)
Dependency glib-2.0 found: YES 2.64.6 (cached)
Program /usr/bin/glib-mkenums found: YES (/usr/bin/glib-mkenums)
Dependency glib-2.0 found: YES 2.64.6 (cached)
Program /usr/bin/glib-mkenums found: YES (/usr/bin/glib-mkenums)
Compiler for C supports link arguments -Wl,--version-script=/home/kylin/spice-gtk-v0.42/src/map-file: YES
Dependency gobject-introspection-1.0 found: YES 1.64.0 (cached)
Dependency gobject-introspection-1.0 found: YES 1.64.0 (cached)
Program /usr/bin/g-ir-scanner found: YES (/usr/bin/g-ir-scanner)
Dependency gobject-introspection-1.0 found: YES 1.64.0 (cached)
Program /usr/bin/g-ir-compiler found: YES (/usr/bin/g-ir-compiler)
Dependency glib-2.0 found: YES 2.64.6 (cached)
Program /usr/bin/glib-mkenums found: YES (/usr/bin/glib-mkenums)
Dependency glib-2.0 found: YES 2.64.6 (cached)
Program /usr/bin/glib-mkenums found: YES (/usr/bin/glib-mkenums)
Program gtkdoc-scan found: YES (/usr/bin/gtkdoc-scan)
Dependency glib-2.0 found: YES 2.64.6 (cached)
Dependency gtk+-3.0 found: YES 3.24.23 (cached)
Program gtkdoc-scan found: YES (/usr/bin/gtkdoc-scan)
Program gtkdoc-scangobj found: YES (/usr/bin/gtkdoc-scangobj)
Program gtkdoc-mkdb found: YES (/usr/bin/gtkdoc-mkdb)
Program gtkdoc-mkhtml found: YES (/usr/bin/gtkdoc-mkhtml)
Program gtkdoc-fixxref found: YES (/usr/bin/gtkdoc-fixxref)
Program pod2man found: YES (/usr/bin/pod2man)
Program msgfmt found: YES (/usr/bin/msgfmt)
Program msginit found: YES (/usr/bin/msginit)
Program msgmerge found: YES (/usr/bin/msgmerge)
Program xgettext found: YES (/usr/bin/xgettext)
Program vapigen found: YES (/usr/bin/vapigen)
Program vapigen found: YES (/usr/bin/vapigen)
Build targets in project: 69

spice-gtk UNKNOWN

    prefix                         : /usr/local
    opus                           : YES
    gtk                            : YES
    wayland-protocols              : YES
    webdav                         : YES
    builtin-mjpeg                  : YES
    usbredir                       : YES
    libcap-ng                      : YES
    polkit                         : YES
    pie                            : YES
    usb-acl-helper-dir             : /usr/local/libexec
    usb-ids-path                   : /var/lib/usbutils/usb.ids
    coroutine                      : ucontext
    introspection                  : YES
    vapi                           : YES
    lz4                            : YES
    sasl                           : YES
    smartcard                      : YES
    valgrind                       : YES
    libspice-client-glib.so version: 8.8.2
    libspice-client-gtk.so version : 5.1.1
    gtk_doc                        : YES

  Subprojects
    keycodemapdb                   : YES
    spice-common                   : YES

  User defined options
    valgrind                       : true
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204

进入build目录并编译

cd build

ninja -j8

[13/166] Generating subprojects/spice-common/tests/test_marshallers with a custom command
Wrote subprojects/spice-common/tests/generated_test_marshallers.c
[14/166] Generating subprojects/spice-common/common/client_demarshallers with a custom command
Wrote subprojects/spice-common/common/generated_messages.h
Wrote subprojects/spice-common/common/generated_client_demarshallers.c
[15/166] Generating subprojects/spice-common/tests/test_marshallers_h with a custom command
Wrote subprojects/spice-common/tests/generated_test_marshallers.h
[16/166] Generating subprojects/spice-common/tests/test_demarshallers with a custom command
Wrote /home/kylin/spice-gtk-v0.42/build/subprojects/spice-common/tests/generated_test_messages.h
Wrote subprojects/spice-common/tests/generated_test_demarshallers.c
[17/166] Generating subprojects/spice-common/tests/test_enums_h with a custom command
Wrote subprojects/spice-common/tests/generated_test_enums.h
[22/166] Generating subprojects/spice-common/common/client_marshallers with a custom command
Wrote subprojects/spice-common/common/generated_client_marshallers.c
Wrote subprojects/spice-common/common/generated_client_marshallers.h
[27/166] Generating glib marshaller header src/spice-marshal_h
INFO: Reading ../src/spice-marshal.txt...
[28/166] Generating glib marshaller source src/spice-marshal_c
INFO: Reading ../src/spice-marshal.txt...
[74/166] Compiling C object src/libspice-client-glib-2.0.so.8.8.2.p/continuation.c.o
../src/continuation.c: In function ‘continuation_trampoline’:
../src/continuation.c:55:21: warning: variable ‘arg’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
   55 |  const union cc_arg arg = {{ i0, i1 }};
      |                     ^~~
[163/166] Generating vapi/spice-client-glib-2.0.vapi with a custom command
SpiceClientGLib-2.0.gir:56.7-59.25: warning: Creation method of abstract class cannot be public.
[166/166] Generating vapi/spice-client-gtk-3.0.vapi with a custom command
spice-client-glib-2.0.vapi:9.3-9.14: warning: Creation method of abstract class cannot be public.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32

安装

sudo ninja install
  • 1

此时meson版本为1.3.1

4 问题记录

4.1 [meson]ERROR: Unknown method “project_source_root” in object.

4.1.1 问题定位

完整的打印为

The Meson build system
Version: 0.53.2
Source dir: /home/kylin/spice-gtk-v0.42
Build dir: /home/kylin/spice-gtk-v0.42/build
Build type: native build

meson.build:4:0: ERROR: Unknown method "project_source_root" in object.

A full log can be found at /home/kylin/spice-gtk-v0.42/build/meson-logs/meson-log.txt
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

project_source_root方法在meson0.56.0版本开始支持,详情见meson-0.56.0版本信息:https://mesonbuild.com/Release-notes-for-0-56-0.html

但是该系统apt源自带的meson版本为0.53.2

meson -v
0.53.2
  • 1
  • 2
4.1.2 结论及解决方案

通过apt源安装的meson版本过低,需要升级

使用pip去安装meson

# 安装python-pip
sudo apt install python3 python3-pip

# 安装meson
sudo pip3 install meson
  • 1
  • 2
  • 3
  • 4
  • 5

此时meson版本为1.3.1

meson -v
1.3.1
  • 1
  • 2

4.2 [meson]ERROR: Subproject exists but has no meson.build file.

4.2.1 问题定位

完整的打印为

The Meson build system
Version: 1.3.1
Source dir: /home/kylin/spice-gtk-v0.42
Build dir: /home/kylin/spice-gtk-v0.42/build
Build type: native build
Project name: spice-gtk
Project version: UNKNOWN
C compiler for the host machine: cc (gcc 9.3.0 "cc (Ubuntu 9.3.0-10kylin2) 9.3.0")
C linker for the host machine: cc ld.bfd 2.34
Host machine cpu family: aarch64
Host machine cpu: aarch64

meson.build:43:15: ERROR: Subproject exists but has no meson.build file.

A full log can be found at /home/kylin/spice-gtk-v0.42/build/meson-logs/meson-log.txt
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

查看meson.build文件43行附近

#
# Set up subprojects
#
spice_common = subproject('spice-common',
                          default_options : [
                            'generate-code=client',
                            'spice-protocol-version=@0@'.format(spice_protocol_version),
                          ])
spice_gtk_config_data.merge_from(spice_common.get_variable('spice_common_config_data'))
spice_glib_deps += spice_common.get_variable('spice_common_client_dep')
spice_protocol_version = spice_common.get_variable('spice_protocol_version')
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

发现是在编译subprojects-spice-common时出错了

进入subproject文件夹,发现子模块没有下载

4.2.2 结论及解决方案

源码没有通过git拉取,直接下载的zip包没有包含子模块

下面是spice-gtk-0.42对应的两个子模块

keycodemap:https://gitlab.com/keycodemap/keycodemapdb/-/tree/14cdba29ecd7448310fe4ff890e67830b1a40f64

spice-common:https://gitlab.freedesktop.org/spice/spice-common/-/tree/58d375e5eadc6fb9e587e99fd81adcb95d01e8d6

下载并解压子模块源码到subprojects文件夹中

# 进入subprojects文件夹
cd spice-gtk-v0.42/subprojects

# 删除空目录
rm -rf keycodemapdb
rm -rf spice-common

# 拷贝两个子模块的zip包到subprojects文件夹
# 解压
unzip keycodemapdb-14cdba29ecd7448310fe4ff890e67830b1a40f64.zip
unzip spice-common-58d375e5eadc6fb9e587e99fd81adcb95d01e8d6.zip

# 重命名文件夹
mv keycodemapdb-14cdba29ecd7448310fe4ff890e67830b1a40f64 keycodemapdb
mv spice-common-58d375e5eadc6fb9e587e99fd81adcb95d01e8d6 spice-common
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

4.3 [meson]ERROR: Dependency lookup for spice-protocol with method ‘pkgconfig’ failed: Invalid version, need ‘spice-protocol’ [‘>= 0.14.3’] found ‘0.14.0’.

4.3.1 问题定位

根据打印信息,spice-protocol版本过低

4.3.2 结论及解决方案

spice-protocol版本过低,源码编译spice-protocol0.14.3版本

spice-protocol:https://gitlab.freedesktop.org/spice/spice-protocol/-/tree/v0.14.3

编译和安装步骤在3 编译与安装章节描述

4.4 [meson]DEPRECATION: CMake support for versions ❤️.17 is deprecated since Meson 0.62.0.

4.4.1 问题定位

完整打印为

spice-common| Found CMake: /usr/bin/cmake (3.16.3)
spice-common| DEPRECATION: CMake support for versions <3.17 is deprecated since Meson 0.62.0.
spice-common| |
spice-common| |   However, Meson was only able to find CMake 3.16.3.
spice-common| |
spice-common| |   Support for all CMake versions below 3.17.0 will be removed once
spice-common| |   newer CMake versions are more widely adopted. If you encounter
spice-common| |   any errors please try upgrading CMake to a newer version first.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
4.4.2 结论及解决方案

cmake版本过低,源码编译cmake3.21.0版本

cmake:https://github.com/Kitware/CMake/releases/tag/v3.21.0

编译和安装步骤在3 编译与安装章节描述

4.5 [meson]ERROR: Dependency “json-glib-1.0” not found, tried pkgconfig and cmake

4.5.1 问题定位

根据打印信息,没找到json-glib-1.0的环境

4.5.2 结论及解决方案

安装相关包

sudo apt install libjson-glib-dev
  • 1

4.6 [meson]ERROR: Dependency “gstreamer-app-1.0” not found, tried pkgconfig and cmake

4.6.1 问题定位

根据打印信息,没找到gstreamer-app-1.0的环境

4.6.2 结论及解决方案

安装相关包

sudo apt install libgstreamermm-1.0-dev
  • 1

4.7 [meson]ERROR: C shared or static library ‘acl’ not found

4.7.1 问题定位

根据打印信息,没找到acl的库

4.7.2 结论及解决方案

安装相关包

sudo apt install libacl1-dev
  • 1

4.8 [meson]ERROR: Problem encountered: VAPI support requested without introspection

4.8.1 问题定位

查看附近的打印

Run-time dependency gobject-introspection-1.0 found: NO (tried pkgconfig and cmake)
Run-time dependency vapigen found: YES 0.48.3

meson.build:358:4: ERROR: Problem encountered: VAPI support requested without introspection
  • 1
  • 2
  • 3
  • 4

其实是开启的VAPI的编译选项,但是gobject-introspection-1.0没找到

4.8.2 结论及解决方案

安装相关包gobject-introspection,还需要额外安装libgirepository1.0-dev

sudo apt install gobject-introspection libgirepository1.0-dev
  • 1

4.9 [meson]Has header “sys/disk.h” : NO

4.9.1 问题定位

这个sys/disk.h头文件找不到

一般来说sys文件夹下的头文件,有可能是属于内核开发包里面

用命令查看系统下也确实安装了对应的内核开发包

dpkg -l | grep linux-headers

ii  linux-headers-5.4.18-85                       5.4.18-85.74                        all          Header files related to Linux kernel version 5.4.18
ii  linux-headers-5.4.18-85-generic               5.4.18-85.74                        arm64        Linux kernel headers for version 5.4.18 on ARMv8 SMP
ii  linux-headers-generic                         5.4.18.85.74                        arm64        Generic Linux kernel headers
  • 1
  • 2
  • 3
  • 4
  • 5

看一下源码中这个头文件引用

spice-gtk-v0.42/src/usb-device-cd.c:41

#if defined(__APPLE__) && defined(HAVE_SYS_DISK_H)
#include <sys/disk.h>
#include <fcntl.h>
  • 1
  • 2
  • 3

可以看出这个是mac系统特有的头文件

4.9.2 结论及解决方案

mac系统特有的头文件,没有也没问题

4.10 [meson]Run-time dependency usbutils found: NO (tried pkgconfig and cmake)

4.10.1 问题定位

usbutils 这个包已经安装了,为啥还是找不到呢?

dpkg -l | grep usbutils
ii  usbutils                                      1:012-2kylin1                       arm64        Linux USB utilities
  • 1
  • 2

看一下完整的meson日志:build/meson-logs/meson-log.txt

Determining dependency 'usbutils' with pkg-config executable '/usr/bin/pkg-config'
env[PKG_CONFIG_PATH]: 
env[PKG_CONFIG]: /usr/bin/pkg-config
-----------
Called: `/usr/bin/pkg-config --modversion usbutils` -> 1
stderr:
Package usbutils was not found in the pkg-config search path.
Perhaps you should add the directory containing `usbutils.pc'
to the PKG_CONFIG_PATH environment variable
No package 'usbutils' found
-----------
CMake binary for host machine is cached.
Preliminary CMake check failed. Aborting.
Run-time dependency usbutils found: NO (tried pkgconfig and cmake)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

meson是通过pkg-config来找依赖,pkg-config是通过三方库提供的.pc文件来保存库信息。usbutils包应该提供usbutils.pc的文件。

系统默认的位置为:/usr/lib/aarch64-linux-gnu/pkgconfig/

查看一下usbutils包的安装的文件和路径

dpkg -L usbutils

/.
/usr
/usr/bin
/usr/bin/lsusb
/usr/bin/usb-devices
/usr/bin/usbhid-dump
/usr/bin/usbreset
/usr/share
/usr/share/bug
/usr/share/bug/usbutils
/usr/share/bug/usbutils/presubj
/usr/share/doc
/usr/share/doc/usbutils
/usr/share/doc/usbutils/changelog.Debian.gz
/usr/share/doc/usbutils/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/usb-devices.1.gz
/usr/share/man/man8
/usr/share/man/man8/lsusb.8.gz
/usr/share/man/man8/usbhid-dump.8.gz
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

发现并没有usbutils.pc的文件,那pkg-config自然也找不到。

usbutils是开源的工具,可以尝试进行源码编译,看源码编译的版本是否会生成usbutils.pc的文件。

为了尽量保持版本一致,先查看usbutils的包详细信息及版本

apt-cache show usbutils

Package: usbutils
Architecture: arm64
Version: 1:012-2kylin1
Multi-Arch: foreign
Priority: optional
Section: universe/utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Aurelien Jarno <aurel32@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 312
Depends: libc6 (>= 2.17), libudev1 (>= 196), libusb-1.0-0 (>= 2:1.0.22), usb.ids
Filename: pool/universe/u/usbutils/usbutils_012-2kylin1_arm64.deb
Size: 76876
MD5sum: cdb15d8c0e06ad9f702de1ae25346ed8
SHA1: 443d901154b802d07b1d6b6dcded271a5b0e9e90
SHA256: 73dbff66e6f559416c52ad9e48ffa244843fd4c4bf1d4a1ae3d2f70f1fe5717a
SHA512: e9ddee02cb347089b4b257f3f3eddd830338a257d8d22840364e338ba058f3104f8ea6ada2ed558dc0281ca715f1ab26b77216e5ef95d7c3ad32113756757225
Homepage: https://github.com/gregkh/usbutils
Description: Linux USB utilities
 This package contains the lsusb utility for inspecting the devices
 connected to the USB bus. It shows a graphical representation of the
 devices that are currently plugged in, showing the topology of the
 USB bus. It also displays information on each individual device on
 the bus.
Description-md5: 928f8c65aee445506dc03a844a66adac
cert_subject_cn: 麒麟软件有限公司
cert_subject_o: 麒麟软件有限公司
cert_subject_ou: DS120G321040301
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

下载usbutils-012的源码包

usbutils:https://github.com/gregkh/usbutils/releases/tag/v012

源码编译usbutils-012

# 安装依赖
sudo apt install libudev-dev

# 解压源码包
tar -xvf usbutils-012.tar.gz

# 进入目录
cd usbutils-012/

# 运行脚本检查依赖并生成Makefile文件
./autogen.sh

# 编译
make -j8
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

编译完成之后,发现并没有生成usbutils.pc文件

github上面拉取usbutils的源码,看一下提交信息

2017-11-26 03:59:12有一个commit删除了usbutils.pc文件

SHA-1: 9340f4f8aecde252254eb70194c028239de79cff

* Do not create and install usbutils.pc

The usbutils pkgconfig file defines where the usb.ids database is
installed. Given usbutils does not ship with usb.ids and does not
install it anymore, it makes no sense to install such a pkgconfig
anymore. Remove it.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

大概意思是usbutils没有提供usb.ids,但是usbutils.pc中却又指定了usb.ids安装后的位置,他认为这样的usbutils.pc是没有意义的,所以需要去掉该文件。

dpkg-query -S usb.ids

usb.ids: /usr/share/doc/usb.ids/copyright
usb.ids: /usr/share/doc/usb.ids/changelog.Debian.gz
usb.ids: /usr/share/misc/usb.ids
usb.ids: /usr/share/doc/usb.ids
usb.ids: /var/lib/usbutils/usb.ids
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

usb.ids是由usb.ids软件包提供,并不是usbutils

但奇怪的是

2023-04-28 02:59:25有一个commit又增加了usbutils.pc文件

SHA-1: 2996e23d5866d5d692acdba1d68bcaea2808ef71

* Generate usbutils.pc pkgconfig file

Allow buildsystems using pkgconfig to find usb-utils.
I think some library I was using was trying to find usb.ids using pkgconfig.

Signed-off-by: Hannes Weisbach <hannesweisbach@gmail.com>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

大概是很多构建系统从pkgconfig来判断是否安装了usb-utils,没有提供usbutils.pc文件,导致了很多问题,最后还是妥协了,把usbutils.pc加回来了。我编译的spice-gtk-0.42属于比较新的版本,但是用的银河麒麟内核版本不算很新,配套的usbutils版本也比较老,导致出现这个问题。

usbutils-016release版本包含该commit,源码编译该版本,修改生成的usbutils.pc文件拷贝到/usr/lib/aarch64-linux-gnu/pkgconfig/即可。

usbutils-016生成的usbutils.pc文件

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib64
includedir=/usr/include
usbids=${prefix}/share/usb.ids

Name: usbutils
Description: usbutils    This is a collection of USB tools for use on Linux and BSD systems\
 to query what type of USB devices are connected to the system. This is to be run on a USB host\
  (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.)

Version: 016
URL: https://github.com/gregkh/usbutils
Requires: libusb-1.0 >= 1.0.14  libudev >= 196
Conflicts:
Libs: -L/usr/lib64
Libs.private: -lusb-1.0 -ludev
Cflags:  -g -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wpointer-arith -Wsign-compare -Wchar-subscripts -Wstrict-prototypes -Wshadow -Wformat=2 -Wtype-limits -O2 -I/usr/include/libusb-1.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

修改后的usbutils.pc文件

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib/aarch64-linux-gnu
includedir=/usr/include
usbids=/var/lib/usbutils/usb.ids

Name: usbutils
Description: usbutils    This is a collection of USB tools for use on Linux and BSD systems\
 to query what type of USB devices are connected to the system. This is to be run on a USB host\
  (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.)

Version: 012
URL: https://github.com/gregkh/usbutils
Requires: libusb-1.0 >= 1.0.14  libudev >= 196
Conflicts:
Libs: -L/usr/lib/aarch64-linux-gnu
Libs.private: -lusb-1.0 -ludev
Cflags:  -g -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wpointer-arith -Wsign-compare -Wchar-subscripts -Wstrict-prototypes -Wshadow -Wformat=2 -Wtype-limits -O2 -I/usr/include/libusb-1.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
4.10.2 结论及解决方案

创建usbutils.pc文件

vim usbutils.pc

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib/aarch64-linux-gnu
includedir=/usr/include
usbids=/var/lib/usbutils/usb.ids

Name: usbutils
Description: usbutils    This is a collection of USB tools for use on Linux and BSD systems\
 to query what type of USB devices are connected to the system. This is to be run on a USB host\
  (i.e. a machine you plug USB devices into), not on a USB device (i.e. a device you plug into a USB host.)

Version: 012
URL: https://github.com/gregkh/usbutils
Requires: libusb-1.0 >= 1.0.14  libudev >= 196
Conflicts:
Libs: -L/usr/lib/aarch64-linux-gnu
Libs.private: -lusb-1.0 -ludev
Cflags:  -g -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wpointer-arith -Wsign-compare -Wchar-subscripts -Wstrict-prototypes -Wshadow -Wformat=2 -Wtype-limits -O2 -I/usr/include/libusb-1.0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

拷贝到对应路径/usr/lib/aarch64-linux-gnu/pkgconfig/

sudo cp usbutils.pc /usr/lib/aarch64-linux-gnu/pkgconfig/

# 更新一下环境变量
source ~/.bashrc
  • 1
  • 2
  • 3
  • 4

4.11 [meson]WARNING: You should add the boolean check kwarg to the run_command call.

4.11.1 问题定位

查看附近的打印

spice-common| WARNING: You should add the boolean check kwarg to the run_command call.
spice-common| It currently defaults to false,
spice-common| but it will default to true in future releases of meson.
spice-common| See also: https://github.com/mesonbuild/meson/issues/9300
  • 1
  • 2
  • 3
  • 4

run_command函数应该传入检查参数,此时默认为false,后续版本可能为true

关于默认参数是true还是false的讨论可以看这个issues

https://github.com/mesonbuild/meson/issues/9300

查看一下spice-commonmeson.build文件

# Python
if spice_common_generate_client_code or spice_common_generate_server_code
  py_module = import('python')
  python = py_module.find_installation('python3')

  if get_option('python-checks')
    foreach module : ['six', 'pyparsing']
      message('Checking for python module @0@'.format(module))
      cmd = run_command(python, '-c', 'import @0@'.format(module))
      if cmd.returncode() != 0
        error('Python module @0@ not found'.format(module))
      endif
    endforeach
  endif
endif
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

run_command确实没有传入检查参数

4.11.2 结论及解决方案

修改spice-commonmeson.build文件,run_command传入检查参数

修改完成后如下

cmd = run_command(python, '-c', 'import @0@'.format(module), check : true)
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/216875
推荐阅读
相关标签
  

闽ICP备14008679号