DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [RFCv2 39/40] build: fix driver dependencies for static builds
Date: Mon, 14 Aug 2017 10:52:07 +0100	[thread overview]
Message-ID: <20170814095208.166496-40-bruce.richardson@intel.com> (raw)
In-Reply-To: <20170814095208.166496-1-bruce.richardson@intel.com>

For static builds we need to better track the dependencies of drivers,
because, unlike with shared libs, the static libs don't track them
themselves. Because of this we have a new global list of external
dependencies which is used for creating the pkg-config file. We also move
the logic for what dependencies a driver has, and if those deps are met,
from the higher level build file to the drivers themselves.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/crypto/meson.build                         | 115 ++++++++++---------
 drivers/crypto/openssl/meson.build                 |   7 +-
 drivers/crypto/qat/meson.build                     |   7 +-
 drivers/mempool/meson.build                        | 110 +++++++++---------
 drivers/net/af_packet/meson.build                  |   3 +
 drivers/net/ark/meson.build                        |   1 +
 drivers/net/meson.build                            | 123 ++++++++++-----------
 drivers/net/pcap/meson.build                       |  11 +-
 lib/librte_eal/bsdapp/eal/meson.build              |   3 +-
 lib/librte_eal/common/include/arch/x86/meson.build |   1 +
 lib/librte_eal/linuxapp/eal/meson.build            |   3 +-
 meson.build                                        |   4 +-
 12 files changed, 211 insertions(+), 177 deletions(-)

diff --git a/drivers/crypto/meson.build b/drivers/crypto/meson.build
index 495e9350c..d27889088 100644
--- a/drivers/crypto/meson.build
+++ b/drivers/crypto/meson.build
@@ -29,75 +29,80 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-crypto_drivers = ['null']
-
-libcrypto_dep = dependency('libcrypto', required: false)
-if libcrypto_dep.found()
-	crypto_drivers += ['qat', 'openssl']
-endif
-
-foreach drv:crypto_drivers
-	dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+drivers = ['null', 'qat', 'openssl']
+std_deps = ['cryptodev'] # cryptodev pulls in all other needed deps
 
+foreach drv:drivers
 	# set up empty variables used for build
+	build = true # set to false to disable, e.g. missing deps
 	version = 1
 	sources = []
 	objs = []
 	cflags = []
 	includes = [include_directories(drv)]
-	# dependency managment. External deps managed using dependency
-	# objects, internal deps managed by name of lib
+	# set up internal deps. Drivers can append/override as necessary
+	deps = std_deps
+	# ext_deps: Stores external library dependency got
+	# using dependency() or cc.find_library(). For most cases, we
+	# probably also need to specify the "-l" flags in
+	# pkgconfig_extra_libs variable too, so that it can be reflected
+	# in the pkgconfig output for static builds
 	ext_deps = []
-	# set up standard deps. Drivers can append/override as necessary
-	deps = ['mbuf', 'cryptodev', 'kvargs']
+	pkgconfig_extra_libs = []
 
 	# pull in driver directory which should assign to each of the above
 	subdir(drv)
 
-	# get dependency objs from strings
-	dep_objs = ext_deps
-	foreach d:deps
-		dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
-	endforeach
-
-	# generate pmdinfo sources
-	pmdinfogen_srcs = run_command('grep', '--files-with-matches',
-		'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-	foreach src: pmdinfogen_srcs
-		out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
-		tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
-			src, include_directories: includes,
-			dependencies: dep_objs,
-			c_args: cflags)
-		sources += custom_target(out_filename,
-				command: [pmdinfo, tmp_lib.full_path(),
-					'@OUTPUT@', pmdinfogen],
-				output: out_filename,
-				depends: [pmdinfogen, tmp_lib])
-	endforeach
+	if build
+		dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
 
-	# now build the driver itself, and add to the drivers list
-	drv_name = 'rte_pmd_@0@'.format(drv)
-	version_map = '@0@/@1@/rte_pmd_@1@_version.map'.format(
-			meson.current_source_dir(), drv)
-	lib = library(drv_name,
-		sources,
-		objects: objs,
-		include_directories: includes,
-		dependencies: dep_objs,
-		c_args: cflags,
-		link_args: '-Wl,--version-script=' + version_map,
-		link_depends: version_map,
-		version: '@0@.1'.format(version),
-		install: true,
-		install_dir: driver_install_path)
+		# get dependency objs from strings
+		dep_objs = []
+		foreach d:deps
+			dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
+		endforeach
+		dep_objs += ext_deps
+		dpdk_extra_ldflags += pkgconfig_extra_libs
 
