Skip to contentSkip to conversation

conf: add C++ flags for uninative interoperatility

PATCH New Ross Burton 1 participant 2 messages Nov 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 conf: add C++ flags for uninative interoperatility

Create a common include file for compiler flags which allow native binaries to be interoperable on a wide range of hosts. In particular the C++ ABI is problematic so choose the CXX11 version to allow interoperation between gcc4 and gcc5 based hosts. Moving this to a common include instead of uninative.bbclass allows uninative to be configured later and used in the eSDK (where its mandatory) even if the base configuration doesn't enable uninative by default (e.g. nodistro in OE-Core).

[ YOCTO #10645 ]

---
 meta/classes/uninative.bbclass               | 11 -----------
 meta/conf/distro/defaultsetup.conf           |  3 ++-
 meta/conf/distro/include/uninative-flags.inc |  9 +++++++++
 3 files changed, 11 insertions(+), 12 deletions(-)
 create mode 100644 meta/conf/distro/include/uninative-flags.inc
meta/classes/uninative.bbclass +0 -11
index 89cec07..9242320 100644
@@ -7,17 +7,6 @@ UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc.tar.bz2"
 #UNINATIVE_CHECKSUM[x86_64] = "dead"
 UNINATIVE_DLDIR ?= "${DL_DIR}/uninative/"
 
-# https://wiki.debian.org/GCC5
-# We may see binaries built with gcc5 run or linked into gcc4 environment
-# so use the older libstdc++ standard for now until we don't support gcc4
-# on the host system.
-BUILD_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
-
-#
-# icu configure defaults to CXX11 if no -std= option is passed in CXXFLAGS
-# therefore pass one
-BUILD_CXXFLAGS_append_pn-icu-native = " -std=c++98"
-
 addhandler uninative_event_fetchloader
 uninative_event_fetchloader[eventmask] = "bb.event.BuildStarted"
 
meta/conf/distro/defaultsetup.conf +2 -1
index 71c65b14..aa21345 100644
@@ -9,6 +9,8 @@ require conf/distro/include/tcmode-${TCMODE}.inc
 TCLIBC ?= "glibc"
 require conf/distro/include/tclibc-${TCLIBC}.inc
 
+require conf/distro/include/uninative-flags.inc
+
 # Allow single libc distros to disable this code
 TCLIBCAPPEND ?= "-${TCLIBC}"
 TMPDIR .= "${TCLIBCAPPEND}"
@@ -20,4 +22,3 @@ PACKAGE_CLASSES ?= "package_ipk"
 INHERIT_BLACKLIST = "blacklist"
 INHERIT_DISTRO ?= "debian devshell sstate license"
 INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO} ${INHERIT_BLACKLIST}"
-
meta/conf/distro/include/uninative-flags.inc new file +9 -0
new file mode 100644
index 0000000..e9f82c3
@@ -0,0 +1,9 @@
+# https://wiki.debian.org/GCC5
+# We may see binaries built with gcc5 run or linked into gcc4 environment
+# so use the older libstdc++ standard for now until we don't support gcc4
+# on the host system.
+BUILD_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
+
+# icu configure defaults to CXX11 if no -std= option is passed in CXXFLAGS
+# therefore pass one
+BUILD_CXXFLAGS_append_pn-icu-native = " -std=c++98"
Signature · 1 line
2.8.1
#1 lore raw

PATCH 2/2 Revert "classes/populate_sdk_ext: require uninative"

The change to move C++ ABI tweaks to bitbake.conf should make this redundant, so revert it.

This reverts commit c56cd49a12645e82d0a16bb94be16ac509f8813c.

---
 meta/classes/populate_sdk_ext.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/populate_sdk_ext.bbclass +4 -3
index 0e3656b..3c3a73c 100644
@@ -114,6 +114,10 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
             f.write('SSTATE_MIRRORS_forcevariable = ""\n')
             # Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it
             f.write('TMPDIR_forcevariable = "${TOPDIR}/tmp"\n')
+            # Drop uninative if the build isn't using it (or else NATIVELSBSTRING will
+            # be different and we won't be able to find our native sstate)
+            if not bb.data.inherits_class('uninative', d):
+                f.write('INHERIT_remove = "uninative"\n')
 
         # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
         # will not allow in its COREBASE path, so we need to rename the directory temporarily
@@ -609,9 +613,6 @@ fakeroot python do_populate_sdk_ext() {
     if d.getVar('SDK_ARCH', True) != d.getVar('BUILD_ARCH', True):
         bb.fatal('The extensible SDK can currently only be built for the same architecture as the machine being built on - SDK_ARCH is set to %s (likely via setting SDKMACHINE) which is different from the architecture of the build machine (%s). Unable to continue.' % (d.getVar('SDK_ARCH', True), d.getVar('BUILD_ARCH', True)))
 
-    if not bb.data.inherits_class('uninative', d):
-        bb.fatal('The extensible SDK requires uninative to be enabled. Enabling this is straightforward - just add the following to your configuration:\n\nrequire meta/conf/distro/include/yocto-uninative.inc\nINHERIT += "uninative"\n')
-
     d.setVar('SDK_INSTALL_TARGETS', get_sdk_install_targets(d))
     buildtools_fn = get_current_buildtools(d)
     d.setVar('SDK_REQUIRED_UTILITIES', get_sdk_required_utilities(buildtools_fn, d))
Signature · 1 line
2.8.1