Skip to contentSkip to conversation

clang: Add clang C/C++ toolchain

PATCH In review Khem Raj 4 participants 28 messages May 23, 2025 – May 29, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

v3 cover clang: Add clang C/C++ toolchain

Clang also provided a full fledged C/C++ cross compiler which is capable of building any C/C++ components.

A mechanism is added to select the toolchain using

TOOLCHAIN = "clang"

in config metadata. This will also add an entry into OVERRIDES 'toolchain-<COMPILER>', e.g. toolchain-clang which can be used to define clang-specific aspects in metadata.

All packages are not full buildable with clang, e.g. glibc which rely on some extentions which are only available in gcc. Such exceptions are made in config metadata using a global file called

meta/conf/distro/include/default-toolchain.inc

This file can be added in every layer to define these details themselves bitbake will include all such files auotmaticlally.

Defaults are kept as it is, nothing is expected to change if its not enabled

World builds for qemuarm/qemuarm64/qemuppc/qemumips/qemux86_64 are successful with some exceptions

vulkan-samples - qemuarm64/qemux86-64
bluez - qemuppc
compiler-rt-sanitizers - qemumips

---
Changes in v3:
- Split TCOVERRIDE into a separate patch.
- Move toolchain classes into classs/toolchain sub-directory.
- Extend systemd-boot clang fix to glibc as well.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Move the changed from default-toolchains.inc file into respective recipes
- Drop adding libomp as toolchain-clang dependency for rpm, it will be
needed when clang is used for rpm, as of now it does not
- Fix musl world builds for qemuarm/qemuarm64/qemuriscv64/qemuriscv32
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Khem Raj (13):
toolchain: Provide abstraction for choosing per-recipe toolchain clang.bbclass: Specify ldso when using usermerge
vte: Disable gi data generation when using clang on arm
clang: Add compiler-rt to default deps when using clang compiler
tcf-agent: Fix ranlib call when using llvm-ranlib
libjpeg-turbo: Fix build on mips/clang
pixman: Fix build with mips/clang
vulkan-samples: Disable overriding-option as error
bluez: Disable invalid-pp-token warning with clang
systemtap: Pin to build with GCC
seatd: Disable sign-compare warning as error on clang
systemd-boot: Pin to use gcc toolchain on arm
meta: Add TCOVERRIDE for toolchain selection at recipe scope

 meta/classes-global/base.bbclass                   |  5 ++++
 meta/classes-recipe/cross-canadian.bbclass         |  2 ++
 meta/classes-recipe/cross.bbclass                  |  2 ++
 meta/classes-recipe/crosssdk.bbclass               |  2 ++
 meta/classes-recipe/native.bbclass                 |  2 ++
 meta/classes-recipe/nativesdk.bbclass              |  2 ++
 meta/classes/toolchain/clang-native.bbclass        | 28 ++++++++++++++++++++++
 .../clang.inc => classes/toolchain/clang.bbclass}  | 17 +++++++++----
 .../toolchain/gcc-native.bbclass}                  |  1 -
 .../gcc.inc => classes/toolchain/gcc.bbclass}      |  1 +
 meta/conf/bitbake.conf                             |  7 +++---
 meta/recipes-connectivity/bluez5/bluez5.inc        |  1 +
 meta/recipes-core/seatd/seatd_0.9.1.bb             |  8 +++++++
 meta/recipes-core/systemd/systemd-boot_257.5.bb    |  3 +++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |  5 ++++
 meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb  |  6 +++++
 meta/recipes-graphics/vulkan/vulkan-samples_git.bb |  4 ++++
 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb    |  3 +++
 meta/recipes-kernel/systemtap/systemtap_git.bb     |  4 ++++
 meta/recipes-support/vte/vte_0.78.2.bb             |  4 ++++
 20 files changed, 98 insertions(+), 9 deletions(-)

---
base-commit: caea04becc791316498275f957af9ab28012eea3
change-id: 20250518-clang-toolchain-f9a8a0572306

Best regards,

Signature · 1 line
Khem Raj <[email protected]>
author
#1 lore raw

PATCH v3 1/13 toolchain: Provide abstraction for choosing per-recipe toolchain

This implements a toolchain selection mechanism with existing defaults unchanged.

It introduces a variable called TOOLCHAIN, which denotes the familiar name for toolchain e.g. "gcc" which selects GNU compiler + binutils as default C/C++ toolchain or "clang" which will use LLVM/Clang Compiler

Additionally build-gcc is used for selecting native compiler

TOOLCHAIN variable has a global fallback to "gcc" in configuration metadata. A distro can switch to using say "clang" as default system compiler by defining

TOOLCHAIN ?= "clang"

In local.conf or other distro specific global configuration metadata

It is also selectable at recipe scope, since not all packages are buildable with either clang or gcc, a recipe can explicitly demand a given toolchain e.g. glibc can not be built with clang therefore glibc recipe sets.

TOOLCHAIN = "gcc"

---
 meta/classes-global/base.bbclass                   |  4 ++++
 meta/classes-recipe/cross-canadian.bbclass         |  1 +
 meta/classes-recipe/cross.bbclass                  |  1 +
 meta/classes-recipe/crosssdk.bbclass               |  1 +
 meta/classes-recipe/native.bbclass                 |  1 +
 meta/classes-recipe/nativesdk.bbclass              |  1 +
 meta/classes/toolchain/clang-native.bbclass        | 28 ++++++++++++++++++++++
 .../clang.inc => classes/toolchain/clang.bbclass}  |  8 +++----
 .../toolchain/gcc-native.bbclass}                  |  1 -
 .../gcc.inc => classes/toolchain/gcc.bbclass}      |  1 -
 meta/conf/bitbake.conf                             |  5 ++--
 11 files changed, 43 insertions(+), 9 deletions(-)
meta/classes-global/base.bbclass +4 -0
index 8215969c7bb37c1a1b91e260cd31714fee2db87c..1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4 100644
@@ -19,6 +19,10 @@ PACKAGECONFIG_CONFARGS ??= ""
 
 inherit metadata_scm
 
+inherit toolchain/gcc-native
+inherit toolchain/gcc
+inherit_defer ${@oe.utils.ifelse(d.getVar('TOOLCHAIN') == 'clang', 'toolchain/clang', '')}
+
 def lsb_distro_identifier(d):
     adjust = d.getVar('LSB_DISTRO_ADJUST')
     adjust_func = None