-	dpdk_drivers += lib
+		# generate pmdinfo sources
+		pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+			'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+		foreach src: pmdinfogen_srcs
+			out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+			tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+				src, include_directories: includes,
+				dependencies: dep_objs,
+				c_args: cflags)
+			sources += custom_target(out_filename,
+					command: [pmdinfo, tmp_lib.full_path(),
+						'@OUTPUT@', pmdinfogen],
+					output: out_filename,
+					depends: [pmdinfogen, tmp_lib])
+		endforeach
 
-	# create a dependency object and add it to the global dictionary so
-	# testpmd or other built-in apps can find it if necessary
-	set_variable('dep_rte_pmd_@0@'.format(drv),
-			declare_dependency(link_with: lib,
+		# now build the driver itself, and add to the drivers list
+		drv_name = 'rte_pmd_@0@'.format(drv)
+		version_map = '@0@/@1@/rte_pmd_@1@_version.map'.format(
+				meson.current_source_dir(), drv)
+		lib = library(drv_name,
+			sources,
+			objects: objs,
 			include_directories: includes,
-			dependencies: dep_objs))
+			dependencies: dep_objs,
+			c_args: cflags,
+			link_args: '-Wl,--version-script=' + version_map,
+			link_depends: version_map,
+			version: '@0@.1'.format(version),
+			install: true,
+			install_dir: driver_install_path)
+
+		dpdk_drivers += lib
+
+		# create a dependency object and add it to the global dictionary so
+		# testpmd or other built-in apps can find it if necessary
+		set_variable('dep_rte_pmd_@0@'.format(drv),
+				declare_dependency(link_with: lib,
+				include_directories: includes,
+				dependencies: dep_objs))
+	endif # build
 endforeach
diff --git a/drivers/crypto/openssl/meson.build b/drivers/crypto/openssl/meson.build
index b4337f85e..eb7f10226 100644
--- a/drivers/crypto/openssl/meson.build
+++ b/drivers/crypto/openssl/meson.build
@@ -29,5 +29,10 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+dep = dependency('libcrypto', required: false)
+if not dep.found()
+	build = false
+endif
 sources = files('rte_openssl_pmd.c', 'rte_openssl_pmd_ops.c')
-ext_deps += libcrypto_dep
+ext_deps += dep
+pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/crypto/qat/meson.build b/drivers/crypto/qat/meson.build
index aa124a0a0..7d959e7f5 100644
--- a/drivers/crypto/qat/meson.build
+++ b/drivers/crypto/qat/meson.build
@@ -29,8 +29,13 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+dep = dependency('libcrypto', required: false)
+if not dep.found()
+	build = false
+endif
 sources = files('qat_crypto.c', 'qat_qp.c',
 		'qat_adf/qat_algs_build_desc.c',
 		'rte_qat_cryptodev.c')
 includes += include_directories('qat_adf')
-ext_deps += libcrypto_dep
+ext_deps += dep
+pkgconfig_extra_libs += '-lcrypto'
diff --git a/drivers/mempool/meson.build b/drivers/mempool/meson.build
index 32763b326..cdacbe9be 100644
--- a/drivers/mempool/meson.build
+++ b/drivers/mempool/meson.build
@@ -29,70 +29,80 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-mempool_drivers = ['ring', 'stack']
-
-foreach drv:mempool_drivers
-	dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+drivers = ['ring', 'stack']
+std_deps = ['mempool']
 
+foreach drv:drivers
 	# set up empty variables used for build
+	build = true # set to false to disable, e.g. missing deps
 	version = 1
 	sources = []
 	objs = []
 	cflags = []
 	includes = [include_directories(drv)]
-	# dependency managment. External deps managed using dependency
-	# objects, internal deps managed by name of lib
+	# set up internal deps. Drivers can append/override as necessary
+	deps = std_deps
+	# ext_deps: Stores external library dependency got
+	# using dependency() or cc.find_library(). For most cases, we
+	# probably also need to specify the "-l" flags in
+	# pkgconfig_extra_libs variable too, so that it can be reflected
+	# in the pkgconfig output for static builds
 	ext_deps = []
