All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-networking][PATCH 1/2] c-ares: use our compilation flags
@ 2016-07-15 12:54 git
  2016-07-15 12:54 ` [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares git
  0 siblings, 1 reply; 5+ messages in thread
From: git @ 2016-07-15 12:54 UTC (permalink / raw)
  To: openembedded-devel

From: André Draszik <adraszik@tycoint.com>

If not requested otherwise as ./configure option, c-ares will strip
any -g from CFLAGS / CPPFLAGS and add -g0 instead, disabling all
debug info.
Similarly, it will try to enable optimisation (but bail out since in
that case it honors an existing -O in CFLAGS / CPPFLAGS)

Since we want to control code generation, patch out the code
mangling -g (and -O for consistency). Alternatively, if we were to
pass --enable-debug to ./configure, c-ares would at the same time
assume that we don't want optimisation anymore.

Signed-off-by: André Draszik <adraszik@tycoint.com>
---
 ...configure.ac-don-t-override-passed-cflags.patch | 26 ++++++++++++++++++++++
 .../recipes-support/c-ares/c-ares_1.11.0.bb        |  4 +++-
 2 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-support/c-ares/c-ares/0001-configure.ac-don-t-override-passed-cflags.patch

diff --git a/meta-networking/recipes-support/c-ares/c-ares/0001-configure.ac-don-t-override-passed-cflags.patch b/meta-networking/recipes-support/c-ares/c-ares/0001-configure.ac-don-t-override-passed-cflags.patch
new file mode 100644
index 0000000..10fad4e
--- /dev/null
+++ b/meta-networking/recipes-support/c-ares/c-ares/0001-configure.ac-don-t-override-passed-cflags.patch
@@ -0,0 +1,26 @@
+From 2a7236d2a7bb9c3d3c3f44ebf59404bf7134fcb3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com>
+Date: Tue, 12 Apr 2016 11:37:28 +0100
+Subject: [PATCH] configure.ac: don't override passed cflags
+
+We are controlling debug and optimiser flags from OE
+---
+ configure.ac | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5c02450..3cf9fcd 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -147,8 +147,6 @@ dnl **********************************************************************
+ 
+ CARES_CHECK_COMPILER
+ CARES_SET_COMPILER_BASIC_OPTS
+-CARES_SET_COMPILER_DEBUG_OPTS
+-CARES_SET_COMPILER_OPTIMIZE_OPTS
+ CARES_SET_COMPILER_WARNING_OPTS
+ 
+ if test "$compiler_id" = "INTEL_UNIX_C"; then
+-- 
+2.8.0.rc3
+
diff --git a/meta-networking/recipes-support/c-ares/c-ares_1.11.0.bb b/meta-networking/recipes-support/c-ares/c-ares_1.11.0.bb
index 2f72ab4..c98be7d 100644
--- a/meta-networking/recipes-support/c-ares/c-ares_1.11.0.bb
+++ b/meta-networking/recipes-support/c-ares/c-ares_1.11.0.bb
@@ -6,7 +6,9 @@ SECTION = "libs"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://ares_init.c;beginline=1;endline=3;md5=53f5ecf4c22c37cf1ddd1ef8f8eccce0"
 
-SRC_URI = "http://c-ares.haxx.se/download/${BP}.tar.gz"
+SRC_URI = "http://c-ares.haxx.se/download/${BP}.tar.gz \
+           file://0001-configure.ac-don-t-override-passed-cflags.patch \
+"
 SRC_URI[md5sum] = "d5c6d522cfc54bb6f215a0b7912d46be"
 SRC_URI[sha256sum] = "b3612e6617d9682928a1d50c1040de4db6519f977f0b25d40cf1b632900b3efd"
 
-- 
2.8.1



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

* [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares
  2016-07-15 12:54 [meta-networking][PATCH 1/2] c-ares: use our compilation flags git
@ 2016-07-15 12:54 ` git
  2016-07-15 14:34   ` Christopher Larson
  2016-07-21 13:51   ` Martin Jansa
  0 siblings, 2 replies; 5+ messages in thread
From: git @ 2016-07-15 12:54 UTC (permalink / raw)
  To: openembedded-devel

From: André Draszik <adraszik@tycoint.com>

c-ares doesn't build if the distro has enabled usage of the
security_flags.inc file as it is picky about what is placed
into CPPFLAGS and CFLAGS. It complains and errors out if any
preprocessor options appear in CFLAGS.

