DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] build: fix cross compilation to x86_64
@ 2026-10-05 12:59 Adrian Schollmeyer
  2026-10-05 13:14 ` Morten Brørup
  2026-10-07  9:26 ` [PATCH v2] " Adrian Schollmeyer
  0 siblings, 2 replies; 5+ messages in thread
From: Adrian Schollmeyer @ 2026-10-05 12:59 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Adrian Schollmeyer

If x86_64 is specified as target CPU instruction set (e.g. when
cross-compiling *to* x86_64), the cpu_instruction_set may be set to
x86_64, e.g. if it is derived from a Meson crossfile. However, while
Meson uses "x86_64" as name for the x86_64 architecture, compiler
options accept only "x86-64".

Introduce a conditional for handling this special case by changing
cpu_instruction_set to the march-compatible value.

Signed-off-by: Adrian Schollmeyer <a.schollmeyer@syseleven.de>
---
 config/meson.build | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/config/meson.build b/config/meson.build
index dcb84ebd13..238d6cae0c 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -177,6 +177,11 @@ if not is_ms_compiler
         machine_args += '-mtune=' + cpu_instruction_set
         compiler_arch_support = cc.has_argument('-mcpu=' + cpu_instruction_set)
     else
+        # Meson uses x86_64, but compilers expect x86-64.
+        # See https://mesonbuild.com/Reference-tables.html#cpu-families
+        if cpu_instruction_set == 'x86_64'
+            cpu_instruction_set = 'x86-64'
+        endif
         machine_args += '-march=' + cpu_instruction_set
         # arm manages generic/auto config in config/arm/meson.build
         if cpu_instruction_set != 'generic' and cpu_instruction_set != 'auto'
--
2.43.0


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

* RE: [PATCH] build: fix cross compilation to x86_64
  2026-10-05 12:59 [PATCH] build: fix cross compilation to x86_64 Adrian Schollmeyer
@ 2026-10-05 13:14 ` Morten Brørup
  2026-10-05 14:30   ` Bruce Richardson
  2026-10-07  9:26 ` [PATCH v2] " Adrian Schollmeyer
  1 sibling, 1 reply; 5+ messages in thread
From: Morten Brørup @ 2026-10-05 13:14 UTC (permalink / raw)
  To: Adrian Schollmeyer, Bruce Richardson; +Cc: dev

> If x86_64 is specified as target CPU instruction set (e.g. when
> cross-compiling *to* x86_64), the cpu_instruction_set may be set to
> x86_64, e.g. if it is derived from a Meson crossfile. However, while
> Meson uses "x86_64" as name for the x86_64 architecture, compiler
> options accept only "x86-64".
> 
> Introduce a conditional for handling this special case by changing
> cpu_instruction_set to the march-compatible value.
> 
> Signed-off-by: Adrian Schollmeyer <a.schollmeyer@syseleven.de>
> ---
>  config/meson.build | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/config/meson.build b/config/meson.build
> index dcb84ebd13..238d6cae0c 100644
> --- a/config/meson.build
> +++ b/config/meson.build
> @@ -177,6 +177,11 @@ if not is_ms_compiler
>          machine_args += '-mtune=' + cpu_instruction_set
>          compiler_arch_support = cc.has_argument('-mcpu=' +
> cpu_instruction_set)
>      else
> +        # Meson uses x86_64, but compilers expect x86-64.
> +        # See https://mesonbuild.com/Reference-tables.html#cpu-
> families
> +        if cpu_instruction_set == 'x86_64'
> +            cpu_instruction_set = 'x86-64'

Not sure, but maybe: 'x86-64-v2'?

Ref:
https://www.phoronix.com/news/GCC-11-x86-64-Feature-Levels

> +        endif
>          machine_args += '-march=' + cpu_instruction_set
>          # arm manages generic/auto config in config/arm/meson.build
>          if cpu_instruction_set != 'generic' and cpu_instruction_set !=
> 'auto'
> --
> 2.43.0


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

* Re: [PATCH] build: fix cross compilation to x86_64
  2026-10-05 13:14 ` Morten Brørup