-	# set up standard deps. Drivers can append/override as necessary
-	deps = ['eal', 'mempool', 'ring']
+	pkgconfig_extra_libs = []
 
 	# pull in driver directory which should assign to each of the above
 	subdir(drv)
 
-	# get dependency objs from strings
-	dep_objs = ext_deps
-	foreach d:deps
-		dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
-	endforeach
-
-	# generate pmdinfo sources
-	pmdinfogen_srcs = run_command('grep', '--files-with-matches',
-		'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-	foreach src: pmdinfogen_srcs
-		out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
-		tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
-			src, include_directories: includes,
-			dependencies: dep_objs,
-			c_args: cflags)
-		sources += custom_target(out_filename,
-				command: [pmdinfo, tmp_lib.full_path(),
-					'@OUTPUT@', pmdinfogen],
-				output: out_filename,
-				depends: [pmdinfogen, tmp_lib])
-	endforeach
+	if build
+		dpdk_conf.set('RTE_LIBRTE_@0@_MEMPOOL'.format(drv.to_upper()),1)
 
-	# now build the driver itself, and add to the drivers list
-	drv_name = 'rte_mempool_@0@'.format(drv)
-	version_map = '@0@/@1@/rte_mempool_@1@_version.map'.format(
-			meson.current_source_dir(), drv)
-	lib = library(drv_name,
-		sources,
-		objects: objs,
-		include_directories: includes,
-		dependencies: dep_objs,
-		c_args: cflags,
-		link_args: '-Wl,--version-script=' + version_map,
-		link_depends: version_map,
-		version: '@0@.1'.format(version),
-		install: true,
-		install_dir: driver_install_path)
+		# get dependency objs from strings
+		dep_objs = []
+		foreach d:deps
+			dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
+		endforeach
+		dep_objs += ext_deps
+		dpdk_extra_ldflags += pkgconfig_extra_libs
 
-	dpdk_drivers += lib
+		# generate pmdinfo sources
+		pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+			'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+		foreach src: pmdinfogen_srcs
+			out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+			tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+				src, include_directories: includes,
+				dependencies: dep_objs,
+				c_args: cflags)
+			sources += custom_target(out_filename,
+					command: [pmdinfo, tmp_lib.full_path(),
+						'@OUTPUT@', pmdinfogen],
+					output: out_filename,
+					depends: [pmdinfogen, tmp_lib])
+		endforeach
 
-	# create a dependency object and add it to the global dictionary so
-	# testpmd or other built-in apps can find it if necessary
-	set_variable('dep_rte_mempool_@0@'.format(drv),
-			declare_dependency(link_with: lib,
+		# now build the driver itself, and add to the drivers list
+		drv_name = 'rte_mempool_@0@'.format(drv)
+		version_map = '@0@/@1@/rte_mempool_@1@_version.map'.format(
+				meson.current_source_dir(), drv)
+		lib = library(drv_name,
+			sources,
+			objects: objs,
 			include_directories: includes,
-			dependencies: dep_objs))
+			dependencies: dep_objs,
+			c_args: cflags,
+			link_args: '-Wl,--version-script=' + version_map,
+			link_depends: version_map,
+			version: '@0@.1'.format(version),
+			install: true,
+			install_dir: driver_install_path)
+
+		dpdk_drivers += lib
+
+		# create a dependency object and add it to the global dictionary so
+		# testpmd or other built-in apps can find it if necessary
+		set_variable('dep_rte_mempool_@0@'.format(drv),
+				declare_dependency(link_with: lib,
+				include_directories: includes,
+				dependencies: dep_objs))
+	endif # build
 endforeach
diff --git a/drivers/net/af_packet/meson.build b/drivers/net/af_packet/meson.build
index 56ba22e73..c0dcc9b1f 100644
--- a/drivers/net/af_packet/meson.build
+++ b/drivers/net/af_packet/meson.build
@@ -29,4 +29,7 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+if host_machine.system() != 'linux'
+	build = false
+endif
 sources = files('rte_eth_af_packet.c')