Fix this by providing an additional include file that is
require'd from conf/layer.conf.

Signed-off-by: André Draszik <adraszik@tycoint.com>
---
 .../conf/distro/include/meta_networking_security_flags.inc          | 6 ++++++
 meta-networking/conf/layer.conf                                     | 3 +++
 2 files changed, 9 insertions(+)
 create mode 100644 meta-networking/conf/distro/include/meta_networking_security_flags.inc

diff --git a/meta-networking/conf/distro/include/meta_networking_security_flags.inc b/meta-networking/conf/distro/include/meta_networking_security_flags.inc
new file mode 100644
index 0000000..06802d6
--- /dev/null
+++ b/meta-networking/conf/distro/include/meta_networking_security_flags.inc
@@ -0,0 +1,6 @@
+# configure righteously complains:
+# | configure:3479: using CFLAGS:  -O2 -pipe -g -feliminate-unused-debug-types -fstack-protector-strong -pie -fpie -D_FORTIFY_SOURCE=2
+# | configure:3485: CFLAGS error: CFLAGS may only be used to specify C compiler flags, not macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=2
+# | configure:3516: error: Can not continue. Fix errors mentioned immediately above this line.
+TARGET_CFLAGS_remove_pn-c-ares = "${lcl_maybe_fortify}"
+TARGET_CPPFLAGS_append_pn-c-ares = "${lcl_maybe_fortify}"
diff --git a/meta-networking/conf/layer.conf b/meta-networking/conf/layer.conf
index 5fd636a..c09ba4a 100644
--- a/meta-networking/conf/layer.conf
+++ b/meta-networking/conf/layer.conf
@@ -21,3 +21,6 @@ LICENSE_PATH += "${LAYERDIR}/licenses"
 
 # used by waf-samba.bbclass
 WAF_CROSS_ANSWERS_PATH = "${LAYERDIR}/files/waf-cross-answers"
+
+# Override security flags
+require conf/distro/include/meta_networking_security_flags.inc
-- 
2.8.1



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

