Fix RISC-V builds

Message ID 20220530141103.42444-1-heinrich.schuchardt@canonical.com (mailing list archive)
State Not Applicable, archived
Delegated to: Thomas Monjalon
Headers
Series Fix RISC-V builds |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/iol-testing warning apply patch failure
ci/Intel-compilation warning apply issues

Commit Message

Heinrich Schuchardt May 30, 2022, 2:11 p.m. UTC
  Building on RISC-V results in an error

    cc: error: ‘-march=native’: ISA string must begin with rv32 or rv64

As GCC does not support -march=native on RISC-V avoid this argument.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

David Marchand June 8, 2022, 7:23 a.m. UTC | #1
Hello,

On Mon, May 30, 2022 at 4:11 PM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Building on RISC-V results in an error
>
>     cc: error: ‘-march=native’: ISA string must begin with rv32 or rv64
>
> As GCC does not support -march=native on RISC-V avoid this argument.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

I am finalizing the RISC-V merge for -rc1, this fix can be merged
later as we only have cross compilation in GHA with the initial
series.


> ---
>  meson.build | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 507c146..bbf4650 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -17,7 +17,10 @@ pktgen_conf = configuration_data()
>  # set up some global vars for compiler, platform, configuration, etc.
>  cc = meson.get_compiler('c')
>
> -add_project_arguments('-march=native', language: 'c')
> +target = target_machine.cpu_family()
> +if (target != 'riscv64')
> +    add_project_arguments('-march=native', language: 'c')
> +endif

Would the below snippet work?

cc.has_argument('-march=native'')
    add_project_arguments('-march=native', language: 'c')
endif

>
>  if get_option('enable-avx') and cc.has_argument('-mavx')
>      add_project_arguments('-mavx', language: 'c')
> --
> 2.36.1
>
  
Heinrich Schuchardt June 8, 2022, 9:56 a.m. UTC | #2
On 6/8/22 09:23, David Marchand wrote:
> Hello,
> 
> On Mon, May 30, 2022 at 4:11 PM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> Building on RISC-V results in an error
>>
>>      cc: error: ‘-march=native’: ISA string must begin with rv32 or rv64
>>
>> As GCC does not support -march=native on RISC-V avoid this argument.
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> 
> I am finalizing the RISC-V merge for -rc1, this fix can be merged
> later as we only have cross compilation in GHA with the initial
> series.

Keith Wiles <keith.wiles@intel.com> already merged this patch into 
PktGen-DPDK.

@Keith
Maybe CONTRIBUTING.txt in that package should suggest a title prefix for 
PktGen patches to avoid future confusion.

Best regards

Heinrich

> 
> 
>> ---
>>   meson.build | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 507c146..bbf4650 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -17,7 +17,10 @@ pktgen_conf = configuration_data()
>>   # set up some global vars for compiler, platform, configuration, etc.
>>   cc = meson.get_compiler('c')
>>
>> -add_project_arguments('-march=native', language: 'c')
>> +target = target_machine.cpu_family()
>> +if (target != 'riscv64')
>> +    add_project_arguments('-march=native', language: 'c')
>> +endif
> 
> Would the below snippet work?
> 
> cc.has_argument('-march=native'')
>      add_project_arguments('-march=native', language: 'c')
> endif
> 
>>
>>   if get_option('enable-avx') and cc.has_argument('-mavx')
>>       add_project_arguments('-mavx', language: 'c')
>> --
>> 2.36.1
>>
> 
>
  
David Marchand June 8, 2022, 10:01 a.m. UTC | #3
On Wed, Jun 8, 2022 at 11:56 AM Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> On 6/8/22 09:23, David Marchand wrote:
> > Hello,
> >
> > On Mon, May 30, 2022 at 4:11 PM Heinrich Schuchardt
> > <heinrich.schuchardt@canonical.com> wrote:
> >>
> >> Building on RISC-V results in an error
> >>
> >>      cc: error: ‘-march=native’: ISA string must begin with rv32 or rv64
> >>
> >> As GCC does not support -march=native on RISC-V avoid this argument.
> >>
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> >
> > I am finalizing the RISC-V merge for -rc1, this fix can be merged
> > later as we only have cross compilation in GHA with the initial
> > series.
>
> Keith Wiles <keith.wiles@intel.com> already merged this patch into
> PktGen-DPDK.

It was hard to tell, from just this mail...

>
> @Keith
> Maybe CONTRIBUTING.txt in that package should suggest a title prefix for
> PktGen patches to avoid future confusion.

Yes, and I marked the patch as Not applicable in patchwork.
  
Heinrich Schuchardt June 8, 2022, 11:13 a.m. UTC | #4
On 6/8/22 12:01, David Marchand wrote:
> On Wed, Jun 8, 2022 at 11:56 AM Heinrich Schuchardt
> <heinrich.schuchardt@canonical.com> wrote:
>>
>> @Keith
>> Maybe CONTRIBUTING.txt in that package should suggest a title prefix for
>> PktGen patches to avoid future confusion.
> 
> Yes, and I marked the patch as Not applicable in patchwork.

See https://github.com/pktgen/Pktgen-DPDK/pull/110

Best regards

Heinrich
  

Patch

diff --git a/meson.build b/meson.build
index 507c146..bbf4650 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,10 @@  pktgen_conf = configuration_data()
 # set up some global vars for compiler, platform, configuration, etc.
 cc = meson.get_compiler('c')
 
-add_project_arguments('-march=native', language: 'c')
+target = target_machine.cpu_family()
+if (target != 'riscv64')
+    add_project_arguments('-march=native', language: 'c')
+endif
 
 if get_option('enable-avx') and cc.has_argument('-mavx')
     add_project_arguments('-mavx', language: 'c')