[dpdk-dev] Compiling DPDK 17.02 using musl instead of glibc

Raphael Cohn raphael.cohn at stormmq.com
Tue Mar 14 08:45:19 CET 2017


Hi,

I've managed to compile DPDK 17.02 for musl instead of glibc. In essence, I
had to change a number of files. I've not prepared a patch at this stage,
but I wanted to share my changes with the list so that others can benefit.

Firstly, I apply the following minor sed edits:-

    # Assumes glibc
    sed -i -e 's;#include <rte_per_lcore.h>;#include <sched.h>\n#include
<rte_per_lcore.h>;g' lib/librte_eal/common/include/rte_lcore.h
    sed -i -e 's;#include <string.h>;#include <string.h>\n#include
<fcntl.h>;g' lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
    sed -i -e 's;#include <errno.h>;#include <errno.h>\n#include
<fcntl.h>;g' lib/librte_eal/linuxapp/eal/eal_memory.c
    sed -i -e 's;#include <string.h>;#include <string.h>\n#include
<sys/sysmacros.h>\n;g' lib/librte_eal/linuxapp/eal/eal_pci_uio.c
    sed -i -e 's;#define PAGE_SIZE;#undef PAGE_SIZE\n#define PAGE_SIZE;g'
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
    sed -i -e 's;#include <string.h>;#include <string.h>\n#include
<fcntl.h>;g' app/test/test_eal_flags.c

    # ?
    sed -i -e 's;uint hash_key_len;uint8_t hash_key_len;g'
app/test-pmd/testpmd.c app/test-pmd/testpmd.h app/t

Secondly, I replaced these files with dummies as they use glibc
functionality without equivalence:-
lib/librte_eal/linuxapp/eal/eal_debug.c
lib/librte_eal/linuxapp/eal/eal_log.c
lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c

That's not ideal

Lastly, I also had to modify musl itself:-
- Musl does not ship sys/queue.h. Perhaps in future DPDK could ship its own
copy of this? Musl will not be shipping it, either
- Musl lacks some functions in bits/io.h for x86_64. They seem open to
adding them, but need a contribution from someone knowledgeable (
http://www.openwall.com/lists/musl/2015/11/10/1). There is a patch shipped
with OSv for it.

Raph


More information about the dev mailing list