在Ubuntu 18.04上为virtiofs构建(或刚刚得到)最新的libvirtd。

问题描述 投票:0回答:1

请注意,我是 真的 我是kvm和libvirt的新手,所以可能错过了一些基本的东西。如果这真是一个 "阅读常见问题 "类型的问题,我很抱歉,但到目前为止,我没有找到任何具体的问题。

在Ubuntu 18.04上通过apt安装4.0.0版本安装libvirt,我需要与客人共享主机文件夹,并希望确保良好的性能,所以我想试试virtiofs。文档中建议最低使用6.2版本(事实上,只要把 <driver type='virtiofs'/> 到 guest config 中的结果是无法对模式进行验证)。)

我下载了libvirt的源代码,但找不到完整的先决条件列表。最后,我安装了这些以获得 configure 毫无怨言地跑着。

apt install gcc libglib2.0-dev gnutls-dev libxml2-dev xsltproc python-docutils libdevmapper-dev libpciaccess-dev

我就跑了 ../configure --without-macvtap 因为我使用的是桥式网络)。

在这一点上,我可以运行 make check,但最后却在 util/libvirt_util_la-virnetdev.lo 下面是完整的错误输出)。我假设我还缺少一些先决条件,但我在任何地方都找不到完整的列表,上网搜索这个错误也没有找到什么。是不是我在什么地方遗漏了一些构建说明?

# make check
make  check-recursive
make[1]: Entering directory '/root/libvirtd/libvirt-6.4.0/build'
Making check in .
make[2]: Entering directory '/root/libvirtd/libvirt-6.4.0/build'
make  check-local
make[3]: Entering directory '/root/libvirtd/libvirt-6.4.0/build'
make  all-recursive
make[4]: Entering directory '/root/libvirtd/libvirt-6.4.0/build'
Making all in .
make[5]: Entering directory '/root/libvirtd/libvirt-6.4.0/build'
make[5]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build'
Making all in include/libvirt
make[5]: Entering directory '/root/libvirtd/libvirt-6.4.0/build/include/libvirt'
make[5]: Nothing to be done for 'all'.
make[5]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build/include/libvirt'
Making all in src
make[5]: Entering directory '/root/libvirtd/libvirt-6.4.0/build/src'
make  all-am
make[6]: Entering directory '/root/libvirtd/libvirt-6.4.0/build/src'
  CC       util/libvirt_util_la-virnetdev.lo
