编译libvirt,并gdb

好久没有碰libivrt了,以前也没有总结下来。所以重新开始编辑libvirt和gdb


本来想直接用 debuginfo-install libvirt    安癍debug版的libivrt,结果没找到包,那就算了吧,重新编译个也不错。


编译过程中会出现如果错误,以前要来装的包,同时如果要编译debug版本的需要带上 --enable-debug=yes

[root@nova02 libvirt-1.2.17]# ./configure --help | grep debug
  --enable-debug=[no|yes] enable debugging output [default=yes]


中途出现的问题如下:

1、configure: error: You must install the libyajl library & headers to compile libvirt
解决方案:yum install libxml2.x86_64  yum install libxml2-devel.x86_64
              yum install yajl.x86_64 yajl-devel.x86_64


2、configure: error: You must install device-mapper-devel/ >= 1.0.0 to compile libvirt
解决方案:yum install device-mapper-devel


3、configure: error: You must install the pciaccess module to build with udev
解决方案:yum install libpciaccess-devel.x86_64
 

4、configure: error: libnl-devel >= 1.1 is required for macvtap support
解决方案:yum install libnl-devel.x86_64



所以总的安装步骤如下:

1. 安装编译工具和依赖包
# yum -y install gcc yajl-devel libxml2-devel device-mapper-devel libpciaccess-devel libnl-devel


2. 下载源码、编译安装
# wget http://libvirt.org/sources/libvirt-1.2.17.tar.gz
# tar -zxf libvirt-1.2.17.tar.gz
# cd libvirt-1.2.17
# ./configure --enable-debug=yes --prefix=/usr
# make
# make install
ldconfig

3. 确认安装成功
# which libvirtd
# virsh version
# libvirtd --version


cp tools/virsh /usr/bin/virsh

ln -s /usr/local/var/run/libvirt/libvirt-sock /var/run/libvirt/libvirt-sock



如果要使用gdb 调试代码需要在编译是加上  --enable-debug=yes

如果需要 libvirt 支持numa,在编译时要加上   --with-numactl


libvirt里有很多宏,在gdb打印宏的时候会报   

(gdb) p LIBVIRT_SETUID_RPC_CLIENT

No symbol "LIBVIRT_SETUID_RPC_CLIENT" in current context.


如果想要打印宏,在编译时需要加上  需要加入-g3 和-gdwarf-2



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值