On 22-Nov-19 4:03 PM, Bruce Richardson wrote:
Add instructions on building DPDK and using the pkg-config file to the
linux GSG.

Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
---

<snip>

+
+Building Applications Using Installed DPDK
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When installed system-wide, DPDK provides a pkg-config file ``libdpdk.pc`` for 
applications to query as part of their build.
+It's recommended that the pkg-config file be used, rather than hard-coding the 
parameters (cflags/ldflags)
+for DPDK into the application build process.
+
+An example of how to query and use the pkg-config file can be found in the 
``Makefile`` of each of the example applications included with DPDK.
+A simplified example snippet is shown below, where the target binary name has 
been stored in the variable ``$(APP)``
+and the sources for that build are stored in ``$(SRCS-y)``.
+
+.. code-block:: makefile
+
+        PKGCONF = pkg-config
+
+        CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
+        LDFLAGS += $(shell $(PKGCONF) --libs libdpdk)
+
+        $(APP): $(SRCS-y) Makefile
+                $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS)

Also, as we have recently discovered, enabling DPDK libraries system-wide may not be so trivial after all, and may involve running ldconfig and/or modifying the /etc/ld.so.conf.d/ to include the locally built libraries. Should we include this as well? An argument can be made that this is distro-specific and shouldn't be in this guide, but these problems happen on distros that are common enough and are explicitly supported by DPDK, so perhaps /some/ note on possible issues with library search paths should be present?

--
Thanks,
Anatoly

Reply via email to