diff --git a/drivers/net/ark/meson.build b/drivers/net/ark/meson.build
index a94d70383..385413af1 100644
--- a/drivers/net/ark/meson.build
+++ b/drivers/net/ark/meson.build
@@ -41,4 +41,5 @@ sources = files('ark_ddm.c',
 		'ark_udm.c')
 if host_machine.system() == 'linux'
 	ext_deps += cc.find_library('dl')
+	pkgconfig_extra_libs += '-ldl'
 endif
diff --git a/drivers/net/meson.build b/drivers/net/meson.build
index 2fb7577fa..cf06edce8 100644
--- a/drivers/net/meson.build
+++ b/drivers/net/meson.build
@@ -29,83 +29,80 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-net_drivers = ['ark', 'avp', 'i40e', 'ixgbe']
-
-# af_packet only works on linux
-if host_machine.system() == 'linux'
-	net_drivers += 'af_packet'
-endif
-
-pcap_dep = dependency('pcap', required: false)
-# pcap doesn't use pkg-config, but future meson versions should support picking
-# it up as a dependency. For older versions <0.42 use find_program instead
-if pcap_dep.found() or find_program('pcap-config', required: false).found()
-	net_drivers += 'pcap'
-endif
-
-foreach drv:net_drivers
-	dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
+drivers = ['af_packet', 'ark', 'avp', 'i40e', 'ixgbe', 'pcap']
+std_deps = ['ether', 'kvargs'] 	# 'ether' as dep, also pulls in mbuf, net, mempool, eal etc
 
+foreach drv:drivers
 	# set up empty variables used for build
+	build = true # set to false to disable, e.g. missing deps
 	version = 1
 	sources = []
 	objs = []
 	cflags = []
 	includes = [include_directories(drv)]
-	# dependency managment. External deps managed using dependency
-	# objects, internal deps managed by name of lib
+	# set up internal deps. Drivers can append/override as necessary
+	deps = std_deps
+	# ext_deps: Stores external library dependency got
+	# using dependency() or cc.find_library(). For most cases, we
+	# probably also need to specify the "-l" flags in
+	# pkgconfig_extra_libs variable too, so that it can be reflected
+	# in the pkgconfig output for static builds
 	ext_deps = []
-	# set up standard deps. Drivers can append/override as necessary
-	# 'ether' as dep, also pulls in mbuf, net, mempool, ring, eal etc
-	deps = ['ether', 'kvargs']
+	pkgconfig_extra_libs = []
 
 	# pull in driver directory which should assign to each of the above
 	subdir(drv)
 
-	# get dependency objs from strings
-	dep_objs = ext_deps
-	foreach d:deps
-		dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
-	endforeach
-
-	# generate pmdinfo sources
-	pmdinfogen_srcs = run_command('grep', '--files-with-matches',
-		'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
-	foreach src: pmdinfogen_srcs
-		out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
-		tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
-			src, include_directories: includes,
-			dependencies: dep_objs,
-			c_args: cflags)
-		sources += custom_target(out_filename,
-				command: [pmdinfo, tmp_lib.full_path(),
-					'@OUTPUT@', pmdinfogen],
-				output: out_filename,
-				depends: [pmdinfogen, tmp_lib])
-	endforeach
+	if build
+		dpdk_conf.set('RTE_LIBRTE_@0@_PMD'.format(drv.to_upper()),1)
 
-	# now build the driver itself, and add to the drivers list
-	drv_name = 'rte_pmd_@0@'.format(drv)
-	version_map = '@0@/@1@/rte_pmd_@1@_version.map'.format(
-			meson.current_source_dir(), drv)
-	lib = library(drv_name,
-		sources,
-		objects: objs,
-		include_directories: includes,
-		dependencies: dep_objs,
-		c_args: cflags,
-		link_args: '-Wl,--version-script=' + version_map,
-		link_depends: version_map,
-		version: '@0@.1'.format(version),
-		install: true,
-		install_dir: driver_install_path)
+		# get dependency objs from strings
+		dep_objs = []
+		foreach d:deps
+			dep_objs += [get_variable('dep_rte_' + d)] + dep_objs
+		endforeach
+		dep_objs += ext_deps
+		dpdk_extra_ldflags += pkgconfig_extra_libs
 
