天天看點

在centos7下spice代碼編譯

在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 [email protected]

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的編碼。

繼續閱讀