我将libdpdk静态链接到我的应用程序,当我启动应用程序时,EAL init失败了。
日志:
EAL: Detected 80 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: No legacy callbacks, legacy socket not created
MBUF: error setting mempool handler
EAL: Error - exiting with code: 1
Cause: Cannot init packet mbuf pool Invalid argument
我使用以下命令在我的测试服务器中安装了DPDK-20.11。
# meson build
#cd build
#ninja ; ninja install
我以l2fwd Makefile为例构建了我的应用程序Makefile,不确定我缺少了什么。
注意寻求建议。
编辑-1
int main(int argc, char **argv)
{
int ret; unsigned lcore_id;
ret = rte_eal_init(argc, argv);
if (ret < 0)
rte_panic("Cannot init EAL\n");
struct rte_mempool *mp =
rte_pktmbuf_pool_create("packet_pool", 8192, 64, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
return 0;
}
如何建设
将makefile从make static
sudo ./a.out
应用程序
发布于 2021-06-02 08:22:51
从实时调试中编辑-1更新
目标操作系统: CENTOS 7 DPDK版本: 20.11.1
造成错误的原因有多种。
安装Mellanox lib谓词的libdpdk.pc
l2fwd Makefile option of make static
(meson -Dexamples=l2fwd build; ninja -C install)
不匹配从已安装的目标配置的 pkg-config。也不正确。为了修正错误,我们编辑了/usr/local/ fix 64/pkgconfig/libdpdk.pc,以包含-Wl,--whole-archive
和-Wl,--no-whole-archive
下的静态库。
它起作用了
#include <rte_cycles.h>
#include <rte_prefetch.h>
#include <rte_lcore.h>
#include <rte_per_lcore.h>
#include <rte_branch_prediction.h>
#include <rte_interrupts.h>
#include <rte_random.h>
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_string_fns.h>
int main(int argc, char **argv)
{
int ret; unsigned lcore_id;
ret = rte_eal_init(argc, argv);
if (ret < 0)
rte_panic("Cannot init EAL\n");
struct rte_mempool *mp =
rte_pktmbuf_pool_create("packet_pool", 8192, 64, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());
if (mp == NULL)
rte_panic("Cannot init EAL\n");
printf("done!!!!!!!!!!!!");
return 0;
}
构建:sudo make static
输出
$ sudo ./build/l2fwd
EAL: Detected 32 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: Probing VFIO support...
done!!!!!!!!!!!!
https://stackoverflow.com/questions/67795725
复制相似问题