../../src/util/virnetdev.c: In function 'virNetDevGetFamilyId':
../../src/util/virnetdev.c:2980:12: error: variable 'gmsgh' has initializer but incomplete type
     struct genlmsghdr gmsgh = {
            ^~~~~~~~~~
../../src/util/virnetdev.c:2981:10: error: 'struct genlmsghdr' has no member named 'cmd'
         .cmd = CTRL_CMD_GETFAMILY,
          ^~~
../../src/util/virnetdev.c:2981:16: error: 'CTRL_CMD_GETFAMILY' undeclared (first use in this function); did you mean 'U_CHARSET_FAMILY'?
         .cmd = CTRL_CMD_GETFAMILY,
                ^~~~~~~~~~~~~~~~~~
                U_CHARSET_FAMILY
../../src/util/virnetdev.c:2981:16: note: each undeclared identifier is reported only once for each function it appears in
../../src/util/virnetdev.c:2981:16: warning: excess elements in struct initializer
../../src/util/virnetdev.c:2981:16: note: (near initialization for 'gmsgh')
../../src/util/virnetdev.c:2982:10: error: 'struct genlmsghdr' has no member named 'version'
         .version = DEVLINK_GENL_VERSION,
          ^~~~~~~
../../src/util/virnetdev.c:2982:20: warning: excess elements in struct initializer
         .version = DEVLINK_GENL_VERSION,
                    ^~~~~~~~~~~~~~~~~~~~
../../src/util/virnetdev.c:2982:20: note: (near initialization for 'gmsgh')
../../src/util/virnetdev.c:2983:10: error: 'struct genlmsghdr' has no member named 'reserved'
         .reserved = 0,
          ^~~~~~~~
../../src/util/virnetdev.c:2983:21: warning: excess elements in struct initializer
         .reserved = 0,
                     ^
../../src/util/virnetdev.c:2983:21: note: (near initialization for 'gmsgh')
../../src/util/virnetdev.c:2980:23: error: storage size of 'gmsgh' isn't known
     struct genlmsghdr gmsgh = {
                       ^~~~~
../../src/util/virnetdev.c:2985:23: error: 'CTRL_ATTR_MAX' undeclared (first use in this function); did you mean 'DEVLINK_ATTR_MAX'?
     struct nlattr *tb[CTRL_ATTR_MAX + 1] = {NULL, };
                       ^~~~~~~~~~~~~
                       DEVLINK_ATTR_MAX
../../src/util/virnetdev.c:2989:20: warning: implicit declaration of function 'nlmsg_alloc_simple'; did you mean 'g_regex_split_simple'? [-Wimplicit-function-declaration]
     if (!(nl_msg = nlmsg_alloc_simple(GENL_ID_CTRL,
                    ^~~~~~~~~~~~~~~~~~
                    g_regex_split_simple
../../src/util/virnetdev.c:2989:20: warning: nested extern declaration of 'nlmsg_alloc_simple' [-Wnested-externs]
../../src/util/virnetdev.c:2989:39: error: 'GENL_ID_CTRL' undeclared (first use in this function); did you mean 'G_ASCII_CNTRL'?
     if (!(nl_msg = nlmsg_alloc_simple(GENL_ID_CTRL,
                                       ^~~~~~~~~~~~
                                       G_ASCII_CNTRL
../../src/util/virnetdev.c:2990:39: error: 'NLM_F_REQUEST' undeclared (first use in this function)
                                       NLM_F_REQUEST | NLM_F_ACK))) {
                                       ^~~~~~~~~~~~~
../../src/util/virnetdev.c:2990:55: error: 'NLM_F_ACK' undeclared (first use in this function); did you mean 'N_6PACK'?
                                       NLM_F_REQUEST | NLM_F_ACK))) {
                                                       ^~~~~~~~~
                                                       N_6PACK
../../src/util/virnetdev.c:2995:9: warning: implicit declaration of function 'nlmsg_append'; did you mean 'g_list_append'? [-Wimplicit-function-declaration]
     if (nlmsg_append(nl_msg, &gmsgh, sizeof(gmsgh), NLMSG_ALIGNTO) < 0)
         ^~~~~~~~~~~~
         g_list_append
../../src/util/virnetdev.c:2995:9: warning: nested extern declaration of 'nlmsg_append' [-Wnested-externs]
../../src/util/virnetdev.c:2995:53: error: 'NLMSG_ALIGNTO' undeclared (first use in this function); did you mean 'CMSG_ALIGN'?
     if (nlmsg_append(nl_msg, &gmsgh, sizeof(gmsgh), NLMSG_ALIGNTO) < 0)
                                                     ^~~~~~~~~~~~~
                                                     CMSG_ALIGN
../../src/util/virnetdev.c:2998:9: warning: implicit declaration of function 'nla_put_string'; did you mean 'g_hmac_get_string'? [-Wimplicit-function-declaration]
     if (nla_put_string(nl_msg, CTRL_ATTR_FAMILY_NAME, family_name) < 0) {
         ^~~~~~~~~~~~~~
         g_hmac_get_string
../../src/util/virnetdev.c:2998:9: warning: nested extern declaration of 'nla_put_string' [-Wnested-externs]
../../src/util/virnetdev.c:2998:32: error: 'CTRL_ATTR_FAMILY_NAME' undeclared (first use in this function); did you mean 'CTRL_ATTR_MAX'?
     if (nla_put_string(nl_msg, CTRL_ATTR_FAMILY_NAME, family_name) < 0) {
                                ^~~~~~~~~~~~~~~~~~~~~
                                CTRL_ATTR_MAX
../../src/util/virnetdev.c:3004:61: error: 'NETLINK_GENERIC' undeclared (first use in this function); did you mean 'NETLINK_MSG_PUT'?
     if (virNetlinkCommand(nl_msg, &resp, &recvbuflen, 0, 0, NETLINK_GENERIC, 0) < 0)
                                                             ^~~~~~~~~~~~~~~
                                                             NETLINK_MSG_PUT
../../src/util/virnetdev.c:3007:9: warning: implicit declaration of function 'nlmsg_parse'; did you mean 'umsg_parse'? [-Wimplicit-function-declaration]
     if (nlmsg_parse(resp, sizeof(struct nlmsghdr), tb, CTRL_ATTR_MAX, NULL) < 0) {
         ^~~~~~~~~~~
         umsg_parse
../../src/util/virnetdev.c:3007:9: warning: nested extern declaration of 'nlmsg_parse' [-Wnested-externs]
../../src/util/virnetdev.c:3007:34: error: invalid application of 'sizeof' to incomplete type 'struct nlmsghdr'
     if (nlmsg_parse(resp, sizeof(struct nlmsghdr), tb, CTRL_ATTR_MAX, NULL) < 0) {
                                  ^~~~~~
../../src/util/virnetdev.c:3013:12: error: 'CTRL_ATTR_FAMILY_ID' undeclared (first use in this function); did you mean 'CTRL_ATTR_FAMILY_NAME'?
     if (tb[CTRL_ATTR_FAMILY_ID] == NULL) {
            ^~~~~~~~~~~~~~~~~~~
            CTRL_ATTR_FAMILY_NAME
../../src/util/virnetdev.c:3018:31: warning: implicit declaration of function 'RTA_DATA'; did you mean 'NO_DATA'? [-Wimplicit-function-declaration]
     *family_id = *(uint32_t *)RTA_DATA(tb[CTRL_ATTR_FAMILY_ID]);
                               ^~~~~~~~
                               NO_DATA
../../src/util/virnetdev.c:3018:31: warning: nested extern declaration of 'RTA_DATA' [-Wnested-externs]
../../src/util/virnetdev.c:3022:5: warning: implicit declaration of function 'nlmsg_free'; did you mean 'g_list_free'? [-Wimplicit-function-declaration]
     nlmsg_free(nl_msg);
     ^~~~~~~~~~
     g_list_free
../../src/util/virnetdev.c:3022:5: warning: nested extern declaration of 'nlmsg_free' [-Wnested-externs]
../../src/util/virnetdev.c:2985:20: warning: unused variable 'tb' [-Wunused-variable]
     struct nlattr *tb[CTRL_ATTR_MAX + 1] = {NULL, };
                    ^~
../../src/util/virnetdev.c:2980:23: warning: unused variable 'gmsgh' [-Wunused-variable]
     struct genlmsghdr gmsgh = {
                       ^~~~~
../../src/util/virnetdev.c: In function 'virNetDevSwitchdevFeature':
../../src/util/virnetdev.c:3046:12: error: variable 'gmsgh' has initializer but incomplete type
     struct genlmsghdr gmsgh = {
            ^~~~~~~~~~
../../src/util/virnetdev.c:3047:10: error: 'struct genlmsghdr' has no member named 'cmd'
         .cmd = DEVLINK_CMD_ESWITCH_GET,
          ^~~
../../src/util/virnetdev.c:3047:16: warning: excess elements in struct initializer
         .cmd = DEVLINK_CMD_ESWITCH_GET,
                ^~~~~~~~~~~~~~~~~~~~~~~
../../src/util/virnetdev.c:3047:16: note: (near initialization for 'gmsgh')
../../src/util/virnetdev.c:3048:10: error: 'struct genlmsghdr' has no member named 'version'
         .version = DEVLINK_GENL_VERSION,
          ^~~~~~~
../../src/util/virnetdev.c:3048:20: warning: excess elements in struct initializer
         .version = DEVLINK_GENL_VERSION,
                    ^~~~~~~~~~~~~~~~~~~~
../../src/util/virnetdev.c:3048:20: note: (near initialization for 'gmsgh')
../../src/util/virnetdev.c:3049:10: error: 'struct genlmsghdr' has no member named 'reserved'
         .reserved = 0,
          ^~~~~~~~
../../src/util/virnetdev.c:3049:21: warning: excess elements in struct initializer
         .reserved = 0,
                     ^
../../src/util/virnetdev.c:3049:21: note: (near initialization for 'gmsgh')
../../src/util/virnetdev.c:3046:23: error: storage size of 'gmsgh' isn't known
     struct genlmsghdr gmsgh = {
                       ^~~~~
../../src/util/virnetdev.c:3078:39: error: 'NLM_F_REQUEST' undeclared (first use in this function)
                                       NLM_F_REQUEST | NLM_F_ACK))) {
                                       ^~~~~~~~~~~~~
../../src/util/virnetdev.c:3078:55: error: 'NLM_F_ACK' undeclared (first use in this function); did you mean 'N_6PACK'?
                                       NLM_F_REQUEST | NLM_F_ACK))) {
                                                       ^~~~~~~~~
                                                       N_6PACK
../../src/util/virnetdev.c:3083:53: error: 'NLMSG_ALIGNTO' undeclared (first use in this function); did you mean 'CMSG_ALIGN'?
     if (nlmsg_append(nl_msg, &gmsgh, sizeof(gmsgh), NLMSG_ALIGNTO) < 0)
                                                     ^~~~~~~~~~~~~
                                                     CMSG_ALIGN
../../src/util/virnetdev.c:3088:9: warning: implicit declaration of function 'nla_put'; did you mean '_IO_putc'? [-Wimplicit-function-declaration]
     if (nla_put(nl_msg, DEVLINK_ATTR_BUS_NAME, strlen("pci")+1, "pci") < 0 ||
         ^~~~~~~
         _IO_putc
../../src/util/virnetdev.c:3088:9: warning: nested extern declaration of 'nla_put' [-Wnested-externs]
../../src/util/virnetdev.c:3095:61: error: 'NETLINK_GENERIC' undeclared (first use in this function); did you mean 'NETLINK_MSG_PUT'?
     if (virNetlinkCommand(nl_msg, &resp, &recvbuflen, 0, 0, NETLINK_GENERIC, 0) < 0)
                                                             ^~~~~~~~~~~~~~~
                                                             NETLINK_MSG_PUT
../../src/util/virnetdev.c:3098:34: error: invalid application of 'sizeof' to incomplete type 'struct genlmsghdr'
     if (nlmsg_parse(resp, sizeof(struct genlmsghdr), tb, DEVLINK_ATTR_MAX, NULL) < 0) {
                                  ^~~~~~
../../src/util/virnetdev.c:3105:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         *(int *)RTA_DATA(tb[DEVLINK_ATTR_ESWITCH_MODE]) == DEVLINK_ESWITCH_MODE_SWITCHDEV) {
          ^
../../src/util/virnetdev.c:3046:23: warning: unused variable 'gmsgh' [-Wunused-variable]
     struct genlmsghdr gmsgh = {
                       ^~~~~
Makefile:10841: recipe for target 'util/libvirt_util_la-virnetdev.lo' failed
make[6]: *** [util/libvirt_util_la-virnetdev.lo] Error 1
make[6]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build/src'
Makefile:6443: recipe for target 'all' failed
make[5]: *** [all] Error 2
make[5]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build/src'
Makefile:777: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build'
Makefile:670: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build'
Makefile:1070: recipe for target 'check-am' failed
make[2]: *** [check-am] Error 2
make[2]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build'
Makefile:777: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/root/libvirtd/libvirt-6.4.0/build'
Makefile:1072: recipe for target 'check' failed
make: *** [check] Error 2

libvirt
1个回答
0
投票

我猜测这可能是由以下原因造成的。--without-macvtap arg来配置。我想你已经触发了一个组合的 #ifdef 的检查不正确。即使你要使用桥接网络,让 libvirt 构建 macvtap 支持也没有什么坏处,所以只需删除掉 --without-macvtap arg作为修复它的第一次尝试。


0
投票

通过试验和错误,感谢@danielb建议将 macvtap貌似 这些 是在Ubuntu 18.04上成功编译所需要安装的最小包。

apt install gcc libglib2.0-dev gnutls-dev libxml2-dev xsltproc python-docutils libdevmapper-dev libpciaccess-dev libnl-3-dev libnl-route-3-dev

请注意,我最初的问题中并不包括以下内容: libnl-3-devlibnl-route-3-dev虽说 configure 如果没有这些,就会快乐地运行。make 不会。

© www.soinside.com 2019 - 2024. All rights reserved.