DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson
@ 2017-12-19 10:52 Bruce Richardson
  2017-12-19 10:52 ` [dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bruce Richardson @ 2017-12-19 10:52 UTC (permalink / raw)
  To: dev; +Cc: bluca, jerin.jacob, hemant.agrawal, Bruce Richardson

While meson has built-in support for cross-compilation, there can be things
inside the meson.build files which cause problems in a cross-compile
environment. This patchset fixes a number of issues found when doing test
builds for arm architecture.

NOTE: this patchset only contains the fixes made to existing code. The
additional files needed for building for an arm target will be sent out as
an RFC patch separately, to be picked up by those more familiar with arm
architecture and hopefully turned into a production-ready patchset. The
resulting arm build was not test run on any platform.

Bruce Richardson (2):
  build: remove architecture flag as default C flag
  net/pcap: fix cross compilation

 app/test-pmd/meson.build          |  1 +
 buildtools/pmdinfogen/meson.build |  3 +--
 config/meson.build                |  8 ++++++--
 drivers/meson.build               |  2 +-
 drivers/net/i40e/meson.build      |  2 +-
 drivers/net/ixgbe/meson.build     |  2 +-
 drivers/net/pcap/meson.build      | 21 +++++++++++++++------
 examples/meson.build              |  2 +-
 lib/meson.build                   |  2 +-
 meson.build                       |  2 +-
 10 files changed, 29 insertions(+), 16 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag
  2017-12-19 10:52 [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Bruce Richardson
@ 2017-12-19 10:52 ` Bruce Richardson
  2017-12-19 10:52 ` [dpdk-dev] [PATCH 2/2] net/pcap: fix cross compilation Bruce Richardson
  2017-12-19 13:25 ` [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Luca Boccassi
  2 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2017-12-19 10:52 UTC (permalink / raw)
  To: dev; +Cc: bluca, jerin.jacob, hemant.agrawal, Bruce Richardson

Any flags added to the project args are automatically added to all builds,
both native and cross-compiled. This is not what we want for the -march
flag as a valid -march for the cross-compile is not valid for pmdinfogen
which is a native-build tool.

Instead we store the march flag as a variable, and add it to the default
cflags for all libs, drivers, examples, etc. This will allow pmdinfogen to
compile successfully in a cross-compilation environment.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 app/test-pmd/meson.build          | 1 +
 buildtools/pmdinfogen/meson.build | 3 +--
 config/meson.build                | 8 ++++++--
 drivers/meson.build               | 2 +-
 drivers/net/i40e/meson.build      | 2 +-
 drivers/net/ixgbe/meson.build     | 2 +-
 examples/meson.build              | 2 +-
 lib/meson.build                   | 2 +-
 meson.build                       | 2 +-
 9 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build
index b1820c77d..bef044c82 100644
--- a/app/test-pmd/meson.build
+++ b/app/test-pmd/meson.build
@@ -73,6 +73,7 @@ endif
 
 executable('dpdk-testpmd',
 	sources,
+	c_args: machine_arg,
 	link_whole: link_libs,
 	dependencies: dep_objs,
 	install_rpath: join_paths(get_option('prefix'), driver_install_path),
diff --git a/buildtools/pmdinfogen/meson.build b/buildtools/pmdinfogen/meson.build
index 1f4836013..026d9745b 100644
--- a/buildtools/pmdinfogen/meson.build
+++ b/buildtools/pmdinfogen/meson.build
@@ -34,5 +34,4 @@ pmdinfogen_inc += include_directories('../../lib/librte_pci')
 pmdinfogen = executable('pmdinfogen',
 	'pmdinfogen.c',
 	include_directories: pmdinfogen_inc,
-	native: true,
-	c_args: cflags)
+	native: true)
diff --git a/config/meson.build b/config/meson.build
index d7fb64422..d9a8e9f2c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -30,9 +30,13 @@
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 # set the machine type and cflags for it
-machine = get_option('machine')
+if meson.is_cross_build()
+	machine = host_machine.cpu()
+else
+	machine = get_option('machine')
+endif
 dpdk_conf.set('RTE_MACHINE', machine)
-add_project_arguments('-march=@0@'.format(machine), language: 'c')
+machine_arg = '-march=' + machine
 
 # use pthreads
 add_project_link_arguments('-pthread', language: 'c')
diff --git a/drivers/meson.build b/drivers/meson.build
index bb9a23523..da74e6c6b 100644
--- a/drivers/meson.build
+++ b/drivers/meson.build
@@ -50,7 +50,7 @@ foreach class:driver_classes
 		version = 1
 		sources = []
 		objs = []
-		cflags = []
+		cflags = [machine_arg]
 		includes = [include_directories(drv_path)]
 		# set up internal deps. Drivers can append/override as necessary
 		deps = std_deps
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index dc5e59d19..376e83a02 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -29,7 +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.
 
-cflags = ['-DPF_DRIVER',
+cflags += ['-DPF_DRIVER',
 	'-DVF_DRIVER',
 	'-DINTEGRATED_VF',
 	'-DX722_A0_SUPPORT']
diff --git a/drivers/net/ixgbe/meson.build b/drivers/net/ixgbe/meson.build
index 648494ee1..59ed1d7af 100644
--- a/drivers/net/ixgbe/meson.build
+++ b/drivers/net/ixgbe/meson.build
@@ -29,7 +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.
 
-cflags = ['-DRTE_LIBRTE_IXGBE_BYPASS']
+cflags += ['-DRTE_LIBRTE_IXGBE_BYPASS']
 
 subdir('base')
 objs = [base_objs]
diff --git a/examples/meson.build b/examples/meson.build
index d5397cdd0..bd20f9f61 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -37,7 +37,7 @@ endif
 foreach example: get_option('examples').split(',')
 	name = example
 	sources = []
-	cflags = []
+	cflags = [machine_arg]
 	ext_deps = []
 	includes = [include_directories(example)]
 	deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
diff --git a/lib/meson.build b/lib/meson.build
index d12816f55..4826699f1 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -59,7 +59,7 @@ foreach l:libraries
 	sources = []
 	headers = []
 	includes = []
-	cflags = []
+	cflags = [machine_arg]
 	objs = [] # other object files to link against, used e.g. for
 	          # instruction-set optimized versions of code
 
diff --git a/meson.build b/meson.build
index 04eea721d..5249a4d48 100644
--- a/meson.build
+++ b/meson.build
@@ -93,5 +93,5 @@ pkg.generate(name: meson.project_name(),
 			['-Wl,-Bdynamic'] + dpdk_extra_ldflags,
 	description: 'The Data Plane Development Kit (DPDK)',
 	subdirs: [get_option('include_subdir_arch'), '.'],
-	extra_cflags: ['-include "rte_config.h"', '-march=@0@'.format(machine)]
+	extra_cflags: ['-include "rte_config.h"', machine_arg]
 )
-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/2] net/pcap: fix cross compilation
  2017-12-19 10:52 [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Bruce Richardson
  2017-12-19 10:52 ` [dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag Bruce Richardson
@ 2017-12-19 10:52 ` Bruce Richardson
  2017-12-19 13:25 ` [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Luca Boccassi
  2 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2017-12-19 10:52 UTC (permalink / raw)
  To: dev; +Cc: bluca, jerin.jacob, hemant.agrawal, Bruce Richardson

The detection of pcap as a dependency involves invoking pcap-config to get
parameters - something not possible in a cross-compilation environment.
Therefore we need to just look for the presence of the library in a
cross-compilation environment and assume if the library is present we can
compile and link against it.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/net/pcap/meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/net/pcap/meson.build b/drivers/net/pcap/meson.build
index 2051ccab0..36f997c39 100644
--- a/drivers/net/pcap/meson.build
+++ b/drivers/net/pcap/meson.build
@@ -29,13 +29,22 @@
 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-pcap_dep = dependency('pcap', required: false)
-if pcap_dep.found() == true
-	ext_deps += pcap_dep
-elif find_program('pcap-config', required: false).found() == true
-	ext_deps += cc.find_library('pcap')
+if meson.is_cross_build()
+	pcap_dep = cc.find_library('pcap', required: false)
+	if pcap_dep.found()
+		ext_deps += pcap_dep
+	else
+		build = false
+	endif
 else
-	build = false
+	pcap_dep = dependency('pcap', required: false)
+	if pcap_dep.found() == true
+		ext_deps += pcap_dep
+	elif find_program('pcap-config', required: false).found() == true
+		ext_deps += cc.find_library('pcap')
+	else
+		build = false
+	endif
 endif
 sources = files('rte_eth_pcap.c')
 pkgconfig_extra_libs += '-lpcap'
-- 
2.14.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson
  2017-12-19 10:52 [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Bruce Richardson
  2017-12-19 10:52 ` [dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag Bruce Richardson
  2017-12-19 10:52 ` [dpdk-dev] [PATCH 2/2] net/pcap: fix cross compilation Bruce Richardson
@ 2017-12-19 13:25 ` Luca Boccassi
  2017-12-19 14:30   ` Bruce Richardson
  2 siblings, 1 reply; 5+ messages in thread
From: Luca Boccassi @ 2017-12-19 13:25 UTC (permalink / raw)
  To: Bruce Richardson, dev; +Cc: jerin.jacob, hemant.agrawal

On Tue, 2017-12-19 at 10:52 +0000, Bruce Richardson wrote:
> While meson has built-in support for cross-compilation, there can be
> things
> inside the meson.build files which cause problems in a cross-compile
> environment. This patchset fixes a number of issues found when doing
> test
> builds for arm architecture.
> 
> NOTE: this patchset only contains the fixes made to existing code.
> The
> additional files needed for building for an arm target will be sent
> out as
> an RFC patch separately, to be picked up by those more familiar with
> arm
> architecture and hopefully turned into a production-ready patchset.
> The
> resulting arm build was not test run on any platform.
> 
> Bruce Richardson (2):
>   build: remove architecture flag as default C flag
>   net/pcap: fix cross compilation
> 
>  app/test-pmd/meson.build          |  1 +
>  buildtools/pmdinfogen/meson.build |  3 +--
>  config/meson.build                |  8 ++++++--
>  drivers/meson.build               |  2 +-
>  drivers/net/i40e/meson.build      |  2 +-
>  drivers/net/ixgbe/meson.build     |  2 +-
>  drivers/net/pcap/meson.build      | 21 +++++++++++++++------
>  examples/meson.build              |  2 +-
>  lib/meson.build                   |  2 +-
>  meson.build                       |  2 +-
>  10 files changed, 29 insertions(+), 16 deletions(-)

Acked-by: Luca Boccassi <bluca@debian.org>

Looks good to me, thanks.

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson
  2017-12-19 13:25 ` [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Luca Boccassi
@ 2017-12-19 14:30   ` Bruce Richardson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2017-12-19 14:30 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev, jerin.jacob, hemant.agrawal

On Tue, Dec 19, 2017 at 01:25:17PM +0000, Luca Boccassi wrote:
> On Tue, 2017-12-19 at 10:52 +0000, Bruce Richardson wrote:
> > While meson has built-in support for cross-compilation, there can be
> > things
> > inside the meson.build files which cause problems in a cross-compile
> > environment. This patchset fixes a number of issues found when doing
> > test
> > builds for arm architecture.
> > 
> > NOTE: this patchset only contains the fixes made to existing code.
> > The
> > additional files needed for building for an arm target will be sent
> > out as
> > an RFC patch separately, to be picked up by those more familiar with
> > arm
> > architecture and hopefully turned into a production-ready patchset.
> > The
> > resulting arm build was not test run on any platform.
> > 
> > Bruce Richardson (2):
> >   build: remove architecture flag as default C flag
> >   net/pcap: fix cross compilation
> > 
> >  app/test-pmd/meson.build          |  1 +
> >  buildtools/pmdinfogen/meson.build |  3 +--
> >  config/meson.build                |  8 ++++++--
> >  drivers/meson.build               |  2 +-
> >  drivers/net/i40e/meson.build      |  2 +-
> >  drivers/net/ixgbe/meson.build     |  2 +-
> >  drivers/net/pcap/meson.build      | 21 +++++++++++++++------
> >  examples/meson.build              |  2 +-
> >  lib/meson.build                   |  2 +-
> >  meson.build                       |  2 +-
> >  10 files changed, 29 insertions(+), 16 deletions(-)
> 
> Acked-by: Luca Boccassi <bluca@debian.org>
> 
Applied to dpdk-next-build

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-19 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 10:52 [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Bruce Richardson
2017-12-19 10:52 ` [dpdk-dev] [PATCH 1/2] build: remove architecture flag as default C flag Bruce Richardson
2017-12-19 10:52 ` [dpdk-dev] [PATCH 2/2] net/pcap: fix cross compilation Bruce Richardson
2017-12-19 13:25 ` [dpdk-dev] [PATCH 0/2] Enable cross-compilation of DPDK with meson Luca Boccassi
2017-12-19 14:30   ` Bruce Richardson

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).