[OE-core] [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1

Rongqing Li rongqing.li at windriver.com
Thu Jun 25 06:59:07 UTC 2015



On 2015年06月24日 22:16, Burton, Ross wrote:
>
> On 24 June 2015 at 02:42, Rongqing Li <rongqing.li at windriver.com
> <mailto:rongqing.li at windriver.com>> wrote:
>
>     #warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     [-Werror=cpp]
>     |  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>
>
> So security_flags and debug build are mutually exclusive, and no amount
> of fixing recipes one by one will fix that.  This is a compiler warning
> (presumably the result being that fortify isn't enabled in debug builds)
> that the mmc-utils build is treating as an error, so a more reasonable
> fix would be to remove -Werror from the build which is a reasonable
> thing to do - only the developer of software should use -Werror as it
> causes untold amounts of pain on everyone else if something changes
> (say, gcc adds a new warning).
>
> Ross

How about the below patch

 From 6de0180f5332880195e315fdaf4899406dc54d99 Mon Sep 17 00:00:00 2001
From: Roy Li <rongqing.li at windriver.com>
Date: Thu, 25 Jun 2015 14:44:05 +0800
Subject: [PATCH] mmc-utils: fix the building failure when DEBUG_BUILD is 1

AM_CFLAGS in Makefile includes -D_FORTIFY_SOURCE=2 which will lead
to building failure when DEBUG_BUILD is 1.
Cancel the definition of _FORTIFY_SOURCE by passing -U_FORTIFY_SOURCE
via TARGET_CPPFLAGS; this does not effect the security cflags usage,
since the cflags is equal to:
CFLAGS="${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION} ${SECURITY_CFLAGS}"

Signed-off-by: Roy Li <rongqing.li at windriver.com>
---
  meta/recipes-devtools/mmc/mmc-utils_git.bb | 1 +
  1 file changed, 1 insertion(+)

diff --git a/meta/recipes-devtools/mmc/mmc-utils_git.bb 
b/meta/recipes-devtools/mmc/mmc-utils_git.bb
index bdb4fed..976bdf8 100644
--- a/meta/recipes-devtools/mmc/mmc-utils_git.bb
+++ b/meta/recipes-devtools/mmc/mmc-utils_git.bb
@@ -12,6 +12,7 @@ SRC_URI = 
"git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git;branc
             file://0001-mmc.h-don-t-include-asm-generic-int-ll64.h.patch"

  S = "${WORKDIR}/git"
+TARGET_CPPFLAGS += "-U_FORTIFY_SOURCE"

  do_install() {
      install -d ${D}${bindir}
-- 
1.9.1




More information about the Openembedded-core mailing list