在Ubuntu 16.04上构建DPDK 17.02和16.11时出错

时间:2018-03-05 07:54:38

标签: c ubuntu virtualbox ubuntu-16.04 dpdk

我正在尝试在Ubuntu 16.04 64位上构建DPDK 16.11.1和17.02.1,内核版本4.13.0在Windows 7主机上作为VirtualBox guest运行:

wwa@ssa:~/dpdk-stable-16.11.1$ uname -a
Linux osboxes 4.13.0-32-generic #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

DPDK配置为x86_64-native-linuxapp-gcc

wwa@ssa:~/dpdk-stable-16.11.1$ make config T=x86_64-native-linuxapp-gcc CC=gcc
Configuration done

在构建DPDK时,我收到以下编译错误:error: implicit declaration of function ‘pci_enable_msix’。这是完整的输出:

wwa@ssa:~/dpdk-stable-16.11.1$ make CC=gcc
== Build lib
== Build lib/librte_compat
  SYMLINK-FILE include/rte_compat.h
== Build lib/librte_eal
== Build lib/librte_eal/common
  SYMLINK-FILE include/generic/rte_atomic.h
  SYMLINK-FILE include/generic/rte_byteorder.h
  SYMLINK-FILE include/generic/rte_cycles.h
  SYMLINK-FILE include/generic/rte_prefetch.h
  SYMLINK-FILE include/generic/rte_spinlock.h
  SYMLINK-FILE include/generic/rte_memcpy.h
  SYMLINK-FILE include/generic/rte_cpuflags.h
  SYMLINK-FILE include/generic/rte_rwlock.h
  SYMLINK-FILE include/rte_branch_prediction.h
  SYMLINK-FILE include/rte_common.h
  SYMLINK-FILE include/rte_debug.h
  SYMLINK-FILE include/rte_eal.h
  SYMLINK-FILE include/rte_errno.h
  SYMLINK-FILE include/rte_launch.h
  SYMLINK-FILE include/rte_lcore.h
  SYMLINK-FILE include/rte_log.h
  SYMLINK-FILE include/rte_memory.h
  SYMLINK-FILE include/rte_memzone.h
  SYMLINK-FILE include/rte_pci.h
  SYMLINK-FILE include/rte_per_lcore.h
  SYMLINK-FILE include/rte_random.h
  SYMLINK-FILE include/rte_tailq.h
  SYMLINK-FILE include/rte_interrupts.h
  SYMLINK-FILE include/rte_alarm.h
  SYMLINK-FILE include/rte_string_fns.h
  SYMLINK-FILE include/rte_version.h
  SYMLINK-FILE include/rte_eal_memconfig.h
  SYMLINK-FILE include/rte_malloc_heap.h
  SYMLINK-FILE include/rte_hexdump.h
  SYMLINK-FILE include/rte_devargs.h
  SYMLINK-FILE include/rte_dev.h
  SYMLINK-FILE include/rte_vdev.h
  SYMLINK-FILE include/rte_pci_dev_feature_defs.h
  SYMLINK-FILE include/rte_pci_dev_features.h
  SYMLINK-FILE include/rte_malloc.h
  SYMLINK-FILE include/rte_keepalive.h
  SYMLINK-FILE include/rte_time.h
  SYMLINK-FILE include/rte_rwlock.h
  SYMLINK-FILE include/rte_memcpy.h
  SYMLINK-FILE include/rte_cycles.h
  SYMLINK-FILE include/rte_spinlock.h
  SYMLINK-FILE include/rte_atomic_32.h
  SYMLINK-FILE include/rte_vect.h
  SYMLINK-FILE include/rte_prefetch.h
  SYMLINK-FILE include/rte_byteorder_32.h
  SYMLINK-FILE include/rte_atomic_64.h
  SYMLINK-FILE include/rte_rtm.h
  SYMLINK-FILE include/rte_cpuflags.h
  SYMLINK-FILE include/rte_byteorder_64.h
  SYMLINK-FILE include/rte_atomic.h
  SYMLINK-FILE include/rte_byteorder.h
