Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Patrick Ohly <patrick.ohly@intel.com>
To: openembedded-devel@lists.openembedded.org
Cc: Patrick Ohly <patrick.ohly@intel.com>
Subject: [meta-java][PATCH] openjdk-8: fix compiler detection
Date: Wed, 20 Jul 2016 11:48:08 +0200	[thread overview]
Message-ID: <1469008088-11976-1-git-send-email-patrick.ohly@intel.com> (raw)
In-Reply-To: <loom.20160719T113248-200@post.gmane.org>

When GCC is at version 4 or 5, parsing the recipe fails with:

ERROR: ExpansionError during parsing
.../ostro-os/meta-java/recipes-core/openjdk/openjdk-8_72b05.bb
...
bb.data_smart.ExpansionError: Failure expanding variable CFLAGS,
expression was  -O2 -pipe -g -feliminate-unused-debug-types
-fdebug-prefix-map=.../ostro-os/build/tmp-glibc/work/corei7-64-ostro-
linux/openjdk-8/72b05-r0=/usr/src/debug/openjdk-8/72b05-r0
-fdebug-prefix-map=.../ostro-os/build/tmp-glibc/sysroots/x86_64-linux=
-fdebug-prefix-map=.../ostro-os/build/tmp-glibc/sysroots/intel-corei7-64=
 -fstack-protector-strong -D_FORTIFY_SOURCE=2
${ <at> version_specific_cflags(d)} -Wno-error=deprecated-declarations which
triggered exception TypeError: can only join an iterable

That's because FLAGS_GCC<version> may be unset, thus leading to
d.getVar() returning None and ''.join(extraflags) failing.

The join() is also redundant: extraflags already is a string. It
happened to work because Python treats a string as sequence of
single-character strings, and thus ''.join() re-created the original
string.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
---
 recipes-core/openjdk/openjdk-8-common.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index 089f907..7ad802a 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -271,10 +271,8 @@ def version_specific_cflags(d):
         # doesn't work anyway.
         version = d.getVar('GCCVERSION', expand=True)[0]
 
-    if int(version) >= 4:
-        extraflags = d.getVar('FLAGS_GCC%d' % int(version), True)
-
-    return ''.join(extraflags)
+    extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''
+    return extraflags
 
 CFLAGS_append = " ${@version_specific_cflags(d)}"
 CXXFLAGS_append = " ${@version_specific_cflags(d)}"
-- 
2.1.4



  reply	other threads:[~2016-07-20  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-15 21:08 [meta-java][PATCH] openjdk-8: Detect compiler version Dan McGregor
2016-07-19  9:42 ` Patrick Ohly
2016-07-20  9:48   ` Patrick Ohly [this message]
2016-07-20 16:04     ` [meta-java][PATCH] openjdk-8: fix compiler detection Dan McGregor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1469008088-11976-1-git-send-email-patrick.ohly@intel.com \
    --to=patrick.ohly@intel.com \
    --cc=openembedded-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox