Centos7 SPICE 源码编译安装(1)-----编译spice-0.13.1.tar.bz2

本文详细介绍了如何在CentOS7环境下,对SPICE 0.13.1版本进行源码编译及安装的过程,帮助读者掌握SPICE的安装技术。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

因为spice的工程是一个非常标准的linux工程,所以我们就可以直接安装tarball编译的三步走完成安装,下面是在centos7下面的编译过程:


1、把下载的最新源码spice-0.13.1.tar.bz2解压缩到/usr/local/src目录下,解压缩成功会在/usr/local/src目录下产生一个spice-0.13.1目录
2、进入spice-0.13.1目录,会看到源码和configure等文件;
3、首先执行一下configure脚本,
./configure --prefix=/usr/local/spice (要确保存在/usr/local/spice目录)会提示:


checking for SPICE_PROTOCOL... no
configure: error: Package requirements (spice-protocol >= 0.12.11) were not met:


No package 'spice-protocol' found


Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.


Alternatively, you may set the environment variables SPICE_PROTOCOL_CFLAGS
and SPICE_PROTOCOL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.


这个错误说明没有安装spice-protocol,并且需要不小于0.12.11版本的spice-protocol。
那么我们直接tarball编译安装spice-protocol最新版本:
1>从spice官网下载最新的spice-protocol-0.12.11.tar.bz2解压缩到/usr/local/src目录下,然后会在这个目录下多出一个spice-protocol-0.12.11目录
2>进入spice-0.13.1目录,会看到源码和configure等文件,执行命令:./configure --prefix=/usr/local/spice (要确保存在/usr/local/spice目录)
3>最后就是make和make install,非常顺利的吧最新版本spice-protocol安装到了/usr/local/spice目录下,如果/usr/local/spice目录原先是干净的,那么通过命令我们可以看到如下内容
[root@localhost ~]# cd /usr/local/spice
[root@localhost spice]# ll
total 0
drwxr-xr-x. 3 root root 20 May 25 17:28 include
drwxr-xr-x. 3 root root 22 May 25 17:28 share
[root@localhost spice]# ll -a
total 4
drwxr-xr-x.  4 root root   32 May 25 17:28 .
drwxr-xr-x. 13 root root 4096 May 25 17:24 ..
drwxr-xr-x.  3 root root   20 May 25 17:28 include
drwxr-xr-x.  3 root root   22 May 25 17:28 share
[root@localhost spice]# cd share
[root@localhost share]# ll
total 0
drwxr-xr-x. 2 root root 30 May 25 17:28 pkgconfig
[root@localhost share]# cd pkgconfig/


[root@localhost pkgconfig]# pwd
/usr/local/spice/share/pkgconfig                    ===》这个路径很重要,一会儿会用到,(自己可以查询资料了解pkg路径的作用)

[root@localhost pkgconfig]# ls
spice-protocol.pc


4、安装完最新的spcie-protocol后,再次执行./configure --prefix=/usr/local/spice,仍然出现第三步的错误,原因是没有找不到我们最新安装的spice-protocol。有人会说了,刚才不是已经安装了
系统怎么这么傻呀!!这个不能怪系统了,主要是我们为了软件管理方便,把spice-protocol安装到了我们的自定义目录环境下了,所以linux不会主动在这个目录下查询,因此我们要告诉系统一下,那怎么告诉系统呢?
方法就是通过在当前shell程序中设置PKG_CONFIG_PATH解决,命令如下:(设置的环境变量只是对于当前shell程序有效,其他打开的shell程序,或者关闭了当前shell程序再打开shell程序,这些都是导致环境变量失效的)
[root@localhost spice-0.13.1]# export PKG_CONFIG_PATH=/usr/local/spice/share/pkgconfig    ==》这就是前面提到的路径
[root@localhost spice-0.13.1]# echo $PKG_CONFIG_PATH  ==》打印一下设置的环境变量是否正确
/usr/local/spice/share/pkgconfig


5、再次执行:./configure --prefix=/usr/local/spice,这次提示的错误是:
checking for SPICE_PROTOCOL... yes
checking for GLIB2... no
configure: error: Package requirements (glib-2.0 >= 2.22) were not met:


No package 'glib-2.0' found


Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值