* Re: [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares
  2016-07-15 12:54 ` [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares git
@ 2016-07-15 14:34   ` Christopher Larson
  2016-07-16 10:52     ` André Draszik
  2016-07-21 13:51   ` Martin Jansa
  1 sibling, 1 reply; 5+ messages in thread
From: Christopher Larson @ 2016-07-15 14:34 UTC (permalink / raw)
  To: Openembedded Discussion

On Fri, Jul 15, 2016 at 5:54 AM, <git@andred.net> wrote:

> From: André Draszik <adraszik@tycoint.com>
>
> c-ares doesn't build if the distro has enabled usage of the
> security_flags.inc file as it is picky about what is placed
> into CPPFLAGS and CFLAGS. It complains and errors out if any
> preprocessor options appear in CFLAGS.
>
> Fix this by providing an additional include file that is
> require'd from conf/layer.conf.
>
> Signed-off-by: André Draszik <adraszik@tycoint.com>
>

This commit message is a little misleading. The fact that you added a .inc
isn't what fixed the problem, the move of the defines from CFLAGS to
CPPFLAGS was.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics


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

* Re: [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares
  2016-07-15 14:34   ` Christopher Larson
@ 2016-07-16 10:52     ` André Draszik
  0 siblings, 0 replies; 5+ messages in thread
From: André Draszik @ 2016-07-16 10:52 UTC (permalink / raw)
  To: openembedded-devel

On 15 Jul 2016 3:35 pm, "Christopher Larson" <clarson@kergoth.com> wrote:
>
> On Fri, Jul 15, 2016 at 5:54 AM, <git@andred.net> wrote:
>
> > From: André Draszik <adraszik@tycoint.com>
> >
> > c-ares doesn't build if the distro has enabled usage of the
> > security_flags.inc file as it is picky about what is placed
> > into CPPFLAGS and CFLAGS. It complains and errors out if any
> > preprocessor options appear in CFLAGS.
> >
> > Fix this by providing an additional include file that is
> > require'd from conf/layer.conf.
> >
> > Signed-off-by: André Draszik <adraszik@tycoint.com>
> >
>
> This commit message is a little misleading. The fact that you added a .inc
> isn't what fixed the problem, the move of the defines from CFLAGS to
> CPPFLAGS was.

Well, I copied that part of the commit message from the commit that added a
similar .inc file to to meta-oe. I'll rewrite it.

A.


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

* Re: [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares
  2016-07-15 12:54 ` [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares git
  2016-07-15 14:34   ` Christopher Larson
@ 2016-07-21 13:51   ` Martin Jansa
  1 sibling, 0 replies; 5+ messages in thread
From: Martin Jansa @ 2016-07-21 13:51 UTC (permalink / raw)
  To: openembedded-devel

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

On Fri, Jul 15, 2016 at 01:54:21PM +0100, git@andred.net wrote:
> From: André Draszik <adraszik@tycoint.com>
> 
> c-ares doesn't build if the distro has enabled usage of the
> security_flags.inc file as it is picky about what is placed
> into CPPFLAGS and CFLAGS. It complains and errors out if any
> preprocessor options appear in CFLAGS.
> 
> Fix this by providing an additional include file that is
> require'd from conf/layer.conf.
> 
> Signed-off-by: André Draszik <adraszik@tycoint.com>
> ---
>  .../conf/distro/include/meta_networking_security_flags.inc          | 6 ++++++
>  meta-networking/conf/layer.conf                                     | 3 +++
>  2 files changed, 9 insertions(+)
>  create mode 100644 meta-networking/conf/distro/include/meta_networking_security_flags.inc
> 
> diff --git a/meta-networking/conf/distro/include/meta_networking_security_flags.inc b/meta-networking/conf/distro/include/meta_networking_security_flags.inc
> new file mode 100644
> index 0000000..06802d6
> --- /dev/null
> +++ b/meta-networking/conf/distro/include/meta_networking_security_flags.inc
> @@ -0,0 +1,6 @@
> +# configure righteously complains:
> +# | configure:3479: using CFLAGS:  -O2 -pipe -g -feliminate-unused-debug-types -fstack-protector-strong -pie -fpie -D_FORTIFY_SOURCE=2
> +# | configure:3485: CFLAGS error: CFLAGS may only be used to specify C compiler flags, not macro definitions. Use CPPFLAGS for: -D_FORTIFY_SOURCE=2
> +# | configure:3516: error: Can not continue. Fix errors mentioned immediately above this line.
> +TARGET_CFLAGS_remove_pn-c-ares = "${lcl_maybe_fortify}"
> +TARGET_CPPFLAGS_append_pn-c-ares = "${lcl_maybe_fortify}"

This actually breaks builds which don't include
conf/distro/include/security_flags.inc
with:
lcl_maybe_fortify = "${@base_conditional('DEBUG_BUILD','1','','-D_FORTIFY_SOURCE=2',d)}"

because then lcl_maybe_fortify isn't defined and gcc in c-ares
do_configure gets it unexpaned and fails:

configure:3926: checking whether the C compiler works
configure:3948: arm-oe-linux-gnueabi-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=softfp -mcpu=cortex-a9 -mtune=cortex-a9 -funwind-tables -rdynamic -Os --sysroot=/OE/sysroots/MACHINE -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/OE/work/MACHINE-oe-linux-gnueabi/c-ares/1.10.0-r0=/usr/src/debug/c-ares/1.10.0-r0 -fdebug-prefix-map=/OE/sysroots/x86_64-linux= -fdebug-prefix-map=/OE/sysroots/MACHINE= -Os ${lcl_maybe_fortify} -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed conftest.c  >&5
arm-oe-linux-gnueabi-gcc: error: ${lcl_maybe_fortify}: No such file or directory

I'll send a patch to add weak assignment before using lcl_maybe_fortify

> diff --git a/meta-networking/conf/layer.conf b/meta-networking/conf/layer.conf
> index 5fd636a..c09ba4a 100644
> --- a/meta-networking/conf/layer.conf
> +++ b/meta-networking/conf/layer.conf
> @@ -21,3 +21,6 @@ LICENSE_PATH += "${LAYERDIR}/licenses"
>  
>  # used by waf-samba.bbclass
>  WAF_CROSS_ANSWERS_PATH = "${LAYERDIR}/files/waf-cross-answers"
> +
> +# Override security flags
> +require conf/distro/include/meta_networking_security_flags.inc
> -- 
> 2.8.1
> 
> -- 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

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

end of thread, other threads:[~2016-07-21 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 12:54 [meta-networking][PATCH 1/2] c-ares: use our compilation flags git
2016-07-15 12:54 ` [meta-networking][PATCH 2/2] meta-networking: override SECURITY_CFLAGS for c-ares git
2016-07-15 14:34   ` Christopher Larson
2016-07-16 10:52     ` André Draszik
2016-07-21 13:51   ` Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.