-	dpdk_drivers += lib
+		# generate pmdinfo sources
+		pmdinfogen_srcs = run_command('grep', '--files-with-matches',
+			'RTE_PMD_REGISTER_.*(.*)', sources).stdout().strip().split()
+		foreach src: pmdinfogen_srcs
+			out_filename = '@0@.pmd.c'.format(src.split('/')[-1])
+			tmp_lib = static_library('tmp_@0@'.format(src.underscorify()),
+				src, include_directories: includes,
+				dependencies: dep_objs,
+				c_args: cflags)
+			sources += custom_target(out_filename,
+					command: [pmdinfo, tmp_lib.full_path(),
+						'@OUTPUT@', pmdinfogen],
+					output: out_filename,
+					depends: [pmdinfogen, tmp_lib])
+		endforeach
 
-	# create a dependency object and add it to the global dictionary so
-	# testpmd or other built-in apps can find it if necessary
-	set_variable('dep_rte_pmd_@0@'.format(drv),
-			declare_dependency(link_with: lib,
+		# now build the driver itself, and add to the drivers list
+		drv_name = 'rte_pmd_@0@'.format(drv)
+		version_map = '@0@/@1@/rte_pmd_@1@_version.map'.format(
+				meson.current_source_dir(), drv)
+		lib = library(drv_name,
+			sources,
+			objects: objs,
 			include_directories: includes,
-			dependencies: dep_objs))
+			dependencies: dep_objs,
+			c_args: cflags,
+			link_args: '-Wl,--version-script=' + version_map,
+			link_depends: version_map,
+			version: '@0@.1'.format(version),
+			install: true,
+			install_dir: driver_install_path)
+
+		dpdk_drivers += lib
+
+		# create a dependency object and add it to the global dictionary so
+		# testpmd or other built-in apps can find it if necessary
+		set_variable('dep_rte_pmd_@0@'.format(drv),
+				declare_dependency(link_with: lib,
+				include_directories: includes,
+				dependencies: dep_objs))
+	endif # build
 endforeach
diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index a61668236..2cfe76410 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -29,10 +29,13 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-sources = files('rte_eth_pcap.c')
-
-if pcap_dep.found()
+pcap_dep = dependency('pcap', required: false)
+if pcap_dep.found() == true
 	ext_deps += pcap_dep
-else
+elif find_program('pcap-config', required: false).found() == true
 	ext_deps += cc.find_library('pcap')
+else
+	build = false
 endif
+sources = files('rte_eth_pcap.c')
+pkgconfig_extra_libs += '-lpcap'
diff --git a/lib/librte_eal/bsdapp/eal/meson.build b/lib/librte_eal/bsdapp/eal/meson.build
index 96ad1cef7..bc9c3f0cb 100644
--- a/lib/librte_eal/bsdapp/eal/meson.build
+++ b/lib/librte_eal/bsdapp/eal/meson.build
@@ -58,7 +58,8 @@ eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_source
 			install: true
 )
 
