在centos7下spice代码编译
目标还是两个spice的包:spice-protocol和spice-gtk
rpm -q xxx(查询 已安装的rpm包) rpm -e –nodeps xxx
由于yum安装和移除都会处理依赖关系,所以移除原有老版本的spice包的时候,需要用rpm rpm -e –nodeps xxx
配置的时候,需要增加几个选项,适应centos的风格 $ ./configure –prefix=/usr –localstatedir=/var –sysconfdir=/etc –libdir=/usr/lib64
spice-protocol spice spice-gtk都是从git上clone来的。
1)安装virt-manager yum install virt-manager
相关的包会安装好,而且可以运行
2)spice-protocol rpm -e –nodeps spice-protocol ./autogen ./configure –prefix=/usr –localstatedir=/var –sysconfdir=/etc –libdir=/usr/lib64 make make install
3)spice rpm -e –nodeps spice-server-0.12.4-20.el7_3.x86_64 yum install glib2-devel pixman-devel celt051-devel openssl-devel libjpeg-turbo-devel cyrus-sasl-devel alsa-lib-devel libcacard-devel yum install gstreamer1 gstreamer1-plugins-base-devel gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel gstreamer1-plugins-base-tools yum install epel-release yum install lz4 lz4-devel yum install gstream1-plugins-ugly gstream1-libav (然后加nux的repo,直接安装gstream1-plugins-ugly和gstream1-libav) ./configure –prefix=/usr –localstatedir=/var –sysconfdir=/etc –libdir=/usr/lib64 make make install (git clone下来的spice编译出错,还是下载0.13.3)
不建议编译代码,要涉及很多codec。 ( 另外在centos中,没有gstreamer-plugin-ugly和gstreamer-libav,需要下载源代码编译。 https://gstreamer.freedesktop.org/modules/
不能最新的版本,当前yum的仓库的gstream1是1.4.5 那ugly和libav都是下载的1.4.5 )
4)spice-gtk 把原来的spice glib gtk都卸载
yum install perl-Text-CSV yum install gtk-doc yum install gtk3-devel yum install libepoxy-devel yum install vala vala-tools yum install pulseaudio-libs-devel yum install usbredir-devel usbredir-server usbredir
./autogen.sh ./configure –prefix=/usr –localstatedir=/var –sysconfdir=/etc –libdir=/usr/lib64 –enable-vala make make install
5)qemu和支持video的codec qemu目前的版本无法设定spice的video codec,当前最新版本,以及git下的代码都没有设置spice codec的代码,找到一个patch可以做这个事情,需要自己重新编译。
https://patchwork.freedesktop.org/patch/78976/ 根据patch,修改qemu-options.hx和ui/spice-core.c
打算把目前系统里面的qemu全部删除掉。 http://wiki.qemu-project.org/Hosts/Linux
yum install git glib2-devel libfdt-devel pixman-devel zlib-devel
(通过src rpm 安装1.5.3的qemu失败,虽然可以通过修改spec以及增加patch,直接编译,但是spice的experiment的头文件,以及很多变量已经失效,编译warning,而且编译要求warning即error,无法编译通过)
更改方案,既然是qemu设置spice的参数,那直接在spice代码中写上这个参数,或者通过配置文件加载,而不是通过qemu。
http://wiki.qemu-project.org/Documentation/9psetup http://wiki.qemu-project.org/Hosts/Linux http://wiki.qemu-project.org/Contribute/SubmitAPatch
H264编码使用:
~/w1/spice-gtk(master*) # tail -f /var/log/libvirt/qemu/win7.log root@hua-c7t snd_channel_unref: SndChannel=0x7fcc44320000 freed dummy_channel_client_disconnect: rcc=0x7fcc44265190 (channel=0x7fcc4391e0e0 type=5 id=0) snd_channel_unref: SndChannel=0x7fcc44308000 freed red_channel_client_default_disconnect: rcc=0x7fcc4396b1c0 (channel=0x7fcc42fe60e0 type=1 id=0) main_channel_client_on_disconnect: rcc=0x7fcc4396b1c0 main_channel_link: add main channel client main_channel_client_handle_pong: net test: invalid values, latency 4806 roundtrip 4755. assuming highbandwidth inputs_connect: inputs channel client create red_qxl_set_cursor_peer: main_channel_handle_parsed: agent start
(gst-plugin-scanner:5502): Clutter-CRITICAL **: Unable to initialize Clutter: Unable to open display. You have to set the DISPLAY environment variable, or use the –display command line argument
(qemu-kvm:5360): Spice-WARNING **: gstreamer-encoder.c:775:map_format: The 8 format has not been tested yet ORC: ERROR: orccodemem.c(288): orc_code_region_allocate_codemem(): Failed to create write and exec mmap regions. This is probably because SELinux execmem check is enabled (good) and TMPDIRand HOME are mounted noexec (bad). ORC: ERROR: orccodemem.c(148): orc_code_region_get_free_chunk(): assertion failed: 0 2017-03-02 07:07:09.562+0000: shutting down
1)通过google搜索“(qemu-kvm:5360): Spice-WARNING **: gstreamer-encoder.c:775:map_format: The 8 format has not been tested yet”发现,spice出现类似的问题,并且在开了一个bug,但是未有解决
https://bugs.freedesktop.org/show_bug.cgi?id=97786 https://lists.freedesktop.org/archives/spice-devel/2016-September/032014.html https://lists.freedesktop.org/archives/spice-devel/2016-February/026279.html
后来直接通过公司内网的repo,直接安装了qemu的2.3rpm,消除了问题。
但是不能确认是否是264编码。通过网页播放flash完全无法确认。试图通过本地视频播放,看看是否可以确认创建video的编码。
