event/dlb2: fix meson build

Message ID 20221103152204.2706555-1-ferruh.yigit@amd.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series event/dlb2: fix meson build |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS

Commit Message

Ferruh Yigit Nov. 3, 2022, 3:22 p.m. UTC
  "meson setup" fails when '-Werror' compiler flag is enabled [1].
This is not a build error in the driver but a build error in meson
during "meson setup" stage.

This issue exists for a while but meson takes it as a warning and
ignores it unless '-Werror' compiler flag is provided.
Although it doesn't cause build error without '-Werror', relevant code
should be broken functionally, this patch fixes that too.

Build file using a variable to detect if macro defined, but that
variable is not set, looks like copy/paste error.
Replacing variable with hardcoded macro name.

[1]
Reproduced via `meson -Dc_args='-Werror' build`
in file 'build/meson-logs/meson-log.txt'

``
Running compile:
Working directory:  /tmp/tmpfrnw2x8z
Command line:  ccache cc /tmp/tmpfrnw2x8z/testfile.c -pipe -E -P
		-Werror -D_FILE_OFFSET_BITS=64 -P -O0 -march=native
Code:
        #ifndef dev/qat_crypto_pmd_gen4.c
        # define dev/qat_crypto_pmd_gen4.c
        #endif
        "MESON_GET_DEFINE_DELIMITER"
dev/qat_crypto_pmd_gen4.c
Compiler stdout:
         "MESON_GET_DEFINE_DELIMITER"
/qat_crypto_pmd_gen4.c/qat_crypto_pmd_gen4.c

Compiler stderr:
 /tmp/tmpfrnw2x8z/testfile.c:3:20:
    error: extra tokens at end of #ifndef directive [-Werror]
    3 |         #ifndef dev/qat_crypto_pmd_gen4.c
      |                    ^
/tmp/tmpfrnw2x8z/testfile.c:4:18:
    error: ISO C99 requires whitespace after the macro name [-Werror]
    4 |         # define dev/qat_crypto_pmd_gen4.c
      |                  ^~~
cc1: all warnings being treated as errors

drivers/event/dlb2/meson.build:41:10:
ERROR: Could not get define 'dev/qat_crypto_pmd_gen4.c'
``

Fixes: d0ce87e41cdc ("event/dlb2: support single 512B write of 4 QEs")
Cc: stable@dpdk.org

Reported-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
 drivers/event/dlb2/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon Nov. 3, 2022, 3:35 p.m. UTC | #1
03/11/2022 16:22, Ferruh Yigit:
> "meson setup" fails when '-Werror' compiler flag is enabled [1].
> This is not a build error in the driver but a build error in meson
> during "meson setup" stage.
> 
> This issue exists for a while but meson takes it as a warning and
> ignores it unless '-Werror' compiler flag is provided.
[...]
> Reproduced via `meson -Dc_args='-Werror' build`

Is it different of 'meson --werror" as in devtools/test-meson-builds.sh
or 'meson -Dwerror=true' as in .ci/linux-build.sh?
  
Ferruh Yigit Nov. 3, 2022, 4:22 p.m. UTC | #2
On 11/3/2022 3:35 PM, Thomas Monjalon wrote:
> 03/11/2022 16:22, Ferruh Yigit:
>> "meson setup" fails when '-Werror' compiler flag is enabled [1].
>> This is not a build error in the driver but a build error in meson
>> during "meson setup" stage.
>>
>> This issue exists for a while but meson takes it as a warning and
>> ignores it unless '-Werror' compiler flag is provided.
> [...]
>> Reproduced via `meson -Dc_args='-Werror' build`
> 
> Is it different of 'meson --werror" as in devtools/test-meson-builds.sh
> or 'meson -Dwerror=true' as in .ci/linux-build.sh?
> 

As I checked now, it seems there is a difference.

Via "meson --werror" & "meson -Dwerror=true",
'-Werror' flag is used to compile dpdk source code, but meson doesn't 
use the flag for its internal logic, so this seems more proper usage.

Via "meson -Dc_args='-Werror'" & "CFLAGS='-Werror' meson" usage,
'-Werror' flag is used both to compile dpdk code and meson internal 
logic, so that is why this usage cause build error.


And independent from the above usage difference, event/dlb2 meson file 
is wrong and this fix is required.
I assume 'dlb2_avx512.c' compiled because of the '-mavx512vl' fallback 
and that is why mentioned error is not detected.
  
