[meta-dpdk] dpdk: Fix exmples and test _FORTIFY_SOURCE build failure

Submitted by zhe.he@windriver.com on July 10, 2019, 8:45 a.m. | Patch ID: 162933

Details

Message ID 1562748326-346221-1-git-send-email-zhe.he@windriver.com
State New
Headers show

Commit Message

zhe.he@windriver.com July 10, 2019, 8:45 a.m.
From: He Zhe <zhe.he@windriver.com>

When building examples and tests with GCC9, the following errors come up,

 error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
  382 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
cc1: all warnings being treated as errors

dpdk itself already appends -O3 the EXTRA_CFLAGS for some of those cases, but
dpdk.inc overwrites EXTRA_CFLAGS when evoking make. This patches adds it back.

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 recipes-extended/dpdk/dpdk.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/recipes-extended/dpdk/dpdk.inc b/recipes-extended/dpdk/dpdk.inc
index a0e081a..9dcec76 100644
--- a/recipes-extended/dpdk/dpdk.inc
+++ b/recipes-extended/dpdk/dpdk.inc
@@ -106,12 +106,12 @@  do_compile () {
 
 	cd ${S}/examples/
 	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \
-		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
+		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -O3 -I${STAGING_INCDIR}" \
 		   CROSS="${TARGET_PREFIX}" O="${S}/examples/$@/"
 
 	cd ${S}/test/
 	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \
-		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
+		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -O3 -I${STAGING_INCDIR}" \
 		   CROSS="${TARGET_PREFIX}" O="${S}/test/$@/"
 }
 

Comments

zhe.he@windriver.com July 18, 2019, 8:08 a.m.
Kindly ping.

Zhe

On 7/10/19 4:45 PM, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>
>
> When building examples and tests with GCC9, the following errors come up,
>
>  error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
>   382 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>       |    ^~~~~~~
> cc1: all warnings being treated as errors
>
> dpdk itself already appends -O3 the EXTRA_CFLAGS for some of those cases, but
> dpdk.inc overwrites EXTRA_CFLAGS when evoking make. This patches adds it back.
>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  recipes-extended/dpdk/dpdk.inc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/recipes-extended/dpdk/dpdk.inc b/recipes-extended/dpdk/dpdk.inc
> index a0e081a..9dcec76 100644
> --- a/recipes-extended/dpdk/dpdk.inc
> +++ b/recipes-extended/dpdk/dpdk.inc
> @@ -106,12 +106,12 @@ do_compile () {
>  
>  	cd ${S}/examples/
>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \
> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -O3 -I${STAGING_INCDIR}" \
>  		   CROSS="${TARGET_PREFIX}" O="${S}/examples/$@/"
>  
>  	cd ${S}/test/
>  	oe_runmake EXTRA_LDFLAGS="-L${STAGING_LIBDIR} --hash-style=gnu -fuse-ld=bfd" \
> -		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -I${STAGING_INCDIR}" \
> +		   EXTRA_CFLAGS="${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} -O3 -I${STAGING_INCDIR}" \
>  		   CROSS="${TARGET_PREFIX}" O="${S}/test/$@/"
>  }
>