[dpdk-dev] Inter-PMD dependencies when building shared libraries

Eads, Gage gage.eads at intel.com
Mon Oct 2 22:48:29 CEST 2017

I believe I've spotted an issue in the way inter-PMD dependencies are handled when building shared libraries. The depdirs_rule in mk/rte.subdir.mk relies on DEPDIRS-xyz containing the names of subdirectories that xyz depends on. In mk/rte.lib.mk, these DEPDIRS are converted into LDLIBS. This works when the subdirectory names match the library names (i.e. any of the libraries under lib/). However when the dependency is on a PMD, the subdirectory and library names don't match.

This is a problem, for example, in a patch for the net/octeontx PMD, which has a dependency on the event/octeontx PMD: http://dpdk.org/ml/archives/dev/2017-August/073983.html

I've reproduced this with a contrived example, by making the failsafe PMD depend on the NULL PMD in drivers/net/Makefile:
-DEPDIRS-failsafe = $(core-libs)
+DEPDIRS-failsafe = $(core-libs) librte_pmd_null

You can reproduce the build failure by running this command:
./devtools/test-build.sh x86_64-native-linuxapp-gcc+CONFIG_RTE_BUILD_SHARED_LIB

I'm no expert on DPDK's dependency handling code, but one option is to modify rte.lib.mk like so:
-LDLIBS += $(subst lib,-l,$(_LDDIRS))
+LDLIBS += $(subst lib,-l,$(filter lib%,$(_LDDIRS)))

Then you could put the PMD's directory name in DEPDIRs, and specify the depended-on library in the PMD's LDLIBS (as is done in the aforementioned net/octeontx PMD).



More information about the dev mailing list