meta/classes-recipe/cross-canadian.bbclass +1 -0
index 059d9aa95f57dd77a0ab5172c4c15c13ed3bc43e..de002ede9d3f5d53a4837334bd5474bcfb208499 100644
@@ -14,6 +14,7 @@
 EXCLUDE_FROM_WORLD = "1"
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-cross-canadian"
 STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}:${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
 
meta/classes-recipe/cross.bbclass +1 -0
index 93de9a527446554b93c1e323c7458cc7aacef799..5c36222d7aba04448b1ab70d61dd7c6d011b6a17 100644
@@ -10,6 +10,7 @@ inherit relocatable
 # no need for them to be a direct target of 'world'
 EXCLUDE_FROM_WORLD = "1"
 
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-cross"
 PACKAGES = ""
 PACKAGES_DYNAMIC = ""
meta/classes-recipe/crosssdk.bbclass +1 -0
index 824b1bcff47bcd36a70aa1d7b8724b6cf07131ff..0117afc404c2df77a1f7cb28831fe4098dbb4524 100644
@@ -7,6 +7,7 @@
 inherit cross
 
 CLASSOVERRIDE = "class-crosssdk"
+TOOLCHAIN = ""
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
 MACHINEOVERRIDES = ""
meta/classes-recipe/native.bbclass +1 -0
index 625975a69429389a5b231a19b17e8ed7a12d80ad..12630079cd19d6df29f2da94853f6cf2c5895772 100644
@@ -108,6 +108,7 @@ PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
 
 # we dont want libc-*libc to kick in for native recipes
 LIBCOVERRIDE = ""
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-native"
 MACHINEOVERRIDES = ""
 MACHINE_FEATURES = ""
meta/classes-recipe/nativesdk.bbclass +1 -0
index 7ecb4c12c1f0f2b9cc48da215006a153679facf8..f41e5b9642d26cbafeab47ec469441ddd3ff1c09 100644
@@ -13,6 +13,7 @@ STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${S
 # libc for the SDK can be different to that of the target
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-nativesdk"
 MACHINEOVERRIDES = ""
 
meta/classes/toolchain/clang-native.bbclass new file +28 -0
new file mode 100644
index 0000000000000000000000000000000000000000..bf395eade73eaad18bf15f35d03bc0aec2223090
@@ -0,0 +1,28 @@
+# inherit this class if you would like to use clang to compile the native
+# version of your recipes instead of system compiler ( which is normally gcc )
+# on build machines
+# to use it add
+#
+# inherit clang-native
+#
+# to the concerned recipe via a bbappend or directly to recipe file
+#
+BUILD_CC = "${CCACHE}${BUILD_PREFIX}clang ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE}"
+BUILD_CXX = "${CCACHE}${BUILD_PREFIX}clang++ ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE}"
+BUILD_FC = "${BUILD_PREFIX}gfortran ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE}"
+BUILD_CPP = "${BUILD_PREFIX}clang ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE} -E"
+BUILD_LD = "${BUILD_PREFIX}ld ${BUILD_LD_ARCH}"
+BUILD_CCLD = "${BUILD_PREFIX}clang ${BUILD_CC_ARCH}"
+BUILD_AR = "${BUILD_PREFIX}llvm-ar"
+BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}"
+BUILD_RANLIB = "${BUILD_PREFIX}llvm-ranlib -D"
+BUILD_STRIP = "${BUILD_PREFIX}llvm-strip"
+BUILD_OBJCOPY = "${BUILD_PREFIX}llvm-objcopy"
+BUILD_OBJDUMP = "${BUILD_PREFIX}llvm-objdump"
+BUILD_NM = "${BUILD_PREFIX}llvn-nm"
+BUILD_READELF = "${BUILD_PREFIX}readelf"
+DEPENDS:append = " clang-native compiler-rt-native libcxx-native"
+# Use libcxx headers for native parts
+CXXFLAGS:append = " -stdlib=libc++"
+LDFLAGS:append = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
+BUILD_LDFLAGS:append = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
meta/classes/toolchain/clang.bbclass renamed from meta/conf/toolchain/clang.inc +4 -4
similarity index 78%
rename from meta/conf/toolchain/clang.inc
rename to meta/classes/toolchain/clang.bbclass
index 0e5f0769f85a8373c58d4b54dbe2bb1cf7dbd50b..e35e0f0fb1b010dd0f770b749717370041e0ba0d 100644
@@ -17,9 +17,9 @@ READELF = "${HOST_PREFIX}llvm-readelf"
 PREFERRED_PROVIDER_virtual/cross-cc = "${MLPREFIX}clang-cross-${TARGET_ARCH}"
 PREFERRED_PROVIDER_virtual/cross-c++ = "${MLPREFIX}clang-cross-${TARGET_ARCH}"
 PREFERRED_PROVIDER_virtual/compilerlibs = "gcc-runtime"
-PREFERRED_PROVIDER_virtual/cross-cc:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-cc:class-nativesdk = "clang-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "clang-crosssdk-${SDK_SYS}"
 
-PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "clang-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
meta/classes/toolchain/gcc-native.bbclass renamed from meta/conf/toolchain/build-gcc.inc +0 -1
similarity index 99%
rename from meta/conf/toolchain/build-gcc.inc
rename to meta/classes/toolchain/gcc-native.bbclass
index a708bd0389a123504301fd151fb9ebdb677926be..1e1d68b027806b94e8229d4efef025cc1c038ad3 100644
@@ -12,4 +12,3 @@ BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
 BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
 BUILD_NM = "${BUILD_PREFIX}nm"
 BUILD_READELF = "${BUILD_PREFIX}readelf"
-
meta/classes/toolchain/gcc.bbclass renamed from meta/conf/toolchain/gcc.inc +0 -1
similarity index 99%
rename from meta/conf/toolchain/gcc.inc
rename to meta/classes/toolchain/gcc.bbclass
index 36d33f5d6d0bfbf0f36158f389c4112ce20d806b..2479caf22c2cd48aebcce0abd5e6ac19b1c53a0f 100644
@@ -23,4 +23,3 @@ PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
-
meta/conf/bitbake.conf +2 -3
index e5037c6277841908df333b16adbe4e6cce55f814..83e52e7afaaddb19f7418a549c9b34d8d8ee92f1 100644
@@ -13,6 +13,8 @@ BASELIB = "lib"
 BASELIB:libc-glibc:powerpc64 = "lib64"
 BASELIB:libc-glibc:powerpc64le = "lib64"
 
+TOOLCHAIN ??= "gcc"
+
 # Path prefixes
 export base_prefix = ""
 export prefix = "/usr"
@@ -834,9 +836,6 @@ include conf/licenses.conf
 require conf/sanity.conf
 include conf/bblock.conf
 
-require toolchain/gcc.inc
-require toolchain/build-gcc.inc
-
 ##################################################################
 # Weak variables (usually to retain backwards compatibility)
 ##################################################################
Signature · 1 line
2.49.0
#2 lore raw

Re: [OE-core] [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain

Quoted 47 lines · Khem Raj via lists.openembedded.org

This implements a toolchain selection mechanism with existing defaults unchanged.

It introduces a variable called TOOLCHAIN, which denotes the familiar name for toolchain e.g. "gcc" which selects GNU compiler + binutils as default C/C++ toolchain or "clang" which will use LLVM/Clang Compiler

Additionally build-gcc is used for selecting native compiler

TOOLCHAIN variable has a global fallback to "gcc" in configuration metadata. A distro can switch to using say "clang" as default system compiler by defining

TOOLCHAIN ?= "clang"

In local.conf or other distro specific global configuration metadata

It is also selectable at recipe scope, since not all packages are buildable with either clang or gcc, a recipe can explicitly demand a given toolchain e.g. glibc can not be built with clang therefore glibc recipe sets.

TOOLCHAIN = "gcc"

---
 meta/classes-global/base.bbclass                   |  4 ++++ meta/classes-recipe/cross-canadian.bbclass         |  1 + meta/classes-recipe/cross.bbclass                  |  1 + meta/classes-recipe/crosssdk.bbclass               |  1 + meta/classes-recipe/native.bbclass                 |  1 + meta/classes-recipe/nativesdk.bbclass              |  1 + meta/classes/toolchain/clang-native.bbclass        | 28 ++++++++++++++++++++++ .../clang.inc => classes/toolchain/clang.bbclass}  |  8 +++---- .../toolchain/gcc-native.bbclass}                  |  1 - .../gcc.inc => classes/toolchain/gcc.bbclass}      |  1 - meta/conf/bitbake.conf                             |  5 ++--

 11 files changed, 43 insertions(+), 9 deletions(-)
meta/classes-global/base.bbclass +0 -0
index 8215969c7bb37c1a1b91e260cd31714fee2db87c..1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4 100644
@@ -19,6 +19,10 @@ PACKAGECONFIG_CONFARGS ??= ""


 inherit metadata_scm

meta/classes-global/base.bbclass PACKAGECONFIG_CONFARGS ??= "" · line 24

Quoted 3 lines
meta/classes-global/base.bbclass +3 -0
+inherit toolchain/gcc-native
+inherit toolchain/gcc
+inherit_defer ${@oe.utils.ifelse(d.getVar('TOOLCHAIN') == 'clang', 'toolchain/clang', '')}

The fact we can't conditionally inherit gcc is bothering me quite a bit. I did experiment a bit locally and I can certainly see the challenge. The trouble is that even with the approach in this patch, I think we're going to run into trouble as soon as we want to use clang for native or sdk recipes.

The big problem is the ordering of the two deferred inherits (e.g. native and toolchain/gcc) and how that interacts with class overrides. You couldn't do something like:

TOOLCHAIN = "clang"
TOOLCHAIN:class-native = "gcc"

for example, since the class-native override isn't set until after TOOLCHAIN is expanded in the deferred inherit.

