您的位置:首页 > 运维架构 > Linux

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

2016-06-05 13:25 816 查看
因为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.

Alternatively, you may set the environment variables GLIB2_CFLAGS

and GLIB2_LIBS to avoid the need to call pkg-config.

See the pkg-config man page for more details.

通过rpm命令,我发现系统已经安装了glib2,并且是大于2.22版本的:

[root@localhost pkgconfig]# rpm -qi glib2

Name        : glib2

Version     : 2.42.2

Release     : 5.el7

Architecture: x86_64

Install Date: Wed 25 May 2016 07:31:30 PM CST

Group       : System Environment/Libraries

Size        : 10851113

License     : LGPLv2+

Signature   : RSA/SHA256, Wed 25 Nov 2015 10:32:57 PM CST, Key ID 24c6a8a7f4a80eb5

Source RPM  : glib2-2.42.2-5.el7.src.rpm

Build Date  : Fri 20 Nov 2015 09:13:13 PM CST

Build Host  : worker1.bsys.centos.org

Relocations : (not relocatable)

Packager    : CentOS BuildSystem <http://bugs.centos.org>

Vendor      : CentOS

URL         : http://www.gtk.org
Summary     : A library of handy utility functions

Description :

GLib is the low-level core library that forms the basis for projects

such as GTK+ and GNOME. It provides data structure handling for C,

portability wrappers, and interfaces for such runtime functionality

as an event loop, threads, dynamic loading, and an object system.

因为是源码编译,并且引用了第三方的库,那么很有肯能说明现在需要的是glib2的dev环境,通过yum命令查询如下:

[root@localhost pkgconfig]# yum list|grep glib2

compat-libpackagekit-glib2-16.x86_64       0.8.9-1.el7                 @anaconda

glib2.x86_64                               2.42.2-5.el7                @anaconda

pulseaudio-libs-glib2.x86_64               6.0-7.el7                   @anaconda

compat-libpackagekit-glib2-16.i686         0.8.9-1.el7                 base     

glib2.i686                                 2.42.2-5.el7                base     

glib2-devel.i686                           2.42.2-5.el7                base         

glib2-devel.x86_64                         2.42.2-5.el7                base         =======》我的系统是64位,所以这个就是我需要下载安装的包了

glib2-doc.noarch                           2.42.2-5.el7                base     

glib2-fam.x86_64                           2.42.2-5.el7                base     

pulseaudio-libs-glib2.i686                 6.0-7.el7                   base     

通过yum命令直接下载安装:yum install glib2-devel.x86_64

6、再次执行:./configure --prefix=/usr/local/spice,这次提示的错误是:

checking for PIXMAN... no

configure: error: Package requirements (pixman-1 >= 0.17.7) were not met:

No package 'pixman-1' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you

installed software in a non-standard prefix.

原因就不说了,解决方法同上:

[root@localhost pkgconfig]# yum list|grep pixman

pixman.x86_64                              0.32.6-3.el7                @anaconda

pixman.i686                                0.32.6-3.el7                base     

pixman-devel.i686                          0.32.6-3.el7                base     

pixman-devel.x86_64                        0.32.6-3.el7                base       =======》这个就是我的系统需要安装的包

通过yum命令:yum install pixman-devel.x86_64

7、再次执行:./configure --prefix=/usr/local/spice,这次提示的错误是:

checking for SPICE_PROTOCOL... yes

checking for GLIB2... yes

checking for GOBJECT2... yes

checking for PIXMAN... yes

checking for CELT051... no

configure: error: Package requirements (celt051 >= 0.5.1.1) were not met:

No package 'celt051' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you

installed software in a non-standard prefix.

解决方法:

[root@localhost pkgconfig]# yum list|grep celt051

celt051.x86_64                             0.5.1.3-8.el7               @anaconda

celt051.i686                               0.5.1.3-8.el7               base     

celt051-devel.i686                         0.5.1.3-8.el7               base     