-dpdk_libraries += [eal_lib, '-pthread', eal_extra_link_arg]
+dpdk_libraries += eal_lib
+dpdk_extra_ldflags += ['-pthread', eal_extra_link_arg]
 
 rte_eal = declare_dependency(link_with: eal_lib,
 		include_directories: eal_inc,
diff --git a/lib/librte_eal/common/include/arch/x86/meson.build b/lib/librte_eal/common/include/arch/x86/meson.build
index bd162938c..ad0949a92 100644
--- a/lib/librte_eal/common/include/arch/x86/meson.build
+++ b/lib/librte_eal/common/include/arch/x86/meson.build
@@ -41,6 +41,7 @@ install_headers(
 	'rte_io.h',
 	'rte_memcpy.h',
 	'rte_prefetch.h',
+	'rte_pause.h',
 	'rte_rtm.h',
 	'rte_rwlock.h',
 	'rte_spinlock.h',
diff --git a/lib/librte_eal/linuxapp/eal/meson.build b/lib/librte_eal/linuxapp/eal/meson.build
index 30741519b..886bcbf0e 100644
--- a/lib/librte_eal/linuxapp/eal/meson.build
+++ b/lib/librte_eal/linuxapp/eal/meson.build
@@ -63,7 +63,8 @@ eal_lib = library('rte_eal', sources, eal_common_sources, eal_common_arch_source
 			install: true
 )
 
-dpdk_libraries += [eal_lib, '-pthread', eal_extra_link_arg]
+dpdk_libraries += eal_lib
+dpdk_extra_ldflags += ['-pthread', eal_extra_link_arg]
 
 rte_eal = declare_dependency(link_with: eal_lib,
 		include_directories: eal_inc,
diff --git a/meson.build b/meson.build
index dfcead92a..ca495ec7e 100644
--- a/meson.build
+++ b/meson.build
@@ -41,6 +41,7 @@ cc = meson.get_compiler('c')
 dpdk_conf = configuration_data()
 dpdk_libraries = []
 dpdk_drivers = []
+dpdk_extra_ldflags = []
 
 # for static libs, treat the drivers as regular libraries, otherwise
 # for shared libs, put them in a driver folder
@@ -74,7 +75,8 @@ configure_file(output: build_cfg,
 # for static builds, include the drivers as libs, and also any
 # other dependent libs that DPDK needs to link against
 if get_option('default_library') == 'static'
-	dpdk_libraries = dpdk_drivers + dpdk_libraries
+	dpdk_drivers = ['-Wl,--whole-archive'] + dpdk_drivers + ['-Wl,--no-whole-archive']
+	dpdk_libraries = dpdk_drivers + dpdk_libraries + dpdk_extra_ldflags
 endif
 
 pkg = import('pkgconfig')
-- 
2.13.4

  parent reply	other threads:[~2017-08-14 10:03 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14  9:51 [dpdk-dev] [RFCv2 00/40] Building DPDK with meson and ninja Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 01/40] build: initial hooks for using meson with DPDK Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 02/40] build: create pkg-config file for DPDK Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 03/40] build: build linuxapp EAL with meson and ninja Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 04/40] build: add EAL support under BSD Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 05/40] build: add core libraries to meson build system Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 06/40] build: add i40e driver to meson build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 07/40] build: add pmdinfogen to build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 08/40] build: generate list of sources for pmdinfogen Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 09/40] build: build i40e driver, including pmdinfo Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 10/40] build: install usertools scripts Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 11/40] build: simplify generation of pmd.c files Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 12/40] build: generalize net driver build to higher level Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 13/40] build: remove hard-coded enablement of vector driver Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 14/40] build: add ixgbe driver to build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 15/40] build: set up standard deps for drivers Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 16/40] build: add af_packet driver to build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 17/40] build: add pcap PMD support Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 18/40] build: add symbol version map file support to libs Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 19/40] build: build libraries in a loop for brevity Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 20/40] build: version library .so files Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 21/40] eal: add version information to meson build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 22/40] build: add mempool drivers to build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 23/40] build: add gro library to meson build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 24/40] build: tweak naming of pmd dependencies Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 25/40] build: track driver include directories properly Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 26/40] metrics: add metrics lib to meson build Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 27/40] build: track dependencies recursively Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 28/40] testpmd: compile testpmd with meson and ninja Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 29/40] crypto/null: rename the version file to standard Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 30/40] crypto/qat: remove dependency on ether library Bruce Richardson
2017-08-14  9:51 ` [dpdk-dev] [RFCv2 31/40] build: add cryptodev and some crypto drivers to build Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 32/40] igb_uio: add igb_uio to meson build Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 33/40] ip_frag: rename version file to standard name Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 34/40] build: add most remaining libraries to meson build Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 35/40] build: add packet framework libs " Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 36/40] acl: add acl library " Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 37/40] build: add ark and avp PMDs to build Bruce Richardson
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 38/40] build: fix static library builds with base code Bruce Richardson
2017-08-14  9:52 ` Bruce Richardson [this message]
2017-08-14  9:52 ` [dpdk-dev] [RFCv2 40/40] examples: allow basic sample app build using pkg-config Bruce Richardson
2017-08-15 10:56 ` [dpdk-dev] [RFCv2 00/40] Building DPDK with meson and ninja Luca Boccassi
2017-08-15 11:31   ` Bruce Richardson
2017-08-17 14:10 ` Marco Varlese
2017-08-17 15:25   ` Luca Boccassi
2017-08-18  8:35     ` Bruce Richardson
2017-08-18  8:52       ` Marco Varlese
2017-08-18  9:17         ` Marco Varlese
2017-08-18  9:33       ` Luca Boccassi
     [not found]   ` <1502983469.31476.3.camel@gmail.com>
2017-08-18  8:00     ` Marco Varlese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170814095208.166496-40-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).