编译libvirt,并gdb
发布日期:2021-09-16 04:36:58 浏览次数:8 分类:技术文章

本文共 1576 字,大约阅读时间需要 5 分钟。

好久没有碰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

转载地址:https://blog.csdn.net/wllabs/article/details/77824640 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:virsh 查看cpu架构,以及guest vm numa应分配架构
下一篇:glance 镜像 os_type 用途

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月08日 15时49分28秒