I am trying to install DPDK
on Alpine Linux. I am running Alpine Linux in the Docker. Here are the steps I am using:
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
Installation fails with the following errors and warnings:
make[5]: Nothing to be done for 'depdirs'.
Configuration done
== Build lib
== Build lib/librte_compat
== Build lib/librte_eal
== Build lib/librte_eal/common
== Build lib/librte_eal/linuxapp
== Build 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: In function 'clear_hugedir':
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:8: warning: implicit declaration of function 'openat'; did you mean 'popen'? [-Wimplicit-function-declaration] fd = openat(dir_fd, dirent->d_name, O_RDONLY); ^~~~~~ popen
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:8: warning: nested extern declaration of 'openat' [-Wnested-externs]
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:229:39: error: 'O_RDONLY' undeclared (first use in this function) 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: note: each undeclared identifier is reported only once for each function it appears in
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c: In function 'eal_hugepage_info_init':
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:320:26: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration] hpi->lock_descriptor = open(hpi->hugedir, O_RDONLY); ^~~~ popen
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:320:26: warning: nested extern declaration of 'open' [-Wnested-externs]
/dpdk/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c:320:45: error: 'O_RDONLY' undeclared (first use in this function) 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] Error 1
make[6]: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.subdir.mk:63: eal] Error 2
make[5]: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.subdir.mk:63: linuxapp] Error 2
make[4]: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.subdir.mk:63: librte_eal] Error 2
make[3]: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkbuild.mk:80: lib] Error 2
make[2]: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:127: all] Error 2
make[1]: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkinstall.mk:86: pre_install] Error 2
make: *** [/dpdk/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:101: install] Error 2
UPDATE 1
I fixed some of the errors but now new errors appear. Here are the updated steps:
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
- Add
#include <fcntl.h>
tolib/librte_eal/common/include/rte_common.h
- Add
CFLAGS += -D_GNU_SOURCE
tolib/librte_eal/linuxapp/eal/Makefile
make install T=x86_64-native-linuxapp-gcc
Installation now fails with the following errors:
make[5]: Nothing to be done for 'depdirs'. Configuration done
== Build lib
== Build lib/librte_compat
== Build lib/librte_eal
== Build lib/librte_eal/common
== Build lib/librte_eal/linuxapp
== Build 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: In function 'vfio_mp_sync_send_fd':
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:75:17: error: 'struct cmsghdr' has no member named '__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: note: in expansion of macro 'FD_TO_CMSGHDR' FD_TO_CMSGHDR(fd, *chdr); ^~~~~~~~~~~~~
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c: In function 'vfio_mp_sync_receive_fd':
/dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c:78:24: error: 'struct cmsghdr' has no member named '__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: note: in expansion of macro '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] Error 1
make[6]: *** [/dpdk-stable-16.11.8/mk/rte.subdir.mk:63: eal] Error 2
make[5]: *** [/dpdk-stable-16.11.8/mk/rte.subdir.mk:63: linuxapp] Error 2
make[4]: *** [/dpdk-stable-16.11.8/mk/rte.subdir.mk:63: librte_eal] Error 2
make[3]: *** [/dpdk-stable-16.11.8/mk/rte.sdkbuild.mk:80: lib] Error 2
make[2]: *** [/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:127: all] Error 2
make[1]: *** [/dpdk-stable-16.11.8/mk/rte.sdkinstall.mk:86: pre_install] Error 2
make: *** [/dpdk-stable-16.11.8/mk/rte.sdkroot.mk:101: install] Error 2
If you take a look at the /usr/include/x86_64-linux-gnu/bits/socket.h
, struct cmsghdr
is defined as following:
/* 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
};
What is __glibc_c99_flexarr_available
? Can I somehow make this available?
UPDATE 2
I tried to use this instead of musl-dev
but the error remains the same.
Then as suggested, I installed glibc
on my Alpine Linux to use it instead of musl
. Follow the steps here. Now I am getting errors like this:
In file included from /dpdk-stable-16.11.8/lib/librte_eal/linuxapp/eal/eal.c:48:0:
/usr/include/limits.h:124:26: fatal error: limits.h: No such file or directory
# include_next