Jerin Jacob Nov. 4, 2022, 11 a.m. UTC | #3
On Thu, Nov 3, 2022 at 9:52 PM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
>
> On 11/3/2022 3:35 PM, Thomas Monjalon wrote:
> > 03/11/2022 16:22, Ferruh Yigit:
> >> "meson setup" fails when '-Werror' compiler flag is enabled [1].
> >> This is not a build error in the driver but a build error in meson
> >> during "meson setup" stage.
> >>
> >> This issue exists for a while but meson takes it as a warning and
> >> ignores it unless '-Werror' compiler flag is provided.
> > [...]
> >> Reproduced via `meson -Dc_args='-Werror' build`
> >
> > Is it different of 'meson --werror" as in devtools/test-meson-builds.sh
> > or 'meson -Dwerror=true' as in .ci/linux-build.sh?
> >
>
> As I checked now, it seems there is a difference.
>
> Via "meson --werror" & "meson -Dwerror=true",
> '-Werror' flag is used to compile dpdk source code, but meson doesn't
> use the flag for its internal logic, so this seems more proper usage.
>
> Via "meson -Dc_args='-Werror'" & "CFLAGS='-Werror' meson" usage,
> '-Werror' flag is used both to compile dpdk code and meson internal
> logic, so that is why this usage cause build error.
>
>
> And independent from the above usage difference, event/dlb2 meson file
> is wrong and this fix is required.
> I assume 'dlb2_avx512.c' compiled because of the '-mavx512vl' fallback
> and that is why mentioned error is not detected.

+ @abdullah.sevincer@intel.com

Waiting from Ack from Abdullah to merge
  
Jerin Jacob Nov. 7, 2022, 2:22 p.m. UTC | #4
On Fri, Nov 4, 2022 at 4:30 PM Jerin Jacob <jerinjacobk@gmail.com> wrote:
>
> On Thu, Nov 3, 2022 at 9:52 PM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
> >
> > On 11/3/2022 3:35 PM, Thomas Monjalon wrote:
> > > 03/11/2022 16:22, Ferruh Yigit:
> > >> "meson setup" fails when '-Werror' compiler flag is enabled [1].
> > >> This is not a build error in the driver but a build error in meson
> > >> during "meson setup" stage.
> > >>
> > >> This issue exists for a while but meson takes it as a warning and
> > >> ignores it unless '-Werror' compiler flag is provided.
> > > [...]
> > >> Reproduced via `meson -Dc_args='-Werror' build`
> > >
> > > Is it different of 'meson --werror" as in devtools/test-meson-builds.sh
> > > or 'meson -Dwerror=true' as in .ci/linux-build.sh?
> > >
> >
> > As I checked now, it seems there is a difference.
> >
> > Via "meson --werror" & "meson -Dwerror=true",
> > '-Werror' flag is used to compile dpdk source code, but meson doesn't
> > use the flag for its internal logic, so this seems more proper usage.
> >
> > Via "meson -Dc_args='-Werror'" & "CFLAGS='-Werror' meson" usage,
> > '-Werror' flag is used both to compile dpdk code and meson internal
> > logic, so that is why this usage cause build error.
> >
> >
> > And independent from the above usage difference, event/dlb2 meson file
> > is wrong and this fix is required.
> > I assume 'dlb2_avx512.c' compiled because of the '-mavx512vl' fallback
> > and that is why mentioned error is not detected.
>
> + @abdullah.sevincer@intel.com
>
> Waiting from Ack from Abdullah to merge

No reply. Patch looks reasonable to me.

Applied to dpdk-next-net-eventdev/for-main. Thanks
  

Patch

diff --git a/drivers/event/dlb2/meson.build b/drivers/event/dlb2/meson.build
index 20ef159ab327..a2e60273c516 100644
--- a/drivers/event/dlb2/meson.build
+++ b/drivers/event/dlb2/meson.build
@@ -38,7 +38,7 @@  if binutils_ok
 
     # check if all required flags already enabled (variant a).
     dlb2_avx512_on = false
-    if cc.get_define(f, args: machine_args) == '__AVX512VL__'
+    if cc.get_define('__AVX512VL__', args: machine_args) != ''
         dlb2_avx512_on = true
     endif