celt051-devel.x86_64                       0.5.1.3-8.el7               base     =======》这个就是我的系统需要安装的包

通过yum命令:yum install celt051-devel.x86_64

8、再次执行:./configure --prefix=/usr/local/spice,这次提示的错误是:

checking for SPICE_PROTOCOL... yes

checking for GLIB2... yes

checking for GOBJECT2... yes

checking for PIXMAN... yes

checking for CELT051... yes

checking for SSL... no

configure: error: Package requirements (openssl) were not met:

No package 'openssl' found

解决方法:

[root@localhost pkgconfig]# yum list|grep openssl

openssl.x86_64                             1:1.0.1e-42.el7.9           @anaconda

openssl-libs.x86_64                        1:1.0.1e-42.el7.9           @anaconda

apr-util-openssl.x86_64                    1.5.2-6.el7                 base     

openssl.x86_64                             1:1.0.1e-51.el7_2.5         updates  

openssl-devel.i686                         1:1.0.1e-51.el7_2.5         updates  

openssl-devel.x86_64                       1:1.0.1e-51.el7_2.5         updates    =======》这个就是我的系统需要安装的包

openssl-libs.i686                          1:1.0.1e-51.el7_2.5         updates  

openssl-libs.x86_64                        1:1.0.1e-51.el7_2.5         updates  

openssl-perl.x86_64                        1:1.0.1e-51.el7_2.5         updates  

openssl-static.i686                        1:1.0.1e-51.el7_2.5         updates  

openssl-static.x86_64                      1:1.0.1e-51.el7_2.5         updates  

openssl098e.i686                           0.9.8e-29.el7.centos.3      updates  

openssl098e.x86_64                         0.9.8e-29.el7.centos.3      updates  

xmlsec1-openssl.i686                       1.2.20-5.el7                base     

xmlsec1-openssl.x86_64                     1.2.20-5.el7                base     

xmlsec1-openssl-devel.i686                 1.2.20-5.el7                base     

xmlsec1-openssl-devel.x86_64               1.2.20-5.el7                base     

yum install openssl-devel.x86_64

9、再次执行:./configure --prefix=/usr/local/spice,这次提示的错误是:

checking for SPICE_PROTOCOL... yes

checking for GLIB2... yes

checking for GOBJECT2... yes

checking for PIXMAN... yes

checking for CELT051... yes

checking for SSL... yes

checking for jpeg_destroy_decompress in -ljpeg... no

configure: error: libjpeg not found

解决方法:

[root@localhost pkgconfig]# yum list|grep libjpeg

libjpeg-turbo.x86_64                       1.2.90-5.el7                @anaconda

libjpeg-turbo.i686                         1.2.90-5.el7                base     

libjpeg-turbo-devel.i686                   1.2.90-5.el7                base     

libjpeg-turbo-devel.x86_64                 1.2.90-5.el7                base     

libjpeg-turbo-static.i686                  1.2.90-5.el7                base     

libjpeg-turbo-static.x86_64                1.2.90-5.el7                base     

libjpeg-turbo-utils.x86_64                 1.2.90-5.el7                base     

yum install libjpeg-turbo-devel.x86_64

10、再次执行:./configure --prefix=/usr/local/spice,这次提示的成功信息如下:

configure: creating ./config.status

config.status: creating Makefile

config.status: creating common/Makefile

config.status: creating python_modules/Makefile

config.status: creating tests/Makefile

config.status: creating config.h

config.status: executing depfiles commands

config.status: executing libtool commands

configure:

        Spice 0.13.1

        ==============

        prefix:                   /usr/local/spice

        c compiler:               gcc -std=gnu99

        c++ compiler:             

        python:                   /usr/bin/python2

        LZ4 support:              auto

        Smartcard:                no

        SASL support:             no

        Automated tests:          no

        Manual:                   no

        Now type 'make' to build spice

11、现在可以执行make命令,但是最好先执行make clean,然后在执行make:

12,最后一步:make install
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  SPICE