[dpdk-users] Difference between APP and LIB

Paras Jha dreadiscool at gmail.com
Fri May 25 01:20:39 CEST 2018


Hello,

I actually had the exact same issue earlier!

The PMDs for DPDK mark their functions as constructors to get them to
initialize before main() - however, this causes the linker to (mistakenly)
believe there is no reference to the function and remove it from the binary.

The rte.app.mk already does this for you, but you can manually do it by
adding these flags during link stage

-Wl,--whole-archive -ldpdk -Wl,--no-whole-archive

Please note that this will embed ALL of dpdk into your binary - if you want
to fine-tune your binary to be smaller you might find it prudent to include
only the libs that are relevant to your application

Thanks

On Thu, May 24, 2018 at 6:35 AM Filip Janiszewski <
contact at filipjaniszewski.com> wrote:

> Hi,
>
> I've a weird situation: If I build my code using rte.app.mk, then
> calling rte_eal_init and rte_eth_dev_count returns the proper amount of
> NICs.
>
> The very same code built with rte.lib.mk into a *.a library does not
> recognize any NIC (If I include the lib in another test application that
> only invoke one function that trigger rte_eal_init and rte_eth_dev_count).
>
> The output of running rte_eal_init with rte.app.mk on my machine is:
>
> .
> EAL: Detected 8 lcore(s)
> EAL: Multi-process socket /var/run/.rte_unix
> EAL: Probing VFIO support...
> EAL: PCI device 0000:06:00.0 on NUMA socket -1
> EAL:   Invalid NUMA socket, default to 0
> EAL:   probe driver: 15b3:1015 net_mlx5
> PMD: net_mlx5: PCI information matches, using device "mlx5_0" (SR-IOV:
> false)
> PMD: net_mlx5: 1 port(s) detected
> PMD: net_mlx5: MPS is enabled
> PMD: net_mlx5: Reserved UAR address space: 0x7f0680000000
> PMD: net_mlx5: port 1 MAC address is 7c:fe:90:5e:79:fa
> EAL: PCI device 0000:06:00.1 on NUMA socket -1
> EAL:   Invalid NUMA socket, default to 0
> EAL:   probe driver: 15b3:1015 net_mlx5
> PMD: net_mlx5: PCI information matches, using device "mlx5_1" (SR-IOV:
> false)
> PMD: net_mlx5: 1 port(s) detected
> PMD: net_mlx5: MPS is enabled
> PMD: net_mlx5: port 1 MAC address is 7c:fe:90:5e:79:fb
> .
>
> While the same invocation with the code built using rte.lib.mk generate
> this output:
>
> .
> EAL: Detected 8 lcore(s)
> EAL: Multi-process socket /var/run/.rte_unix
> EAL: Probing VFIO support...
> .
>
> That's all -no more prints-, it seems that nothing else is done by the
> eal init function. What could be the problem here? As a background note:
> I'm trying to move my existing DPDK code into a lib, and this is already
> failing at the first step (eal init).
>
> Thanks
>
> --
> BR, Filip
> +48 666 369 823
>


More information about the users mailing list