[dpdk-dev] [PATCH 5/6] build: symlink drivers to library directory

Bruce Richardson bruce.richardson at intel.com
Tue Dec 12 17:59:39 CET 2017


With the introduction of bus drivers, we now have a situation where
driver libraries will start to depend upon each other. Because of this,
the driver libs need to be discoverable by the dynamic loader.

There are three options to fix this:
1. Force the user to put the $libdir/dpdk/drivers folder into their
	library path.
2. Move all libraries from drivers sub-directory to $libdir.
3. Symlink all libraries from the subfolder to the main library dir.

Option 1 is not great for usability or distro packaging, and option 2
means that we can't have EAL load all drivers from a known path
automatically (as it would error out on non-PMD libs), so option 3 was
chosen as the best fix. The only downside is that on a "ninja uninstall"
the symlinks are not removed, as they are unknown to meson/ninja.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
 buildtools/symlink-drivers-solibs.sh | 16 ++++++++++++++++
 meson.build                          |  7 +++++++
 2 files changed, 23 insertions(+)
 create mode 100644 buildtools/symlink-drivers-solibs.sh

diff --git a/buildtools/symlink-drivers-solibs.sh b/buildtools/symlink-drivers-solibs.sh
new file mode 100644
index 000000000..f2657afe8
--- /dev/null
+++ b/buildtools/symlink-drivers-solibs.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+#
+# Copyright(c) 2017 Intel Corporation.
+# All rights reserved.
+#
+# SPDX-License-Identifier:        BSD-3-Clause
+
+# post-install script for meson/ninja builds to symlink the PMDs stored in
+# $libdir/dpdk/drivers/ to $libdir. This is needed as some PMDs depend on
+# others, e.g. PCI device PMDs depending on the PCI bus driver.
+
+# parameters to script are paths relative to install prefix:
+# 1. directory containing driver files e.g. lib64/dpdk/drivers
+# 2. directory for installed regular libs e.g. lib64
+ln -sf ${DESTDIR}/${MESON_INSTALL_PREFIX}/$1/* ${DESTDIR}/${MESON_INSTALL_PREFIX}/$2
diff --git a/meson.build b/meson.build
index 35d303d5a..04eea721d 100644
--- a/meson.build
+++ b/meson.build
@@ -77,6 +77,13 @@ configure_file(output: build_cfg,
 # them.
 dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
 
+# driver .so files often depend upon the bus drivers for their connect bus,
+# e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need
+# to be in the library path, so symlink the drivers from the main lib directory.
+meson.add_install_script('buildtools/symlink-drivers-solibs.sh',
+		driver_install_path,
+		get_option('libdir'))
+
 pkg = import('pkgconfig')
 pkg.generate(name: meson.project_name(),
 	filebase: 'lib' + meson.project_name().to_lower(),
-- 
2.14.3



More information about the dev mailing list