I'll continue to give this some thought but I wanted to at least give a headsup warning that this isn't going to scale as we might need it to.

Cheers,

Richard

#3 lore raw

RE: [OE-core] [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain

In reply to Khem Raj
Quoted 52 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Khem Raj via lists.openembedded.org
Sent: den 23 maj 2025 05:53
To: [email protected]
Cc: Khem Raj <[email protected]>
Subject: [OE-core] [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain

This implements a toolchain selection mechanism with existing defaults unchanged.

It introduces a variable called TOOLCHAIN, which denotes the familiar name for toolchain e.g. "gcc" which selects GNU compiler + binutils as default C/C++ toolchain or "clang" which will use LLVM/Clang Compiler

Additionally build-gcc is used for selecting native compiler

TOOLCHAIN variable has a global fallback to "gcc" in configuration metadata. A distro can switch to using say "clang" as default system compiler by defining

TOOLCHAIN ?= "clang"

In local.conf or other distro specific global configuration metadata

It is also selectable at recipe scope, since not all packages are buildable with either clang or gcc, a recipe can explicitly demand a given toolchain e.g. glibc can not be built with clang therefore glibc recipe sets.

TOOLCHAIN = "gcc"

---
 meta/classes-global/base.bbclass                   |  4 ++++
 meta/classes-recipe/cross-canadian.bbclass         |  1 +
 meta/classes-recipe/cross.bbclass                  |  1 +
 meta/classes-recipe/crosssdk.bbclass               |  1 +
 meta/classes-recipe/native.bbclass                 |  1 +
 meta/classes-recipe/nativesdk.bbclass              |  1 +
 meta/classes/toolchain/clang-native.bbclass        | 28 ++++++++++++++++++++++
 .../clang.inc => classes/toolchain/clang.bbclass}  |  8 +++----
 .../toolchain/gcc-native.bbclass}                  |  1 -
 .../gcc.inc => classes/toolchain/gcc.bbclass}      |  1 -
 meta/conf/bitbake.conf                             |  5 ++--
 11 files changed, 43 insertions(+), 9 deletions(-)
meta/classes-global/base.bbclass +0 -0
index 8215969c7bb37c1a1b91e260cd31714fee2db87c..1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4 100644

meta/classes-global/base.bbclass PACKAGECONFIG_CONFARGS ??= "" · line 22

Quoted 4 lines
meta/classes-global/base.bbclass +1 -0
@@ -19,6 +19,10 @@ PACKAGECONFIG_CONFARGS ??= ""
 
 inherit metadata_scm
 
+inherit toolchain/gcc-native

Would it make sense to have a TOOLCHAIN_NATIVE to select the toolchain used for building the native tools? Rather than having to do inherit clang-native, which does not match how it is done for target. That way, all the toolchain bbclasses would be handled here in the same way.

meta/classes-global/base.bbclass PACKAGECONFIG_CONFARGS ??= "" · line 23

Quoted 1 line
meta/classes-global/base.bbclass +1 -0
+inherit toolchain/gcc

Why is toolchain/gcc inherited if ${TOOLCHAIN} == 'clang'?

meta/classes-global/base.bbclass PACKAGECONFIG_CONFARGS ??= "" · line 24

Quoted 1 line
meta/classes-global/base.bbclass +1 -0
+inherit_defer ${@oe.utils.ifelse(d.getVar('TOOLCHAIN') == 'clang', 'toolchain/clang', '')}

I would have expected this to be:

inherit_defer toolchain/${TOOLCHAIN}

which would make it generic in case someone comes up with a new toolchain... (And it will still work even if there is some technical reason why toolchain/gcc.bbclass must always be inherited as the inherit code will make sure it is only inherited once.)

Since these three (toolchain/gcc-native, toolchain/gcc, and toolchain/clang) are inherited by base.bbclass, which is in classes-global, wouldn't it make sense for them too to be in classes-global? The only reason I see for them being in the classes directory is due to toolchain/clang-native.bbclass, but see above regarding TOOLCHAIN_NATIVE.

Also, why use a subdirectory? I am not saying it is a bad idea, it is just that it has not been done before in OE-Core (or in any layer I have seen) and thus sets a new precedence. After all, the files can just as well be named toolchain-gcc.bbclass etc. On the other hand, if using subdirectories is the way to go, should existing bbclasses be reorganized? It could make it easier to understand which bbclasses are related...

//Peter

Quoted 169 lines
meta/classes-global/base.bbclass +1 -0
+
 def lsb_distro_identifier(d):
     adjust = d.getVar('LSB_DISTRO_ADJUST')
     adjust_func = None