== Build lib/librte_eal/linuxapp
== Build lib/librte_eal/linuxapp/eal
  CC eal.o
  CC eal_hugepage_info.o
  CC eal_memory.o
  CC eal_thread.o
  CC eal_log.o
  CC eal_vfio.o
  CC eal_vfio_mp_sync.o
  CC eal_pci.o
  CC eal_pci_uio.o
  CC eal_pci_vfio.o
  CC eal_debug.o
  CC eal_lcore.o
  CC eal_timer.o
  CC eal_interrupts.o
  CC eal_alarm.o
  CC eal_common_lcore.o
  CC eal_common_timer.o
  CC eal_common_memzone.o
  CC eal_common_log.o
  CC eal_common_launch.o
  CC eal_common_vdev.o
  CC eal_common_pci.o
  CC eal_common_pci_uio.o
  CC eal_common_memory.o
  CC eal_common_tailqs.o
  CC eal_common_errno.o
  CC eal_common_cpuflags.o
  CC eal_common_string_fns.o
  CC eal_common_hexdump.o
  CC eal_common_devargs.o
  CC eal_common_dev.o
  CC eal_common_options.o
  CC eal_common_thread.o
  CC eal_common_proc.o
  CC rte_malloc.o
  CC malloc_elem.o
  CC malloc_heap.o
  CC rte_keepalive.o
  CC rte_cpuflags.o
  CC rte_spinlock.o
  AR librte_eal.a
  SYMLINK-FILE include/exec-env/rte_interrupts.h
  SYMLINK-FILE include/exec-env/rte_kni_common.h
  SYMLINK-FILE include/exec-env/rte_dom0_common.h
  INSTALL-LIB librte_eal.a
== Build lib/librte_eal/linuxapp/igb_uio
  AR      /home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio/built-in.o
  CC [M]  /home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.o
/home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c: In function ‘igbuio_pci_probe’:
/home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.c:383:7: error: implicit declaration of function ‘pci_enable_msix’ [-Werror=implicit-function-declaration]
   if (pci_enable_msix(dev, &msix_entry, 1) == 0) {
       ^
cc1: all warnings being treated as errors
/usr/src/linux-headers-4.13.0-32-generic/scripts/Makefile.build:315: recipe for target '/home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.o' failed
make[8]: *** [/home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio/igb_uio.o] Error 1
/usr/src/linux-headers-4.13.0-32-generic/Makefile:1550: recipe for target '_module_/home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio' failed
make[7]: *** [_module_/home/osboxes/dpdk-stable-16.11.1/build/build/lib/librte_eal/linuxapp/igb_uio] Error 2
Makefile:145: recipe for target 'sub-make' failed
make[6]: *** [sub-make] Error 2
/home/osboxes/dpdk-stable-16.11.1/mk/rte.module.mk:79: recipe for target 'igb_uio.ko' failed
make[5]: *** [igb_uio.ko] Error 2
/home/osboxes/dpdk-stable-16.11.1/mk/rte.subdir.mk:61: recipe for target 'igb_uio' failed
make[4]: *** [igb_uio] Error 2
/home/osboxes/dpdk-stable-16.11.1/mk/rte.subdir.mk:61: recipe for target 'linuxapp' failed
make[3]: *** [linuxapp] Error 2
/home/osboxes/dpdk-stable-16.11.1/mk/rte.subdir.mk:61: recipe for target 'librte_eal' failed
make[2]: *** [librte_eal] Error 2
/home/osboxes/dpdk-stable-16.11.1/mk/rte.sdkbuild.mk:78: recipe for target 'lib' failed
make[1]: *** [lib] Error 2
/home/osboxes/dpdk-stable-16.11.1/mk/rte.sdkroot.mk:126: recipe for target 'all' failed
make: *** [all] Error 2

有没有人知道为什么会中断? 我在16.11.1和17.02.1上都有同样的错误

1 个答案:

答案 0 :(得分:0)

我发现DPDK的新版本已经有了fix。我想你有几个选择:

  • the patch应用于您当地的DPDK代码
  • 使用较新的DPDK版本
  • 使用4.8以上的Linux内核

编辑:对于DPDK 16.11,应用补丁是不够的。

如果不能选择更改DPDK版本或移动到较旧的内核,那么您也可以更改以下代码,以pci_enable_msix_range而不是pci_enable_msix来调用lib/librte_eal/linuxapp/igb_uio/igb_uio.c: igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { struct rte_uio_pci_dev *udev; struct msix_entry msix_entry; int err; [...] switch (igbuio_intr_mode_preferred) { case RTE_INTR_MODE_MSIX: /* Only 1 msi-x vector needed */ msix_entry.entry = 0; if (pci_enable_msix(dev, &msix_entry, 1) == 0) { dev_dbg(&dev->dev, "using MSI-X"); udev->info.irq = msix_entry.vector; udev->mode = RTE_INTR_MODE_MSIX; break; } /* fall back to INTX */ [...] 。 3}}:

taskDyn