Skip to contentSkip to conversation

uninative: rebuild uninative for gcc 4.8 and 4.9

PATCH Superseded Ed Bartosh 3 participants 7 messages Oct 27, 2016 – Dec 13, 2016

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH v2 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 | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/classes/uninative.bbclass +15 -1
index 89cec07..45f9262 100644
@@ -95,11 +95,25 @@ 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")
+        d.setVar("NATIVELSBSTRING", "universal%s" % gcc_version(d))
         d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
         d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 2 lines · Ed Bartosh

+ match = re.match(".* (\d\.\d)\.\d .*", output.split('\n')[0])

Debian uses this string:

gcc (Debian 4.9.2-10) 4.9.2

So your regex needs to be a bit more permissive, and it looks like grabbing the second number would be more appropriate here too.

Ross

author
#2 lore raw

PATCH v2 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 | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/classes/uninative.bbclass +15 -1
index 89cec07..3862b31 100644
@@ -95,11 +95,25 @@ 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")
+        d.setVar("NATIVELSBSTRING", "universal%s" % gcc_version(d))
         d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
         d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
 
Signature · 1 line
2.1.4
#3 lore raw

This fails on the AB when generating a eSDK, eg
http://errors.yoctoproject.org/Errors/Details/110635/

I suspect the cause is that the sstate is generated using the (eg) universal-4.9 name, but populate_sdk_ext still uses just "universal" when creating a mirror of the sstate archive.

Ross

Quoted 59 lines · Ed Bartosh

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 | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
meta/classes/uninative. renamed from meta/classes/uninative.bbclass +0 -0

bbclass
index 89cec07..3862b31 100644

meta/classes/uninative.bbclass +15 -1
@@ -95,11 +95,25 @@ 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")
+        d.setVar("NATIVELSBSTRING", "universal%s" % gcc_version(d))
         d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
         d.prependVar("PATH", "${STAGING_DIR}-uninative/${

BUILD_ARCH}-linux${bindir_native}:")

--
2.1.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#4 lore raw

PATCH 1/1 populate_sdk_ext: get NATIVELSBSTRING variable

Setting fixedlsbstring to 'universal' can break populate_sdk_ext task as NATIVELSBSTRING can be set to universal-<gcc version> in some cases.

Getting NATIVELSBSTRING value using getVar should fix this.

---
 meta/classes/populate_sdk_ext.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/populate_sdk_ext.bbclass +2 -2
index 3c3a73c..6ef48c0 100644
@@ -374,8 +374,8 @@ python copy_buildsystem () {
 
     sstate_out = baseoutpath + '/sstate-cache'
     bb.utils.remove(sstate_out, True)
-    # uninative.bbclass sets NATIVELSBSTRING to 'universal'
-    fixedlsbstring = 'universal'
+
+    fixedlsbstring = d.getVar('NATIVELSBSTRING', True)
 
     sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN', True) == '1')
     sdk_ext_type = d.getVar('SDK_EXT_TYPE', True)
Signature · 1 line
2.1.4
#5 lore raw

Re: [PATCH] populate_sdk_ext: get NATIVELSBSTRING variable

Hi Ed,

Quoted 16 lines · On Tue, 13 Dec 2016 19:05:49 Ed Bartosh wrote:

Setting fixedlsbstring to 'universal' can break populate_sdk_ext task as NATIVELSBSTRING can be set to universal-<gcc version> in some cases.

Getting NATIVELSBSTRING value using getVar should fix this.

---
 meta/classes/populate_sdk_ext.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/meta/classes/populate_sdk_ext.bbclass index 3c3a73c..6ef48c0 100644

meta/classes/populate_sdk_ext.bbclass python copy_buildsystem () { · line 381

Quoted 10 lines
meta/classes/populate_sdk_ext.bbclass +2 -2
@@ -374,8 +374,8 @@ python copy_buildsystem () {
 
     sstate_out = baseoutpath + '/sstate-cache'
     bb.utils.remove(sstate_out, True)
-    # uninative.bbclass sets NATIVELSBSTRING to 'universal'
-    fixedlsbstring = 'universal'
+
+    fixedlsbstring = d.getVar('NATIVELSBSTRING', True)
 
     sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN', True) ==
 '1') sdk_ext_type = d.getVar('SDK_EXT_TYPE', True)

Have you tested this with OE-Core alone or any other configuration where uninative is not enabled? I suspect it won't work with that.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
author
#6 lore raw

PATCH v3 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/populate_sdk_ext.bbclass |  5 +++--
 meta/classes/uninative.bbclass        |  2 +-
 meta/lib/oe/utils.py                  | 14 ++++++++++++++
 3 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/populate_sdk_ext.bbclass +3 -2
index 3c3a73c..1affa9d 100644
@@ -374,8 +374,9 @@ python copy_buildsystem () {
 
     sstate_out = baseoutpath + '/sstate-cache'
     bb.utils.remove(sstate_out, True)
-    # uninative.bbclass sets NATIVELSBSTRING to 'universal'
-    fixedlsbstring = 'universal'
+
+    # uninative.bbclass sets NATIVELSBSTRING to 'universal%s' % oe.utils.host_gcc_version(d)
+    fixedlsbstring = "universal%s" % oe.utils.host_gcc_version(d)
 
     sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN', True) == '1')
     sdk_ext_type = d.getVar('SDK_EXT_TYPE', True)
meta/classes/uninative.bbclass +1 -1
index 9242320..11cbf9b 100644
@@ -88,7 +88,7 @@ def enable_uninative(d):
     loader = d.getVar("UNINATIVE_LOADER", True)
     if os.path.exists(loader):
         bb.debug(2, "Enabling uninative")
-        d.setVar("NATIVELSBSTRING", "universal")
+        d.setVar("NATIVELSBSTRING", "universal%s" % oe.utils.host_gcc_version(d))
         d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
         d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
 
meta/lib/oe/utils.py +14 -0
index d6545b1..2b095f1 100644
@@ -230,6 +230,20 @@ def format_pkg_list(pkg_dict, ret_format=None):
 
     return '\n'.join(output)
 
+def host_gcc_version(d):
+    compiler = d.getVar("BUILD_CC", True)
+    retval, output = 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 ""
+
 #
 # Python 2.7 doesn't have threaded pools (just multiprocessing)
 # so implement a version here
Signature · 1 line
2.1.4