[oe] [meta-java][PATCH] openjdk-8: strip leading non digit chars from GCCVERSION

Max Krummenacher max.oss.09 at gmail.com
Thu Jan 18 13:46:56 UTC 2018

When using the linaro cross toolchain GCCVERSION is set to "linaro-6.2%", i.e.
the first char is not GCC's major version.
Thus needed compiler options for GCC 6 are not set.

Fix at least this case by stripping GCCVERSION up to the first numeric char.

Signed-off-by: Max Krummenacher <max.krummenacher at toradex.com>
(cherry picked from commit 1fbdc60eaccaa29c2942d479f8068b722e7b5bf3)
 recipes-core/openjdk/openjdk-8-common.inc | 6 ++++++
 1 file changed, 6 insertions(+)

The patch applies cleanly to master, pyro and morty branches. I think it makes
sense to add it to all supported OE versions.


diff --git a/recipes-core/openjdk/openjdk-8-common.inc b/recipes-core/openjdk/openjdk-8-common.inc
index def779d..b72c3c4 100644
--- a/recipes-core/openjdk/openjdk-8-common.inc
+++ b/recipes-core/openjdk/openjdk-8-common.inc
@@ -231,6 +231,8 @@ FLAGS_GCC6 = "-fno-lifetime-dse -fno-delete-null-pointer-checks"
 # version.
 def version_specific_cflags(d):
+    import re
     extraflags = None
     version = None
@@ -249,6 +251,10 @@ def version_specific_cflags(d):
         # work if the native toolchain is Clang, but as of this writing that
         # doesn't work anyway.
         version = d.getVar('GCCVERSION', expand=True)[0]
+        # skip non digit characters at the beginning, e.g. from "linaro-6.2%"
+        match = re.search("\d", version)
+        if match:
+            version = version[match.start():]
     if version.isdigit():
         extraflags = d.getVar('FLAGS_GCC%d' % int(version), True) or ''

More information about the Openembedded-devel mailing list