Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
@ 2015-06-03  1:24 rongqing.li
  2015-06-10  8:58 ` Rongqing Li
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: rongqing.li @ 2015-06-03  1:24 UTC (permalink / raw)
  To: openembedded-core

From: Roy Li <rongqing.li@windriver.com>

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 CFLAGS

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

diff --git a/meta/recipes-devtools/mmc/mmc-utils_git.bb b/meta/recipes-devtools/mmc/mmc-utils_git.bb
index bdb4fed..dfe8902 100644
--- a/meta/recipes-devtools/mmc/mmc-utils_git.bb
+++ b/meta/recipes-devtools/mmc/mmc-utils_git.bb
@@ -13,6 +13,8 @@ SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git;branc
 
 S = "${WORKDIR}/git"
 
+CFLAGS += "-U_FORTIFY_SOURCE"
+
 do_install() {
     install -d ${D}${bindir}
     install -m 0755 mmc ${D}${bindir}
-- 
1.9.1



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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-03  1:24 [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1 rongqing.li
@ 2015-06-10  8:58 ` Rongqing Li
  2015-06-18  9:12 ` Rongqing Li
  2015-06-23 11:23 ` Burton, Ross
  2 siblings, 0 replies; 8+ messages in thread
From: Rongqing Li @ 2015-06-10  8:58 UTC (permalink / raw)
  To: openembedded-core

ping

-Roy

On 2015年06月03日 09:24, rongqing.li@windriver.com wrote:
> From: Roy Li <rongqing.li@windriver.com>
>
> 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 CFLAGS
>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
>   meta/recipes-devtools/mmc/mmc-utils_git.bb | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/meta/recipes-devtools/mmc/mmc-utils_git.bb b/meta/recipes-devtools/mmc/mmc-utils_git.bb
> index bdb4fed..dfe8902 100644
> --- a/meta/recipes-devtools/mmc/mmc-utils_git.bb
> +++ b/meta/recipes-devtools/mmc/mmc-utils_git.bb
> @@ -13,6 +13,8 @@ SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git;branc
>
>   S = "${WORKDIR}/git"
>
> +CFLAGS += "-U_FORTIFY_SOURCE"
> +
>   do_install() {
>       install -d ${D}${bindir}
>       install -m 0755 mmc ${D}${bindir}
>

-- 
Best Reagrds,
Roy | RongQing Li


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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-03  1:24 [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1 rongqing.li
  2015-06-10  8:58 ` Rongqing Li
@ 2015-06-18  9:12 ` Rongqing Li
  2015-06-23 11:23 ` Burton, Ross
  2 siblings, 0 replies; 8+ messages in thread
From: Rongqing Li @ 2015-06-18  9:12 UTC (permalink / raw)
  To: openembedded-core

ping

-R

On 2015年06月03日 09:24, rongqing.li@windriver.com wrote:
> From: Roy Li <rongqing.li@windriver.com>
>
> 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 CFLAGS
>
> Signed-off-by: Roy Li <rongqing.li@windriver.com>
> ---
>   meta/recipes-devtools/mmc/mmc-utils_git.bb | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/meta/recipes-devtools/mmc/mmc-utils_git.bb b/meta/recipes-devtools/mmc/mmc-utils_git.bb
> index bdb4fed..dfe8902 100644
> --- a/meta/recipes-devtools/mmc/mmc-utils_git.bb
> +++ b/meta/recipes-devtools/mmc/mmc-utils_git.bb
> @@ -13,6 +13,8 @@ SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git;branc
>
>   S = "${WORKDIR}/git"
>
> +CFLAGS += "-U_FORTIFY_SOURCE"
> +
>   do_install() {
>       install -d ${D}${bindir}
>       install -m 0755 mmc ${D}${bindir}
>

-- 
Best Reagrds,
Roy | RongQing Li


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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-03  1:24 [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1 rongqing.li
  2015-06-10  8:58 ` Rongqing Li
  2015-06-18  9:12 ` Rongqing Li
@ 2015-06-23 11:23 ` Burton, Ross
  2015-06-24  1:42   ` Rongqing Li
  2 siblings, 1 reply; 8+ messages in thread
From: Burton, Ross @ 2015-06-23 11:23 UTC (permalink / raw)
  To: rongqing.li@windriver.com; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

On 3 June 2015 at 02:24, <rongqing.li@windriver.com> wrote:

> +CFLAGS += "-U_FORTIFY_SOURCE"
>

So Richard made the valid point that this is disabling the security flags
in mmc-utils globally to fix builds in the very few cases when DEBUG_BUILD
is enabled.

Would it be sensible to have an include file that enables DEBUG_BUILD and
also tweaks CFLAGS where required?  I'd also like to see what the error is,
and if it can be fixed in the code for good instead.

Ross

[-- Attachment #2: Type: text/html, Size: 968 bytes --]

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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-23 11:23 ` Burton, Ross
@ 2015-06-24  1:42   ` Rongqing Li
  2015-06-24 14:16     ` Burton, Ross
  0 siblings, 1 reply; 8+ messages in thread
From: Rongqing Li @ 2015-06-24  1:42 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core



On 2015年06月23日 19:23, Burton, Ross wrote:
>
> On 3 June 2015 at 02:24, <rongqing.li@windriver.com
> <mailto:rongqing.li@windriver.com>> wrote:
>
>     +CFLAGS += "-U_FORTIFY_SOURCE"
>
>
> So Richard made the valid point that this is disabling the security
> flags in mmc-utils globally to fix builds in the very few cases when
> DEBUG_BUILD is enabled.
>
> Would it be sensible to have an include file that enables DEBUG_BUILD
> and also tweaks CFLAGS where required?  I'd also like to see what the
> error is, and if it can be fixed in the code for good instead.
>
> Ross

1. configuration

rli2@pek-hostel-deb02:/buildarea1/lirq/Yocto/poky/build$ tail -n1 
conf/local.conf
SELECTED_OPTIMIZATION = " -O0 "
rli2@pek-hostel-deb02:/buildarea1/lirq/Yocto/poky/build$

2. the error

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: Function failed: do_compile (log file is located at 
/buildarea1/lirq/Yocto/poky/build/tmp/work/armv5e-poky-linux-gnueabi/mmc-utils/0.1-r0/temp/log.do_compile.30117)
ERROR: Logfile of failure stored in: 
/buildarea1/lirq/Yocto/poky/build/tmp/work/armv5e-poky-linux-gnueabi/mmc-utils/0.1-r0/temp/log.do_compile.30117
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: make -j 24 -e MAKEFLAGS=
| arm-poky-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork 
--sysroot=/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm  -Wall 
-Werror -Wuninitialized -Wundef -D_FILE_OFFSET_BITS=64 
-D_FORTIFY_SOURCE=2   -O0  -Wp,-MMD,./.mmc.o.d,-MT,mmc.o -c mmc.c -o mmc.o
| arm-poky-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork 
--sysroot=/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm  -Wall 
-Werror -Wuninitialized -Wundef -D_FILE_OFFSET_BITS=64 
-D_FORTIFY_SOURCE=2   -O0  -Wp,-MMD,./.mmc_cmds.o.d,-MT,mmc_cmds.o -c 
mmc_cmds.c -o mmc_cmds.o
| arm-poky-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork 
--sysroot=/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm  -Wall 
-Werror -Wuninitialized -Wundef -D_FILE_OFFSET_BITS=64 
-D_FORTIFY_SOURCE=2   -O0 
-Wp,-MMD,3rdparty/hmac_sha/.hmac_sha2.o.d,-MT,3rdparty/hmac_sha/hmac_sha2.o 
-c 3rdparty/hmac_sha/hmac_sha2.c -o 3rdparty/hmac_sha/hmac_sha2.o
| arm-poky-linux-gnueabi-gcc  -march=armv5e -marm  -mthumb-interwork 
--sysroot=/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm  -Wall 
-Werror -Wuninitialized -Wundef -D_FILE_OFFSET_BITS=64 
-D_FORTIFY_SOURCE=2   -O0 
-Wp,-MMD,3rdparty/hmac_sha/.sha2.o.d,-MT,3rdparty/hmac_sha/sha2.o -c 
3rdparty/hmac_sha/sha2.c -o 3rdparty/hmac_sha/sha2.o
| make -C man
| make[1]: Entering directory 
`/buildarea1/lirq/Yocto/poky/build/tmp/work/armv5e-poky-linux-gnueabi/mmc-utils/0.1-r0/git/man'
| make[1]: Nothing to be done for `all'.
| make[1]: Leaving directory 
`/buildarea1/lirq/Yocto/poky/build/tmp/work/armv5e-poky-linux-gnueabi/mmc-utils/0.1-r0/git/man'
| In file included from 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/stdio.h:27:0,
|                  from mmc.c:20:
| 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/features.h:328:4: 
error: #warning _FORTIFY_SOURCE requires compiling with optimization 
(-O) [-Werror=cpp]
|  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|     ^
| In file included from 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/string.h:25:0,
|                  from 3rdparty/hmac_sha/hmac_sha2.c:38:
| 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/features.h:328:4: 
error: #warning _FORTIFY_SOURCE requires compiling with optimization 
(-O) [-Werror=cpp]
|  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|     ^
| In file included from 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/stdio.h:27:0,
|                  from mmc_cmds.c:17:
| 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/features.h:328:4: 
error: #warning _FORTIFY_SOURCE requires compiling with optimization 
(-O) [-Werror=cpp]
|  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|     ^
| In file included from 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/string.h:25:0,
|                  from 3rdparty/hmac_sha/sha2.c:42:
| 
/buildarea1/lirq/Yocto/poky/build/tmp/sysroots/qemuarm/usr/include/features.h:328:4: 
error: #warning _FORTIFY_SOURCE requires compiling with optimization 
(-O) [-Werror=cpp]
|  #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
|     ^
| cc1: all warnings being treated as errors
| make: *** [3rdparty/hmac_sha/hmac_sha2.o] Error 1
| make: *** Waiting for unfinished jobs....
| cc1: all warnings being treated as errors
| make: *** [mmc.o] Error 1
| cc1: all warnings being treated as errors
| make: *** [3rdparty/hmac_sha/sha2.o] Error 1
| cc1: all warnings being treated as errors
| make: *** [mmc_cmds.o] Error 1
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at 
/buildarea1/lirq/Yocto/poky/build/tmp/work/armv5e-poky-linux-gnueabi/mmc-utils/0.1-r0/temp/log.do_compile.30117)
ERROR: Task 6 
(/buildarea1/lirq/Yocto/poky/meta/recipes-devtools/mmc/mmc-utils_git.bb, 
do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 362 tasks of which 294 didn't need to be 
rerun and 1 failed.
Waiting for 0 running tasks to finish:


-R


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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-24  1:42   ` Rongqing Li
@ 2015-06-24 14:16     ` Burton, Ross
  2015-06-25  6:59       ` Rongqing Li
  0 siblings, 1 reply; 8+ messages in thread
From: Burton, Ross @ 2015-06-24 14:16 UTC (permalink / raw)
  To: Rongqing Li; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 784 bytes --]

On 24 June 2015 at 02:42, Rongqing Li <rongqing.li@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

[-- Attachment #2: Type: text/html, Size: 1192 bytes --]

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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-24 14:16     ` Burton, Ross
@ 2015-06-25  6:59       ` Rongqing Li
  2015-06-25  9:30         ` Burton, Ross
  0 siblings, 1 reply; 8+ messages in thread
From: Rongqing Li @ 2015-06-25  6:59 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core



On 2015年06月24日 22:16, Burton, Ross wrote:
>
> On 24 June 2015 at 02:42, Rongqing Li <rongqing.li@windriver.com
> <mailto:rongqing.li@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@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@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



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

* Re: [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1
  2015-06-25  6:59       ` Rongqing Li
@ 2015-06-25  9:30         ` Burton, Ross
  0 siblings, 0 replies; 8+ messages in thread
From: Burton, Ross @ 2015-06-25  9:30 UTC (permalink / raw)
  To: Rongqing Li; +Cc: OE-core

[-- Attachment #1: Type: text/plain, Size: 905 bytes --]

On 25 June 2015 at 07:59, Rongqing Li <rongqing.li@windriver.com> wrote:

> How about the below patch
>
> From 6de0180f5332880195e315fdaf4899406dc54d99 Mon Sep 17 00:00:00 2001
> From: Roy Li <rongqing.li@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}"
>

You're still globally turning off fortify when it's only a *warning* that
fortify and debug builds are mutually exclusive.  Disabling -Werror is the
best thing to do here.

Ross

[-- Attachment #2: Type: text/html, Size: 1447 bytes --]

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

end of thread, other threads:[~2015-06-25  9:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-03  1:24 [PATCH][v4] mmc-utils: fix the building failure when DEBUG_BUILD is 1 rongqing.li
2015-06-10  8:58 ` Rongqing Li
2015-06-18  9:12 ` Rongqing Li
2015-06-23 11:23 ` Burton, Ross
2015-06-24  1:42   ` Rongqing Li
2015-06-24 14:16     ` Burton, Ross
2015-06-25  6:59       ` Rongqing Li
2015-06-25  9:30         ` Burton, Ross

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