Thursday, 13 March 2014

Сборка PHP libvirt на Debian 7 Wheezy из git

Собираем:
apt-get install -y libvirt-dev php5-dev libxml2-dev xsltproc libxml2-utils
cd /usr/src
git clone git://libvirt.org/libvirt-php.git
cd libvirt-php
autoreconf
./configure
make

При сбокре из git мы получим ошибку:
libvirt-php.c: In function ‘zm_startup_libvirt’: libvirt-php.c:1179:2: error: ‘VIR_DOMAIN_VCPU_GUEST’ undeclared (first use in this function) libvirt-php.c:1179:2: note: each undeclared identifier is reported only once for each function it appears in

Так как в wheezy старый либвирт, а именно в файле:
vim /usr/include/libvirt/libvirt.h 

Прямо под строкой:
VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */

Нужно добавить:
VIR_DOMAIN_VCPU_GUEST   = (1 << 3), /* Modify state of the cpu in the guest */  

Выкатываем его:
cp src/libvirt-php.so /usr/lib//php5/20100525/
Добавляем в конфиг:
echo "extension=libvirt-php.so" > /etc/php5/conf.d/libvirt-php.ini
Вуаля:
php -m | grep libvirt libvirt

No comments:

Post a Comment

Note: only a member of this blog may post a comment.