meta/classes-recipe/cross-canadian.bbclass +1 -0
index 059d9aa95f57dd77a0ab5172c4c15c13ed3bc43e..de002ede9d3f5d53a4837334bd5474bcfb208499 100644
@@ -14,6 +14,7 @@
 EXCLUDE_FROM_WORLD = "1"
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-cross-canadian"
 STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}:${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
 
meta/classes-recipe/cross.bbclass +1 -0
index 93de9a527446554b93c1e323c7458cc7aacef799..5c36222d7aba04448b1ab70d61dd7c6d011b6a17 100644
@@ -10,6 +10,7 @@ inherit relocatable
 # no need for them to be a direct target of 'world'
 EXCLUDE_FROM_WORLD = "1"
 
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-cross"
 PACKAGES = ""
 PACKAGES_DYNAMIC = ""
meta/classes-recipe/crosssdk.bbclass +1 -0
index 824b1bcff47bcd36a70aa1d7b8724b6cf07131ff..0117afc404c2df77a1f7cb28831fe409 8dbb4524 100644
@@ -7,6 +7,7 @@
 inherit cross
 
 CLASSOVERRIDE = "class-crosssdk"
+TOOLCHAIN = ""
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
 MACHINEOVERRIDES = ""
meta/classes-recipe/native.bbclass +1 -0
index 625975a69429389a5b231a19b17e8ed7a12d80ad..12630079cd19d6df29f2da94853f6cf2c5895772 100644
@@ -108,6 +108,7 @@ PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
 
 # we dont want libc-*libc to kick in for native recipes
 LIBCOVERRIDE = ""
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-native"
 MACHINEOVERRIDES = ""
 MACHINE_FEATURES = ""
meta/classes-recipe/nativesdk.bbclass +1 -0
index 7ecb4c12c1f0f2b9cc48da215006a153679facf8..f41e5b9642d26cbafeab47ec469441ddd3ff1c09 100644
@@ -13,6 +13,7 @@ STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${S
 # libc for the SDK can be different to that of the target
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
+TOOLCHAIN = ""
 CLASSOVERRIDE = "class-nativesdk"
 MACHINEOVERRIDES = ""
 
meta/classes/toolchain/clang-native.bbclass new file +28 -0
new file mode 100644
index 0000000000000000000000000000000000000000..bf395eade73eaad18bf15f35d03bc0aec2223090
@@ -0,0 +1,28 @@
+# inherit this class if you would like to use clang to compile the native
+# version of your recipes instead of system compiler ( which is normally gcc )
+# on build machines
+# to use it add
+#
+# inherit clang-native
+#
+# to the concerned recipe via a bbappend or directly to recipe file
+#
+BUILD_CC = "${CCACHE}${BUILD_PREFIX}clang ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE}"
+BUILD_CXX = "${CCACHE}${BUILD_PREFIX}clang++ ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE}"
+BUILD_FC = "${BUILD_PREFIX}gfortran ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE}"
+BUILD_CPP = "${BUILD_PREFIX}clang ${BUILD_CC_ARCH} -isysroot=${STAGING_DIR_NATIVE} -E"
+BUILD_LD = "${BUILD_PREFIX}ld ${BUILD_LD_ARCH}"
+BUILD_CCLD = "${BUILD_PREFIX}clang ${BUILD_CC_ARCH}"
+BUILD_AR = "${BUILD_PREFIX}llvm-ar"
+BUILD_AS = "${BUILD_PREFIX}as ${BUILD_AS_ARCH}"
+BUILD_RANLIB = "${BUILD_PREFIX}llvm-ranlib -D"
+BUILD_STRIP = "${BUILD_PREFIX}llvm-strip"
+BUILD_OBJCOPY = "${BUILD_PREFIX}llvm-objcopy"
+BUILD_OBJDUMP = "${BUILD_PREFIX}llvm-objdump"
+BUILD_NM = "${BUILD_PREFIX}llvn-nm"
+BUILD_READELF = "${BUILD_PREFIX}readelf"
+DEPENDS:append = " clang-native compiler-rt-native libcxx-native"
+# Use libcxx headers for native parts
+CXXFLAGS:append = " -stdlib=libc++"
+LDFLAGS:append = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
+BUILD_LDFLAGS:append = " -stdlib=libc++ -rtlib=libgcc -unwindlib=libgcc"
meta/classes/toolchain/clang.bbclass renamed from meta/conf/toolchain/clang.inc +4 -4
similarity index 78%
rename from meta/conf/toolchain/clang.inc
rename to meta/classes/toolchain/clang.bbclass
index 0e5f0769f85a8373c58d4b54dbe2bb1cf7dbd50b..e35e0f0fb1b010dd0f770b749717370041e0ba0d 100644
@@ -17,9 +17,9 @@ READELF = "${HOST_PREFIX}llvm-readelf"
 PREFERRED_PROVIDER_virtual/cross-cc = "${MLPREFIX}clang-cross-${TARGET_ARCH}"
 PREFERRED_PROVIDER_virtual/cross-c++ = "${MLPREFIX}clang-cross-${TARGET_ARCH}"
 PREFERRED_PROVIDER_virtual/compilerlibs = "gcc-runtime"
-PREFERRED_PROVIDER_virtual/cross-cc:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-cc:class-nativesdk = "clang-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "clang-crosssdk-${SDK_SYS}"
 
-PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}"
-PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "gcc-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "clang-crosssdk-${SDK_SYS}"
+PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
meta/classes/toolchain/gcc-native.bbclass renamed from meta/conf/toolchain/build-gcc.inc +0 -1
similarity index 99%
rename from meta/conf/toolchain/build-gcc.inc
rename to meta/classes/toolchain/gcc-native.bbclass
index a708bd0389a123504301fd151fb9ebdb677926be..1e1d68b027806b94e8229d4efef025cc1c038ad3 100644
@@ -12,4 +12,3 @@ BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
 BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
 BUILD_NM = "${BUILD_PREFIX}nm"
 BUILD_READELF = "${BUILD_PREFIX}readelf"
-
meta/classes/toolchain/gcc.bbclass renamed from meta/conf/toolchain/gcc.inc +0 -1
similarity index 99%
rename from meta/conf/toolchain/gcc.inc
rename to meta/classes/toolchain/gcc.bbclass
index 36d33f5d6d0bfbf0f36158f389c4112ce20d806b..2479caf22c2cd48aebcce0abd5e6ac19b1c53a0f 100644
@@ -23,4 +23,3 @@ PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
-
meta/conf/bitbake.conf +2 -4
index e5037c6277841908df333b16adbe4e6cce55f814..83e52e7afaaddb19f7418a549c9b34d8d8ee92f1 100644
@@ -13,6 +13,8 @@ BASELIB = "lib"
 BASELIB:libc-glibc:powerpc64 = "lib64"
 BASELIB:libc-glibc:powerpc64le = "lib64"
 
+TOOLCHAIN ??= "gcc"
+
 # Path prefixes
 export base_prefix = ""
 export prefix = "/usr"
@@ -834,9 +836,6 @@ include conf/licenses.conf
 require conf/sanity.conf
 include conf/bblock.conf
 
-require toolchain/gcc.inc
-require toolchain/build-gcc.inc
-
 ##################################################################
 # Weak variables (usually to retain backwards compatibility)
 ##################################################################
 
--

2.49.0

author
#4 lore raw

PATCH v3 2/13 clang.bbclass: Specify ldso when using usermerge

In reply to Khem Raj

This matches the expectations of distro setups and clang's understanding of what the ldso should look like

---
 meta/classes/toolchain/clang.bbclass | 5 +++++
 1 file changed, 5 insertions(+)
meta/classes/toolchain/clang.bbclass +5 -0
index e35e0f0fb1b010dd0f770b749717370041e0ba0d..6cd150cbd146af82aee89467c176d800dac95c70 100644
@@ -23,3 +23,8 @@ PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "clang-crosssdk-${SDK_SYS
 PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
+
+TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-prefix=/usr", "", d)}"
+
+LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
+LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1"
Signature · 1 line
2.49.0
author
#5 lore raw

PATCH v3 3/13 vte: Disable gi data generation when using clang on arm

In reply to Khem Raj

Fixes Qemu usermode crashes

---
 meta/recipes-support/vte/vte_0.78.2.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-support/vte/vte_0.78.2.bb +4 -0
index 0593d16cd8678d010c240581138caf22f2908659..e37d59833cf3313bdb369f4e0957dfc5e3cb3ace 100644
@@ -26,6 +26,10 @@ SRC_URI[archive.sha256sum] = "35d7bcde07356846b4a12881c8e016705b70a9004a9082285e
 
 ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
 
+# qemu usermode crashes when using clang as system compiler but works with gcc
+# see https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/
+GI_DATA_ENABLED:pn-vte:toolchain-clang:armv7ve = "False"
+
 EXTRA_OEMESON += "${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-Dvapi=true', '-Dvapi=false', d)}"
 EXTRA_OEMESON:append = " ${@bb.utils.contains('GI_DATA_ENABLED', 'False', '-Ddocs=false', '', d)}"
 
Signature · 1 line
2.49.0
author
#6 lore raw

PATCH v3 4/13 clang: Add compiler-rt to default deps when using clang compiler

In reply to Khem Raj

This provides needed built-ins which clang uses along with libgcc its not yet a full replacement for libgcc

---
 meta/classes/toolchain/clang.bbclass | 2 ++
 1 file changed, 2 insertions(+)
meta/classes/toolchain/clang.bbclass +2 -0
index 6cd150cbd146af82aee89467c176d800dac95c70..cc4cdc0356b397e07ea2d6fb5840e3fc9f9955b7 100644
@@ -24,6 +24,8 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "clang-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
 
+BASE_DEFAULT_DEPS:append:class-target = " compiler-rt"
+
 TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-prefix=/usr", "", d)}"
 
 LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
Signature · 1 line
2.49.0
author
#7 lore raw

PATCH v3 5/13 tcf-agent: Fix ranlib call when using llvm-ranlib

In reply to Khem Raj

This ensures that binutils-ranlib or llvm-ranlib
behaves same as gcc-ranlib

---
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +5 -0
index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
@@ -51,6 +51,11 @@ CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"
 CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}"
 CFLAGS:append:loongarch64 = " ${LCL_STOP_SERVICES}"
 
+# This works with gcc-ranlib wrapper only which expands $@ shell array,
+# but it will fail if RANLIB was set to <cross>-ranlib or
+# <cross>-llvm-ranlib has same behaviour
+RANLIB:append:toolchain-clang = " $@"
+
 do_install() {
 	oe_runmake install INSTALLROOT=${D}
 	install -d ${D}${sysconfdir}/init.d/
Signature · 1 line
2.49.0
#8 lore raw

Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib

Quoted 21 lines · Khem Raj via lists.openembedded.org

This ensures that binutils-ranlib or llvm-ranlib
behaves same as gcc-ranlib

---
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++

 1 file changed, 5 insertions(+)
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +0 -0
index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
@@ -51,6 +51,11 @@ CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"

 CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}" CFLAGS:append:loongarch64 = " ${LCL_STOP_SERVICES}"

meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +5 -0
+# This works with gcc-ranlib wrapper only which expands $@ shell array,
+# but it will fail if RANLIB was set to <cross>-ranlib or
+# <cross>-llvm-ranlib has same behaviour
+RANLIB:append:toolchain-clang = " $@"
+
Quoted 4 lines

 do_install() {
  oe_runmake install INSTALLROOT=${D}
  install -d ${D}${sysconfdir}/init.d/

The people on the patch review calls are struggling to understand the issue here. Could you explain this a bit more in the comment so we can understand it?

Does this imply there is a missing piece on the commandline in the makefiles (or whatever) of tcf-agent which should really be fixed instead?

Cheers,

Richard

author
#9 lore raw

Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib

Quoted 31 lines · Richard Purdie
Quoted 15 lines · Khem Raj via lists.openembedded.org

This ensures that binutils-ranlib or llvm-ranlib
behaves same as gcc-ranlib

---
  meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
  1 file changed, 5 insertions(+)
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +0 -0
index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
@@ -51,6 +51,11 @@ CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"
  CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}"

meta/recipes-devtools/tcf-agent/tcf-agent_git.bb CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}" · line 61

Quoted 10 lines
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +5 -0
  CFLAGS:append:loongarch64 = " ${LCL_STOP_SERVICES}"
 
+# This works with gcc-ranlib wrapper only which expands $@ shell array,
+# but it will fail if RANLIB was set to <cross>-ranlib or
+# <cross>-llvm-ranlib has same behaviour
+RANLIB:append:toolchain-clang = " $@"
+
  do_install() {
  	oe_runmake install INSTALLROOT=${D}
  	install -d ${D}${sysconfdir}/init.d/

The people on the patch review calls are struggling to understand the issue here. Could you explain this a bit more in the comment so we can understand it?

Quoted 3 lines

Does this imply there is a missing piece on the commandline in the makefiles (or whatever) of tcf-agent which should really be fixed instead?

I can explain it a bit more. tcf-agent calls RANLIB after calling AR to create the archive [1], when RANLIB is set to gcc-ranlib this goes unnoticed, since calling gcc-ranlib without any arguments it silenlty does nothing and exits with return code 0, however, calling ranlib or llvm-ranlib does demand library name as commandline option and since it is not there it exits with code 1

aarch64-poky-linux-musl-llvm-ranlib
OVERVIEW: LLVM ranlib

Generate an index for archives

USAGE: aarch64-poky-linux-musl-llvm-ranlib archive...

OPTIONS:

  -h --help             - Display available options
  -V --version          - Display the version of this program
  -D                    - Use zero for timestamps and uids/gids (default)
  -U                    - Use actual timestamps and uids/gids
  -X{32|64|32_64|any}   - Specify which archive symbol tables should be 

generated if they do not already exist (AIX OS only) aarch64-poky-linux-musl-llvm-ranlib: error: an archive name must be specified
make: *** [Makefile:53: obj/GNU/Linux/a64/Debug/libtcf.a] Error 1

When we add $@, to RANLIB then it becomes the make variable,
$@ - An automatic Makefile variable that expands to the target name (the file being built)

so the makefile target now rightly adds the .a filename to RANLIB call.

tcf-agent seems to add $@ for solaris and osx, I guess someone saw the problem on default ranlib on these platforms but not on linux where gcc-ar is used commonly.

[1] https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53

Quoted 4 lines

Cheers,

Richard

#10 lore raw

Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib

Quoted 69 lines · Khem Raj
Quoted 31 lines · Richard Purdie
Quoted 21 lines · Khem Raj via lists.openembedded.org

This ensures that binutils-ranlib or llvm-ranlib
behaves same as gcc-ranlib

---
  meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++

  1 file changed, 5 insertions(+)
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +0 -0
index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
@@ -51,6 +51,11 @@ CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"

  CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}" CFLAGS:append:loongarch64 = " ${LCL_STOP_SERVICES}"

meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +5 -0
+# This works with gcc-ranlib wrapper only which expands $@ shell array,
+# but it will fail if RANLIB was set to <cross>-ranlib or
+# <cross>-llvm-ranlib has same behaviour
+RANLIB:append:toolchain-clang = " $@"
+
Quoted 4 lines

  do_install() {
   oe_runmake install INSTALLROOT=${D}
   install -d ${D}${sysconfdir}/init.d/

The people on the patch review calls are struggling to understand the issue here. Could you explain this a bit more in the comment so we can understand it?

Quoted 3 lines

Does this imply there is a missing piece on the commandline in the makefiles (or whatever) of tcf-agent which should really be fixed instead?

I can explain it a bit more. tcf-agent calls RANLIB after calling AR to create the archive [1], when RANLIB is set to gcc-ranlib this goes unnoticed, since calling gcc-ranlib without any arguments it silenlty does nothing and exits with return code 0, however, calling ranlib or llvm-ranlib does demand library name as commandline option and since it is not there it exits with code 1

aarch64-poky-linux-musl-llvm-ranlib
OVERVIEW: LLVM ranlib

Generate an index for archives

USAGE: aarch64-poky-linux-musl-llvm-ranlib archive...

OPTIONS:
   -h --help             - Display available options
   -V --version          - Display the version of this program -D                    - Use zero for timestamps and uids/gids (default) -U                    - Use actual timestamps and uids/gids -X{32|64|32_64|any}   - Specify which archive symbol tables should be generated if they do not already exist (AIX OS only) aarch64-poky-linux-musl-llvm-ranlib: error: an archive name must be specified
make: *** [Makefile:53: obj/GNU/Linux/a64/Debug/libtcf.a] Error 1

When we add $@, to RANLIB then it becomes the make variable, $@ - An automatic Makefile variable that expands to the target name (the file being built)

Quoted 8 lines

so the makefile target now rightly adds the .a filename to RANLIB call.

tcf-agent seems to add $@ for solaris and osx, I guess someone saw the problem on default ranlib on these platforms but not on linux where gcc-ar is used commonly.

[1]
https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53

Can we open something with tcf agent to add this on linux then? I'm just worried this workaround is fairly fragile and likely to cause us problems in future. In some ways I'd rather patch tcf agent for this issue as that would at least be clearer.

If we have an open upstream ticket or patch, then we can probably just append the variable for now.

Cheers,

Richard

author
#11 lore raw

Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib

Quoted 80 lines · Richard Purdie
Quoted 69 lines · Khem Raj
Quoted 31 lines · Richard Purdie
Quoted 15 lines · Khem Raj via lists.openembedded.org

This ensures that binutils-ranlib or llvm-ranlib
behaves same as gcc-ranlib

---
  meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
  1 file changed, 5 insertions(+)
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +0 -0
index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
@@ -51,6 +51,11 @@ CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}"
  CFLAGS:append:riscv32 = " ${LCL_STOP_SERVICES}"

meta/recipes-devtools/tcf-agent/tcf-agent_git.bb CFLAGS:append:riscv64 = " ${LCL_STOP_SERVICES}" · line 61

Quoted 10 lines
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +5 -0
  CFLAGS:append:loongarch64 = " ${LCL_STOP_SERVICES}"
 
+# This works with gcc-ranlib wrapper only which expands $@ shell array,
+# but it will fail if RANLIB was set to <cross>-ranlib or
+# <cross>-llvm-ranlib has same behaviour
+RANLIB:append:toolchain-clang = " $@"
+
  do_install() {
          oe_runmake install INSTALLROOT=${D}
          install -d ${D}${sysconfdir}/init.d/

The people on the patch review calls are struggling to understand the issue here. Could you explain this a bit more in the comment so we can understand it?

Quoted 3 lines

Does this imply there is a missing piece on the commandline in the makefiles (or whatever) of tcf-agent which should really be fixed instead?

I can explain it a bit more. tcf-agent calls RANLIB after calling AR to create the archive [1], when RANLIB is set to gcc-ranlib this goes unnoticed, since calling gcc-ranlib without any arguments it silenlty does nothing and exits with return code 0, however, calling ranlib or llvm-ranlib does demand library name as commandline option and since it is not there it exits with code 1

aarch64-poky-linux-musl-llvm-ranlib
OVERVIEW: LLVM ranlib

Generate an index for archives

USAGE: aarch64-poky-linux-musl-llvm-ranlib archive...

OPTIONS:

   -h --help             - Display available options
   -V --version          - Display the version of this program
   -D                    - Use zero for timestamps and uids/gids (default)
   -U                    - Use actual timestamps and uids/gids
   -X{32|64|32_64|any}   - Specify which archive symbol tables should be

generated if they do not already exist (AIX OS only) aarch64-poky-linux-musl-llvm-ranlib: error: an archive name must be specified
make: *** [Makefile:53: obj/GNU/Linux/a64/Debug/libtcf.a] Error 1

When we add $@, to RANLIB then it becomes the make variable, $@ - An automatic Makefile variable that expands to the target name (the file being built)

Quoted 8 lines

so the makefile target now rightly adds the .a filename to RANLIB call.

tcf-agent seems to add $@ for solaris and osx, I guess someone saw the problem on default ranlib on these platforms but not on linux where gcc-ar is used commonly.

[1]
https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/blob/master/agent/Makefile?ref_type=heads#L53

Quoted 7 lines

Can we open something with tcf agent to add this on linux then? I'm just worried this workaround is fairly fragile and likely to cause us problems in future. In some ways I'd rather patch tcf agent for this issue as that would at least be clearer.

If we have an open upstream ticket or patch, then we can probably just append the variable for now.

I think upstream expects the environment to set it with the parameter option added, or not set it
at all which then makes it an empty string. In any case I have send a PR for it already

https://gitlab.eclipse.org/eclipse/tcf/tcf.agent/-/merge_requests/7

Quoted 5 lines

Cheers,

Richard

author
#12 lore raw

PATCH v3 6/13 libjpeg-turbo: Fix build on mips/clang

In reply to Khem Raj
---
 meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +6 -0
index 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e08e47d953bf5773e19 100644
@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA
 DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
 DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
 
+# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
+# <instantiation>:13:5: error: invalid token in expression
+# .if $17 != 0
+# ^
+CFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as"
+
 PACKAGES =+ "jpeg-tools libturbojpeg"
 
 DESCRIPTION:jpeg-tools = "The jpeg-tools package includes client programs to access libjpeg functionality.  These tools allow for the compression, decompression, transformation and display of JPEG files and benchmarking of the libjpeg library."
Signature · 1 line
2.49.0
#13 lore raw

Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang

Quoted 27 lines · Khem Raj via lists.openembedded.org

---
 meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++

 1 file changed, 6 insertions(+)
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0

index 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e08e47 d953bf5773e19 100644

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0
@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le = "

${@bb.utils.contains("TUNE_FEA DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"
 DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +6 -0
+# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
+# <instantiation>:13:5: error: invalid token in expression
+# .if $17 != 0
+# ^
+CFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as"
+
Quoted 1 line

 PACKAGES =+ "jpeg-tools libturbojpeg"

I noticed you use "-no-integrated-as" but in the next patch in pixman, you use "-fno-integrated-as". Should we be consistent or are these different?

Cheers,

Richard

author
#14 lore raw

Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang

Quoted 23 lines · Richard Purdie
Quoted 21 lines · Khem Raj via lists.openembedded.org
---
  meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
  1 file changed, 6 insertions(+)
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0

index 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e08e47 d953bf5773e19 100644

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0
@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le = "

${@bb.utils.contains("TUNE_FEA
 DEBUG_OPTIMIZATION:append:armv4 = "
${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"
 DEBUG_OPTIMIZATION:append:armv5 = "
${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"

Quoted 11 lines

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA · line 56

Quoted 7 lines
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +6 -0
+# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
+# <instantiation>:13:5: error: invalid token in expression
+# .if $17 != 0
+# ^
+CFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as"
+
  PACKAGES =+ "jpeg-tools libturbojpeg"

I noticed you use "-no-integrated-as" but in the next patch in pixman, you use "-fno-integrated-as". Should we be consistent or are these different?

they are effectively same. -no-integrated-as is legacy clang option format while -fno-integrated-as is more in line with gcc options it's generally better to use -fno-integrated-as since it follows the conventional flag naming pattern that other compilers might also recognize.

I will change it in a follow up for consistency.

Quoted 4 lines

Cheers,

Richard

#15 lore raw

Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang

Quoted 42 lines · Khem Raj
Quoted 30 lines · Richard Purdie
Quoted 27 lines · Khem Raj via lists.openembedded.org

---
  meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++

  1 file changed, 6 insertions(+)
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0

index 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e0 8e47
d953bf5773e19 100644

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0
@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le

= "
${@bb.utils.contains("TUNE_FEA DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"
  DEBUG_OPTIMIZATION:append:armv5 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +4 -0
+# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
+# <instantiation>:13:5: error: invalid token in expression
+# .if $17 != 0
+# ^
Quoted 8 lines
Quoted 3 lines
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +2 -0
+CFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as"
+

  PACKAGES =+ "jpeg-tools libturbojpeg"

I noticed you use "-no-integrated-as" but in the next patch in pixman,
you use "-fno-integrated-as". Should we be consistent or are these different?

Quoted 7 lines

they are effectively same. -no-integrated-as is legacy clang option format while -fno-integrated-as is more in line with gcc options it's generally better to use -fno-integrated-as since it follows the conventional flag naming pattern that other compilers might also recognize.

I will change it in a follow up for consistency.

I've tweaked the patch and merged it. With the pixman one we need to explain the DEPENDS change before that one can go in.

Cheers,

Richard

author
#16 lore raw

Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang

Quoted 50 lines · Richard Purdie
Quoted 48 lines · Khem Raj
Quoted 26 lines · Richard Purdie
Quoted 23 lines · Khem Raj via lists.openembedded.org
---
  meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
  1 file changed, 6 insertions(+)
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0

index 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e0 8e47
d953bf5773e19 100644

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +0 -0
@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le

= "
${@bb.utils.contains("TUNE_FEA
DEBUG_OPTIMIZATION:append:armv4 = "
${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"
DEBUG_OPTIMIZATION:append:armv5 = "
${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame- pointer', '', d)}"

Quoted 12 lines

meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA · line 56

Quoted 7 lines
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +6 -0
+# libjpeg-turbo-2.0.2/simd/mips/jsimd_dspr2.S
+# <instantiation>:13:5: error: invalid token in expression
+# .if $17 != 0
+# ^
+CFLAGS:append:toolchain-clang:mipsarch = " -no-integrated-as"
+
  PACKAGES =+ "jpeg-tools libturbojpeg"

I noticed you use "-no-integrated-as" but in the next patch in pixman,
you use "-fno-integrated-as". Should we be consistent or are these different?

they are effectively same. -no-integrated-as is legacy clang option format while -fno-integrated-as is more in line with gcc options it's generally better to use -fno-integrated-as since it follows the conventional flag naming pattern that other compilers might also recognize.

Quoted 5 lines
Quoted 1 line

I will change it in a follow up for consistency.

I've tweaked the patch and merged it. With the pixman one we need to explain the DEPENDS change before that one can go in.

Thanks. For DEPENDS I am sending a new version

Quoted 3 lines

Cheers,

Richard

author
#17 lore raw

PATCH v3 7/13 pixman: Fix build with mips/clang

In reply to Khem Raj
---
 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +3 -0
index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
@@ -6,6 +6,7 @@ including trapezoids, triangles, and rectangles."
 HOMEPAGE = "http://www.pixman.org"
 SECTION = "x11/libs"
 DEPENDS = "zlib"
+DEPENDS:append:toolchain-clang:mipsarch = " openmp"
 
 SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz"
 SRC_URI[sha256sum] = "02d9ff7b8458ef61731c3d355f854bbf461fd0a4d3563c51f1c1c7b00638050d"
@@ -38,6 +39,8 @@ EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon","","
 
 EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
 
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
+
 BBCLASSEXTEND = "native nativesdk"
 
 CVE_STATUS[CVE-2023-37769] = "not-applicable-config: stress-test is an uninstalled test"
Signature · 1 line
2.49.0
#18 lore raw

Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang

Quoted 23 lines · Khem Raj via lists.openembedded.org

---
 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++

 1 file changed, 3 insertions(+)
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
@@ -6,6 +6,7 @@ including trapezoids, triangles, and rectangles."

 HOMEPAGE = "http://www.pixman.org"
 SECTION = "x11/libs"
 DEPENDS = "zlib"
+DEPENDS:append:toolchain-clang:mipsarch = " openmp"

 SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz" SRC_URI[sha256sum] = "02d9ff7b8458ef61731c3d355f854bbf461fd0a4d3563c51f1c1c7b00638050d"

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +0 -0
@@ -38,6 +39,8 @@ EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon","","


 EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +2 -0
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
+
Quoted 1 line

 BBCLASSEXTEND = "native nativesdk"

See the comment on libjpeg-turbo. Should there be a -f here or not?

Cheers,

Richard

author
#19 lore raw

Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang

Quoted 21 lines · Richard Purdie
Quoted 19 lines · Khem Raj via lists.openembedded.org
---
 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +1 -0
index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
@@ -6,6 +6,7 @@ including trapezoids, triangles, and rectangles."
 HOMEPAGE = "http://www.pixman.org"
 SECTION = "x11/libs"
 DEPENDS = "zlib"
+DEPENDS:append:toolchain-clang:mipsarch = " openmp"
 
 SRC_URI = "https://www.cairographics.org/releases/${BP}.tar.gz"
 SRC_URI[sha256sum] = "02d9ff7b8458ef61731c3d355f854bbf461fd0a4d3563c51f1c1c7b00638050d"
@@ -38,6 +39,8 @@ EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon","","
 
Quoted 8 lines

meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb EXTRA_OEMESON:append:armv7ve = "${@bb.utils.contains("TUNE_FEATURES","neon",""," · line 44

Quoted 5 lines
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb +2 -0
 EXTRA_OEMESON:append:class-native = " -Dopenmp=disabled"
 
+CFLAGS:append:toolchain-clang:mipsarch = " -fno-integrated-as"
+
 BBCLASSEXTEND = "native nativesdk"

See the comment on libjpeg-turbo. Should there be a -f here or not?

right, we will fix libjpeg-turbo to match what we have here.

Quoted 5 lines

Cheers,

Richard

#20 lore raw

Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang

In reply to Khem Raj
Quoted 2 lines · Khem Raj via lists.openembedded.org

+DEPENDS:append:toolchain-clang:mipsarch = " openmp”

Can you elaborate on why openmp is only needed for mips with clang, and no other targets?

Ross

author
#21 lore raw

Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang

Quoted 7 lines · Ross Burton
Quoted 2 lines · Khem Raj via lists.openembedded.org

+DEPENDS:append:toolchain-clang:mipsarch = " openmp”

Can you elaborate on why openmp is only needed for mips with clang, and no other targets?

seems pixman's detection logic for openMP support checks for including omp.h. I see for qemumips, it ends up detecting openmp even when its not in dependencies because omp.h is
installed by libgomp from gcc-runtime.

Run-time dependency OpenMP found: YES 5.1

where the same test on qemuarm64 fails with

mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/pixman/0.46.0/build/meson-private/tmpyl863djw/testfile.c:4:12:
error: "Header 'omp_lib.h' could not be found"
4 | #error "Header 'omp_lib.h' could not be found"
| ^
1 error generated.
-----------
WARNING: OpenMP found but omp.h missing.
Run-time dependency OpenMP found: NO (tried system)

It culminates to a problem in header include paths that mips and aarch64 clang is using

mips
#include <...> search starts here:
/mnt/b/yoe/master/sources/poky/build/tmp/work/mips32r2-poky-linux-musl/pixman/0.46.0/recipe-sysroot/usr/lib/mips-poky-linux-musl/15.1.0/include /mnt/b/yoe/master/sources/poky/build/tmp/work/mips32r2-poky-linux-musl/pixman/0.46.0/recipe-sysroot/usr/include /mnt/b/yoe/master/sources/poky/build/tmp/work/mips32r2-poky-linux-musl/pixman/0.46.0/recipe-sysroot-native/usr/lib/clang/20/include
End of search list.

aarch64
#include <...> search starts here:
/mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/pixman/0.46.0/recipe-sysroot/usr/include /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux-musl/pixman/0.46.0/recipe-sysroot-native/usr/lib/clang/20/include
End of search list.

that's why it finds omp.h since the path is on searchdir on mips but not on aarch64, I think mips behavior is unwanted.

I think the linking to openmp should be unconditional on clang, since it will be using it with gcc but then disables it for clang since the test fails. I will send another version

Quoted 2 lines

Ross

author
#22 lore raw

PATCH v3 8/13 vulkan-samples: Disable overriding-option as error

In reply to Khem Raj

Clang complains/warns about mixing -ffp-contract=fast and -ffp-model=precise lower this to warning only, this does not impact code generation, we still get the diagnostic messge but wont break the build

---
 meta/recipes-graphics/vulkan/vulkan-samples_git.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-graphics/vulkan/vulkan-samples_git.bb +4 -0
index 554e6eb29022e763de755dd550464cbd986de61e..505b6ab2f2865fec26339c9f1c4aa10c6735355b 100644
@@ -33,4 +33,8 @@ EXTRA_OECMAKE += "-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON"
 # This needs to be specified explicitly to avoid xcb/xlib dependencies
 EXTRA_OECMAKE += "-DVKB_WSI_SELECTION=D2D"
 
+# Clang is fussy about incompatible options on aarch64/x86_64
+# x86_64-poky-linux-clang++: error: overriding '-ffp-model=precise' option with '-ffp-contract=fast' [-Werror,-Woverriding-option]
+CXXFLAGS:append:toolchain-clang = " -Wno-error=overriding-option"
+
 COMPATIBLE_HOST = "(aarch64|x86_64).*-linux"
Signature · 1 line
2.49.0
author
#23 lore raw

PATCH v3 9/13 bluez: Disable invalid-pp-token warning with clang

In reply to Khem Raj

We add FIRMWARE_DIR via CFLAGS using escapes for string and clang option parser flags it

<command line>:4:23: warning: missing terminating '"' character [-Winvalid-pp-token]
4 | #define FIRMWARE_DIR \"/usr/lib/firmware\"
| ^

emitting this warning during configure means some tests fail wrongly. e.g. test for enable -fPIC -DPIC, which results in textrels in libbbluetooth.so

This warning can be disabled, the string is correctly passed to sources in the end, so its spurious

---
 meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-connectivity/bluez5/bluez5.inc +1 -0
index 7bae968094f2a272c4deff7416dbd1208549e6ce..5835662f7a63a23915ec4af94597ec4a614a4640 100644
@@ -84,6 +84,7 @@ EXTRA_OECONF = "\
 "
 
 CFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\""
+CFLAGS:append:toolchain-clang = " -Wno-invalid-pp-token"
 
 # bluez5 builds a large number of useful utilities but does not
 # install them.  Specify which ones we want put into ${PN}-noinst-tools.
Signature · 1 line
2.49.0
author
#24 lore raw

PATCH v3 10/13 systemtap: Pin to build with GCC

In reply to Khem Raj

clang find a lot of warning

| In file included from ../git/tapset-procfs.cxx:11:
| ../git/session.h:169:47: error: 'used' attribute ignored on a non-definition declaration [-Werror,-Wignored-attributes]
|   169 |   static const char* morehelp __attribute__ ((used));
|       |                                               ^
---
 meta/recipes-kernel/systemtap/systemtap_git.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-kernel/systemtap/systemtap_git.bb +4 -0
index 21d50ffb04977bdd9666fbabb5e27289aff01370..254bac4d6f9c8637c575b4b7896322bd42e96841 100644
@@ -99,3 +99,7 @@ do_install:append () {
 }
 
 BBCLASSEXTEND = "nativesdk"
+
+# Emits lot of warning which are treated as errors
+# They must be looked into before disabling
+TOOLCHAIN = "gcc"
Signature · 1 line
2.49.0
author
#25 lore raw

PATCH v3 11/13 seatd: Disable sign-compare warning as error on clang

In reply to Khem Raj

Make it build with clang+musl combo

---
 meta/recipes-core/seatd/seatd_0.9.1.bb | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/recipes-core/seatd/seatd_0.9.1.bb +8 -0
index 8ee43a3dc8f61eeb6f1c03dbd5a68585fa471424..87e1c3b67d69ba29cfde14caf17e3a2010046eac 100644
@@ -15,6 +15,14 @@ inherit meson pkgconfig systemd update-rc.d useradd
 
 # https://www.openwall.com/lists/musl/2020/01/20/3
 CFLAGS:append:libc-musl:powerpc64le = " -Wno-error=overflow"
+#../git/common/connection.c:154:55: error: comparison of integers of different signs: 'unsigned long' and 'long' [-Werror,-Wsign-compare]
+#  154 |         for (cmsg = CMSG_FIRSTHDR(msg); cmsg != NULL; cmsg = CMSG_NXTHDR(msg, cmsg)) {
+#      |                                                              ^~~~~~~~~~~~~~~~~~~~~~
+#/mnt/b/yoe/master/sources/poky/build/tmp/work/riscv64-poky-linux-musl/seatd/0.9.1/recipe-sysroot/usr/include/sys/socket.h:358:44: note: expanded from macro 'CMSG_NXTHDR'
+#  358 |         __CMSG_LEN(cmsg) + sizeof(struct cmsghdr) >= __MHDR_END(mhdr) - (unsigned char *)(cmsg) \
+#      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#1 error generated.
+CFLAGS:append:libc-musl:toolchain-clang = " -Wno-error=sign-compare"
 
 PACKAGECONFIG ?= " \
 	${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
Signature · 1 line
2.49.0
author
#26 lore raw

PATCH v3 12/13 systemd-boot: Pin to use gcc toolchain on arm

In reply to Khem Raj

clang does not support -mgeneral-regs-only option for arm

---
 meta/recipes-core/systemd/systemd-boot_257.5.bb | 3 +++
 1 file changed, 3 insertions(+)
meta/recipes-core/systemd/systemd-boot_257.5.bb +3 -0
index 6a50ac05aa9915982dca4649f7bda610cfbfa14b..7d22e7aa8c07fd72a3e4fe08ed4218c1031284e5 100644
@@ -49,6 +49,9 @@ RDEPENDS:${PN} += "virtual-systemd-bootconf"
 
 CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t"
 
+# arm-poky-linux-musleabi-clang: error: unsupported option '-mgeneral-regs-only' for target 'arm-poky-linux-musleabi'
+TOOLCHAIN:arm = "gcc"
+
 COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*|riscv.*)-linux"
 COMPATIBLE_HOST:x86-x32 = "null"
 
Signature · 1 line
2.49.0
author
#27 lore raw

PATCH v3 13/13 meta: Add TCOVERRIDE for toolchain selection at recipe scope

In reply to Khem Raj

TCOVERRIDE is defined to toolchain-<TOOLCHAIN> and its added to OVERRIDES that a recipe can see and it can use "toolchain-gcc" or "toolchain-clang" to set specific metadata based upon global distro toolchain policy.

---
 meta/classes-global/base.bbclass           | 1 +
 meta/classes-recipe/cross-canadian.bbclass | 1 +
 meta/classes-recipe/cross.bbclass          | 1 +
 meta/classes-recipe/crosssdk.bbclass       | 1 +
 meta/classes-recipe/native.bbclass         | 1 +
 meta/classes-recipe/nativesdk.bbclass      | 1 +
 meta/classes/toolchain/clang.bbclass       | 2 ++
 meta/classes/toolchain/gcc.bbclass         | 2 ++
 meta/conf/bitbake.conf                     | 2 +-
 9 files changed, 11 insertions(+), 1 deletion(-)
meta/classes-global/base.bbclass +1 -0
index 1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4..684dfee92040b28bfcc1bce7087faec791443b1b 100644
@@ -6,6 +6,7 @@
 
 BB_DEFAULT_TASK ?= "build"
 CLASSOVERRIDE ?= "class-target"
+TCOVERRIDE ?= "toolchain-gcc"
 
 inherit patch
 inherit staging
meta/classes-recipe/cross-canadian.bbclass +1 -0
index de002ede9d3f5d53a4837334bd5474bcfb208499..dda00f9a5cf2edf1cb76ab38879e611363ee4c8c 100644
@@ -15,6 +15,7 @@ EXCLUDE_FROM_WORLD = "1"
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
 TOOLCHAIN = ""
+TCOVERRIDE = ""
 CLASSOVERRIDE = "class-cross-canadian"
 STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}:${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
 
meta/classes-recipe/cross.bbclass +1 -0
index 5c36222d7aba04448b1ab70d61dd7c6d011b6a17..d1a57cbcfef49d90de23691984141abb8651d089 100644
@@ -11,6 +11,7 @@ inherit relocatable
 EXCLUDE_FROM_WORLD = "1"
 
 TOOLCHAIN = ""
+TCOVERRIDE = ""
 CLASSOVERRIDE = "class-cross"
 PACKAGES = ""
 PACKAGES_DYNAMIC = ""
meta/classes-recipe/crosssdk.bbclass +1 -0
index 0117afc404c2df77a1f7cb28831fe4098dbb4524..0c0144b26829d3b76d034a89133ee94cf760b86d 100644
@@ -7,6 +7,7 @@
 inherit cross
 
 CLASSOVERRIDE = "class-crosssdk"
+TCOVERRIDE = ""
 TOOLCHAIN = ""
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
meta/classes-recipe/native.bbclass +1 -0
index 12630079cd19d6df29f2da94853f6cf2c5895772..cbdace9b7021e90a4df2684d9eacda36112b46c6 100644
@@ -108,6 +108,7 @@ PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"
 
 # we dont want libc-*libc to kick in for native recipes
 LIBCOVERRIDE = ""
+TCOVERRIDE = ""
 TOOLCHAIN = ""
 CLASSOVERRIDE = "class-native"
 MACHINEOVERRIDES = ""
meta/classes-recipe/nativesdk.bbclass +1 -0
index f41e5b9642d26cbafeab47ec469441ddd3ff1c09..440bc3a5c5434152dfe5c9c19db1c2be857cd794 100644
@@ -13,6 +13,7 @@ STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${S
 # libc for the SDK can be different to that of the target
 NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
+TCOVERRIDE = ""
 TOOLCHAIN = ""
 CLASSOVERRIDE = "class-nativesdk"
 MACHINEOVERRIDES = ""
meta/classes/toolchain/clang.bbclass +2 -0
index cc4cdc0356b397e07ea2d6fb5840e3fc9f9955b7..8a0a2c315a2d4cddf795d185891a6ca1661f65fa 100644
@@ -30,3 +30,5 @@ TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-pre
 
 LDFLAGS:append:class-nativesdk:x86-64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-x86-64.so.2"
 LDFLAGS:append:class-nativesdk:aarch64 = " -Wl,-dynamic-linker,${base_libdir}/ld-linux-aarch64.so.1"
+
+TCOVERRIDE = "toolchain-clang"
meta/classes/toolchain/gcc.bbclass +2 -0
index 2479caf22c2cd48aebcce0abd5e6ac19b1c53a0f..75f9abe999a297c7b17e64e693ffd8f441bb16b1 100644
@@ -23,3 +23,5 @@ PREFERRED_PROVIDER_virtual/cross-c++:class-nativesdk = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "gcc-crosssdk-${SDK_SYS}"
 PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
+
+TCOVERRIDE = "toolchain-gcc"
meta/conf/bitbake.conf +1 -1
index 83e52e7afaaddb19f7418a549c9b34d8d8ee92f1..cfd70498b246fa1bf03e4730ecd5bf5be759ed44 100644
@@ -803,7 +803,7 @@ DISTRO_NAME ??= "OpenEmbedded"
 # And finally '<foo>:forcevariable' overrides any standard variable, with the highest priority.
 # This works for functions as well, they are really just variables.
 #
-OVERRIDES = "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:layer-${FILE_LAYERNAME}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}${LIBCOVERRIDE}:forcevariable"
+OVERRIDES = "${TARGET_OS}:${TRANSLATED_TARGET_ARCH}:pn-${PN}:layer-${FILE_LAYERNAME}:${MACHINEOVERRIDES}:${DISTROOVERRIDES}:${CLASSOVERRIDE}:${TCOVERRIDE}${LIBCOVERRIDE}:forcevariable"
 FILE_LAYERNAME ??= "config"
 LIBCOVERRIDE ?= ""
 CLASSOVERRIDE ?= "class-target"
Signature · 1 line
2.49.0