我正在尝试在Alpine Linux上安装DPDK
。我在Docker中运行Alpine Linux。这是我正在使用的步骤:
docker pull alpine
docker run -it alpine /bin/sh
wget https://git.dpdk.org/dpdk-stable/snapshot/dpdk-stable-16.11.8.tar.gz
tar -xzf dpdk-stable-16.11.8.tar.gz
cd dpdk-stable-16.11.8
apk add --no-cache make gcc libc-dev bsd-compat-headers linux-headers musl-dev
apk add numactl-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
make install T=x86_64-native-linuxapp-gcc
安装失败,并出现以下错误和警告:
make [5]:'depdirs'不需要做任何事情。
配置完成
==构建lib
==构建lib / librte_compat
==构建lib / librte_eal
==构建lib / librte_eal / common
==构建lib / librte_eal / linuxapp
==构建lib / librte_eal / linuxapp / eal
CC eal_hugepage_info.o
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:在“ clear_hugedir”函数中:
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:8:警告:函数'openat'的隐式声明;你是说'popen'吗? [-Wimplicit函数声明] fd = openat(dir_fd,dirent-> d_name,O_RDONLY); ^ ~~~~~ 弹出
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:8:警告:“ openat” [-Wnested-externs]的嵌套外部声明
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:39:错误:未声明“ O_RDONLY”(此功能首次使用) fd = openat(dir_fd,dirent-> d_name,O_RDONLY); ^ ~~~~~~~~ /dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:39:注意:每个未声明的标识符对于出现在每个函数中仅报告一次
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:在函数“ eal_hugepage_info_init”中:
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:320:26:警告:函数'open'的隐式声明;你是说'popen'吗? [-Wimplicit函数声明] hpi-> lock_descriptor = open(hpi-> hugedir,O_RDONLY); ^ ~~~ 弹出
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:320:26:警告:“打开” [-Wnested-externs]的嵌套外部声明
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:320:45:错误:未声明“ O_RDONLY”(此功能首次使用) hpi-> lock_descriptor = open(hpi-> hugedir,O_RDONLY); ^ ~~~~~~~
make [7]:*** [/dpdk/dpdk-stable-16.11.8/mk/internal/rte.compile-pre.mk:140:eal_hugepage_info.o]错误1
make [6]:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.subdir.mk:63:eal]错误2
make [5]:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.subdir.mk:63:linuxapp]错误2
make [4]:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.subdir.mk:63:librte_eal]错误2
make [3]:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkbuild.mk:80:lib]错误2
make [2]:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:127:全部]错误2
make [1]:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkinstall.mk:86:pre_install]错误2
make:*** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:101:安装]错误2
更新1
我修复了一些错误,但是现在出现了新的错误。 这是更新的步骤:
docker pull alpine
docker run -it alpine /bin/sh
wget https://git.dpdk.org/dpdk-stable/snapshot/dpdk-stable-16.11.8.tar.gz
tar -xzf dpdk-stable-16.11.8.tar.gz
cd dpdk-stable-16.11.8
apk add --no-cache make gcc libc-dev bsd-compat-headers linux-headers musl-dev
apk add numactl-dev --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
#include <fcntl.h>
添加到lib/librte_eal/common/include/rte_common.h
CFLAGS += -D_GNU_SOURCE
添加到lib/librte_eal/linuxapp/eal/Makefile
make install T=x86_64-native-linuxapp-gcc
现在安装失败,并出现以下错误:
make [5]:对于'depdirs'不做任何事情。 配置完成
==构建lib
==构建lib / librte_compat
==构建lib / librte_eal
==构建lib / librte_eal / common
==构建lib / librte_eal / linuxapp
==构建lib / librte_eal / linuxapp / eal
CC eal_vfio_mp_sync.o
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:在函数'vfio_mp_sync_send_fd'中:
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:75:17:错误:“ struct cmsghdr”没有名为“ __cmsg_data”的成员 memcpy((chdr).__ cmsg_data,&(fd),sizeof(fd)); \ ^
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:187:2:注意:扩展宏“ FD_TO_CMSGHDR” FD_TO_CMSGHDR(fd,* chdr); ^ ~~~~~~~~~~~~
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:在函数'vfio_mp_sync_receive_fd'中:
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:78:24:错误:“ struct cmsghdr”没有名为“ __cmsg_data”的成员 memcpy(&(fd),(chdr).__ cmsg_data,sizeof(fd)) ^
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:228:2:注意:扩展宏“ CMSGHDR_TO_FD” CMSGHDR_TO_FD(* chdr,fd); ^ ~~~~~~~~~~~~
make [7]:*** [/dpdk-stable-16.11.8/mk/internal/rte.compile-pre.mk:140:eal_vfio_mp_sync.o]错误1
make [6]:*** [/dpdk-stable-16.11.8/mk/rte.subdir.mk:63:eal]错误2
make [5]:*** [/dpdk-stable-16.11.8/mk/rte.subdir.mk:63:linuxapp]错误 2
make [4]:*** [/dpdk-stable-16.11.8/mk/rte.subdir.mk:63:librte_eal]错误2
make [3]:*** [/dpdk-stable-16.11.8/mk/rte.sdkbuild.mk:80:lib]错误2
make [2]:*** [/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:127:全部]错误2
make [1]:*** [/dpdk-stable-16.11.8/mk/rte.sdkinstall.mk:86:pre_install]错误2
make:*** [/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:101:安装]错误2
如果您查看/usr/include/x86_64-linux-gnu/bits/socket.h
,则struct cmsghdr
的定义如下:
/* Structure used for storage of ancillary data object information. */
struct cmsghdr
{
size_t cmsg_len;
/* Length of data in cmsg_data plus length
of cmsghdr structure.
!! The type should be socklen_t but the
definition of the kernel is incompatible
with this. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
#if __glibc_c99_flexarr_available
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
#endif
};
什么是__glibc_c99_flexarr_available
?我可以以某种方式使它可用吗?
更新2
我尝试使用this代替musl-dev
,但错误仍然相同。
然后按照建议,我在自己的Alpine Linux上安装了glibc
而不是musl
。遵循步骤here。现在我收到这样的错误:
在/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal.c:48:0:
中包含的文件中/usr/include/limits.h:124:26:致命错误:limits.h:没有此类文件或目录
#include_next
答案 0 :(得分:3)
似乎DPDK与musl libc不兼容,因此您可能很难一一修复错误。必须手动添加预处理器定义并将其包含到CFLAGS中似乎是一个不好的信号。
最后一个错误是这样的libc不兼容:
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:78:24:错误:'struct cmsghdr'没有名为'__cmsg_data'的成员memcpy(&(fd),(chdr ).__ cmsg_data,sizeof(fd))
在我的glibc(Ubuntu 16.04)中,cmsghdr
在bits/socket.h
中的定义如下:
/* Structure used for storage of ancillary data object information. */
struct cmsghdr
{
size_t cmsg_len; /* Length of data in cmsg_data plus length
of cmsghdr structure.
!! The type should be socklen_t but the
definition of the kernel is incompatible
with this. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
#endif
};
请注意__cmsg_data
的末尾。
在音乐中,cmsghdr
定义为:
struct cmsghdr {
socklen_t cmsg_len;
int __pad1;
int cmsg_level;
int cmsg_type;
};
请注意缺少的__cmsg_data
字段。
答案 1 :(得分:3)
最后,经过一些时间和许多变通办法,我设法在DP上安装了Alpine Linux上的DPDK,即在运行Alpine Linux的Docker容器上安装了。
这是我创建的Dockerfile(注释内联):
return
我希望这样可以节省某人的时间:)