@ 2026-10-05 14:30   ` Bruce Richardson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2026-10-05 14:30 UTC (permalink / raw)
  To: Morten Brørup; +Cc: Adrian Schollmeyer, dev

On Mon, Oct 05, 2026 at 03:14:17PM +0200, Morten Brørup wrote:
> > If x86_64 is specified as target CPU instruction set (e.g. when
> > cross-compiling *to* x86_64), the cpu_instruction_set may be set to
> > x86_64, e.g. if it is derived from a Meson crossfile. However, while
> > Meson uses "x86_64" as name for the x86_64 architecture, compiler
> > options accept only "x86-64".
> > 
> > Introduce a conditional for handling this special case by changing
> > cpu_instruction_set to the march-compatible value.
> > 
> > Signed-off-by: Adrian Schollmeyer <a.schollmeyer@syseleven.de>
> > ---
> >  config/meson.build | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/config/meson.build b/config/meson.build
> > index dcb84ebd13..238d6cae0c 100644
> > --- a/config/meson.build
> > +++ b/config/meson.build
> > @@ -177,6 +177,11 @@ if not is_ms_compiler
> >          machine_args += '-mtune=' + cpu_instruction_set
> >          compiler_arch_support = cc.has_argument('-mcpu=' +
> > cpu_instruction_set)
> >      else
> > +        # Meson uses x86_64, but compilers expect x86-64.
> > +        # See https://mesonbuild.com/Reference-tables.html#cpu-
> > families
> > +        if cpu_instruction_set == 'x86_64'
> > +            cpu_instruction_set = 'x86-64'
> 
> Not sure, but maybe: 'x86-64-v2'?
> 
> Ref:
> https://www.phoronix.com/news/GCC-11-x86-64-Feature-Levels
> 
Yes, probably best to use that. We require SSE4 as a minimum instruction
set for DPDK build.

/Bruce

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

* [PATCH v2] build: fix cross compilation to x86_64
  2026-10-05 12:59 [PATCH] build: fix cross compilation to x86_64 Adrian Schollmeyer
  2026-10-05 13:14 ` Morten Brørup
@ 2026-10-07  9:26 ` Adrian Schollmeyer
  2026-10-07 10:39   ` Bruce Richardson
  1 sibling, 1 reply; 5+ messages in thread
From: Adrian Schollmeyer @ 2026-10-07  9:26 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, Adrian Schollmeyer

If x86_64 is specified as target CPU instruction set (e.g. when
cross-compiling *to* x86_64), the cpu_instruction_set may be set to
x86_64, e.g. if it is derived from a Meson crossfile. However, while
Meson uses "x86_64" as name for the x86_64 architecture, compiler
options accept only "x86-64".

Introduce a conditional for handling this special case by changing
cpu_instruction_set to the march-compatible value.

Signed-off-by: Adrian Schollmeyer <a.schollmeyer@syseleven.de>
---

v2 changes:

 * more explicit comment about GCC/Clang requiring x86-64
 * switch to x86-64-v2 feature level

 config/meson.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/config/meson.build b/config/meson.build
index dcb84ebd13..4682729bad 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -177,6 +177,12 @@ if not is_ms_compiler
         machine_args += '-mtune=' + cpu_instruction_set
         compiler_arch_support = cc.has_argument('-mcpu=' + cpu_instruction_set)
     else
+        # Meson uses x86_64, but GCC/Clang expect x86-64.
+        # See https://mesonbuild.com/Reference-tables.html#cpu-families
+        if cpu_instruction_set == 'x86_64'
+            # Feature level derived from DPDK minimum CPU feature requirements
+            cpu_instruction_set = 'x86-64-v2'
+        endif
         machine_args += '-march=' + cpu_instruction_set
         # arm manages generic/auto config in config/arm/meson.build
         if cpu_instruction_set != 'generic' and cpu_instruction_set != 'auto'
--
2.43.0


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

* Re: [PATCH v2] build: fix cross compilation to x86_64
  2026-10-07  9:26 ` [PATCH v2] " Adrian Schollmeyer
@ 2026-10-07 10:39   ` Bruce Richardson
  0 siblings, 0 replies; 5+ messages in thread
From: Bruce Richardson @ 2026-10-07 10:39 UTC (permalink / raw)
  To: Adrian Schollmeyer; +Cc: dev

On Wed, Oct 07, 2026 at 11:26:29AM +0200, Adrian Schollmeyer wrote:
> If x86_64 is specified as target CPU instruction set (e.g. when
> cross-compiling *to* x86_64), the cpu_instruction_set may be set to
> x86_64, e.g. if it is derived from a Meson crossfile. However, while
> Meson uses "x86_64" as name for the x86_64 architecture, compiler
> options accept only "x86-64".
> 
> Introduce a conditional for handling this special case by changing
> cpu_instruction_set to the march-compatible value.
> 
> Signed-off-by: Adrian Schollmeyer <a.schollmeyer@syseleven.de>
> ---
> 
> v2 changes:
> 
>  * more explicit comment about GCC/Clang requiring x86-64
>  * switch to x86-64-v2 feature level
> 
>  config/meson.build | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

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

end of thread, other threads:[~2026-10-07 10:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 12:59 [PATCH] build: fix cross compilation to x86_64 Adrian Schollmeyer
2026-10-05 13:14 ` Morten Brørup
2026-10-05 14:30   ` Bruce Richardson
2026-10-07  9:26 ` [PATCH v2] " Adrian Schollmeyer
2026-10-07 10:39   ` Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox