Skip to contentSkip to conversation

uninative: rebuild uninative for gcc 4.8 and 4.9

PATCH Superseded Ed Bartosh 1 participant 1 message Oct 26, 2016

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 uninative: rebuild uninative for gcc 4.8 and 4.9

Some c++ libraries fail to build if uninative is built with gcc 5.x and host gcc version is either 4.8 or 4.9.

The issue should be solved by making separate uninative sstate directory structure sstate-cache/universal-<gcc version> for host gcc versions 4.8 and 4.9. This causes rebuilds of uninative if host gcc is either 4.8 or 4.9 and it doesn't match gcc version used to build uninative.

[YOCTO #10441]

---
 meta/classes/uninative.bbclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
meta/classes/uninative.bbclass +19 -1
index 89cec07..35c1496 100644
@@ -95,11 +95,29 @@ python uninative_event_enable() {
     enable_uninative(d)
 }
 
+def gcc_version(d):
+    compiler = d.getVar("BUILD_CC", True)
+    retval, output = oe.utils.getstatusoutput("%s --version" % compiler)
+    if retval:
+        bb.fatal("Error running %s --version: %s" % (compiler, output))
+
+    import re
+    match = re.match(".* (\d\.\d)\.\d .*", output.split('\n')[0])
+    if not match:
+        bb.fatal("Can't get compiler version from %s --version output" % compiler)
+
+    version = match.group(1)
+    return "-%s" % version if version in ("4.8", "4.9") else ""
+
 def enable_uninative(d):
     loader = d.getVar("UNINATIVE_LOADER", True)
     if os.path.exists(loader):
         bb.debug(2, "Enabling uninative")
-        d.setVar("NATIVELSBSTRING", "universal")
+        gcc_ver = d.getVar("GCC_VERSION", True)
+        if not gcc_ver:
+            gcc_ver = gcc_version(d)
+            d.setVar("GCC_VERSION", gcc_ver)
+        d.setVar("NATIVELSBSTRING", "universal%s" % gcc_ver)
         d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
         d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
 
Signature · 1 line
2.1.4