* [PATCH v3 00/13] clang: Add clang C/C++ toolchain
@ 2025-05-23 3:52 Khem Raj
2025-05-23 3:52 ` [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain Khem Raj
` (12 more replies)
0 siblings, 13 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj, Ross Burton
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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
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/20250520-clang-toolchain-v2-0-db97c2eb3756@gmail.com
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/20250518-clang-toolchain-v1-0-5be46f8c4af5@gmail.com
---
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,
--
Khem Raj <raj.khem@gmail.com>
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-29 14:10 ` [OE-core] " Richard Purdie
2025-05-29 23:44 ` Peter Kjellerstedt
2025-05-23 3:52 ` [PATCH v3 02/13] clang.bbclass: Specify ldso when using usermerge Khem Raj
` (11 subsequent siblings)
12 siblings, 2 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
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"
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
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(-)
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 8215969c7bb37c1a1b91e260cd31714fee2db87c..1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -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
diff --git a/meta/classes-recipe/cross-canadian.bbclass b/meta/classes-recipe/cross-canadian.bbclass
index 059d9aa95f57dd77a0ab5172c4c15c13ed3bc43e..de002ede9d3f5d53a4837334bd5474bcfb208499 100644
--- a/meta/classes-recipe/cross-canadian.bbclass
+++ b/meta/classes-recipe/cross-canadian.bbclass
@@ -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}"
diff --git a/meta/classes-recipe/cross.bbclass b/meta/classes-recipe/cross.bbclass
index 93de9a527446554b93c1e323c7458cc7aacef799..5c36222d7aba04448b1ab70d61dd7c6d011b6a17 100644
--- a/meta/classes-recipe/cross.bbclass
+++ b/meta/classes-recipe/cross.bbclass
@@ -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 = ""
diff --git a/meta/classes-recipe/crosssdk.bbclass b/meta/classes-recipe/crosssdk.bbclass
index 824b1bcff47bcd36a70aa1d7b8724b6cf07131ff..0117afc404c2df77a1f7cb28831fe4098dbb4524 100644
--- a/meta/classes-recipe/crosssdk.bbclass
+++ b/meta/classes-recipe/crosssdk.bbclass
@@ -7,6 +7,7 @@
inherit cross
CLASSOVERRIDE = "class-crosssdk"
+TOOLCHAIN = ""
NATIVESDKLIBC ?= "libc-glibc"
LIBCOVERRIDE = ":${NATIVESDKLIBC}"
MACHINEOVERRIDES = ""
diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass
index 625975a69429389a5b231a19b17e8ed7a12d80ad..12630079cd19d6df29f2da94853f6cf2c5895772 100644
--- a/meta/classes-recipe/native.bbclass
+++ b/meta/classes-recipe/native.bbclass
@@ -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 = ""
diff --git a/meta/classes-recipe/nativesdk.bbclass b/meta/classes-recipe/nativesdk.bbclass
index 7ecb4c12c1f0f2b9cc48da215006a153679facf8..f41e5b9642d26cbafeab47ec469441ddd3ff1c09 100644
--- a/meta/classes-recipe/nativesdk.bbclass
+++ b/meta/classes-recipe/nativesdk.bbclass
@@ -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 = ""
diff --git a/meta/classes/toolchain/clang-native.bbclass b/meta/classes/toolchain/clang-native.bbclass
new file mode 100644
index 0000000000000000000000000000000000000000..bf395eade73eaad18bf15f35d03bc0aec2223090
--- /dev/null
+++ b/meta/classes/toolchain/clang-native.bbclass
@@ -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"
diff --git a/meta/conf/toolchain/clang.inc b/meta/classes/toolchain/clang.bbclass
similarity index 78%
rename from meta/conf/toolchain/clang.inc
rename to meta/classes/toolchain/clang.bbclass
index 0e5f0769f85a8373c58d4b54dbe2bb1cf7dbd50b..e35e0f0fb1b010dd0f770b749717370041e0ba0d 100644
--- a/meta/conf/toolchain/clang.inc
+++ b/meta/classes/toolchain/clang.bbclass
@@ -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"
diff --git a/meta/conf/toolchain/build-gcc.inc b/meta/classes/toolchain/gcc-native.bbclass
similarity index 99%
rename from meta/conf/toolchain/build-gcc.inc
rename to meta/classes/toolchain/gcc-native.bbclass
index a708bd0389a123504301fd151fb9ebdb677926be..1e1d68b027806b94e8229d4efef025cc1c038ad3 100644
--- a/meta/conf/toolchain/build-gcc.inc
+++ b/meta/classes/toolchain/gcc-native.bbclass
@@ -12,4 +12,3 @@ BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
BUILD_NM = "${BUILD_PREFIX}nm"
BUILD_READELF = "${BUILD_PREFIX}readelf"
-
diff --git a/meta/conf/toolchain/gcc.inc b/meta/classes/toolchain/gcc.bbclass
similarity index 99%
rename from meta/conf/toolchain/gcc.inc
rename to meta/classes/toolchain/gcc.bbclass
index 36d33f5d6d0bfbf0f36158f389c4112ce20d806b..2479caf22c2cd48aebcce0abd5e6ac19b1c53a0f 100644
--- a/meta/conf/toolchain/gcc.inc
+++ b/meta/classes/toolchain/gcc.bbclass
@@ -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"
-
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index e5037c6277841908df333b16adbe4e6cce55f814..83e52e7afaaddb19f7418a549c9b34d8d8ee92f1 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 02/13] clang.bbclass: Specify ldso when using usermerge
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
2025-05-23 3:52 ` [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 03/13] vte: Disable gi data generation when using clang on arm Khem Raj
` (10 subsequent siblings)
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
This matches the expectations of distro setups and clang's understanding
of what the ldso should look like
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/classes/toolchain/clang.bbclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/meta/classes/toolchain/clang.bbclass b/meta/classes/toolchain/clang.bbclass
index e35e0f0fb1b010dd0f770b749717370041e0ba0d..6cd150cbd146af82aee89467c176d800dac95c70 100644
--- a/meta/classes/toolchain/clang.bbclass
+++ b/meta/classes/toolchain/clang.bbclass
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 03/13] vte: Disable gi data generation when using clang on arm
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
2025-05-23 3:52 ` [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain Khem Raj
2025-05-23 3:52 ` [PATCH v3 02/13] clang.bbclass: Specify ldso when using usermerge Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 04/13] clang: Add compiler-rt to default deps when using clang compiler Khem Raj
` (9 subsequent siblings)
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Fixes Qemu usermode crashes
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-support/vte/vte_0.78.2.bb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/recipes-support/vte/vte_0.78.2.bb b/meta/recipes-support/vte/vte_0.78.2.bb
index 0593d16cd8678d010c240581138caf22f2908659..e37d59833cf3313bdb369f4e0957dfc5e3cb3ace 100644
--- a/meta/recipes-support/vte/vte_0.78.2.bb
+++ b/meta/recipes-support/vte/vte_0.78.2.bb
@@ -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/20240923234336.3978188-1-raj.khem@gmail.com/
+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)}"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 04/13] clang: Add compiler-rt to default deps when using clang compiler
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (2 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 03/13] vte: Disable gi data generation when using clang on arm Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib Khem Raj
` (8 subsequent siblings)
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
This provides needed built-ins which clang uses along with libgcc
its not yet a full replacement for libgcc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/classes/toolchain/clang.bbclass | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/classes/toolchain/clang.bbclass b/meta/classes/toolchain/clang.bbclass
index 6cd150cbd146af82aee89467c176d800dac95c70..cc4cdc0356b397e07ea2d6fb5840e3fc9f9955b7 100644
--- a/meta/classes/toolchain/clang.bbclass
+++ b/meta/classes/toolchain/clang.bbclass
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (3 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 04/13] clang: Add compiler-rt to default deps when using clang compiler Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-29 9:20 ` [OE-core] " Richard Purdie
2025-05-23 3:52 ` [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang Khem Raj
` (7 subsequent siblings)
12 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
This ensures that binutils-ranlib or llvm-ranlib
behaves same as gcc-ranlib
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
--- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
+++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
@@ -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/
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (4 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-29 9:22 ` [OE-core] " Richard Purdie
2025-05-23 3:52 ` [PATCH v3 07/13] pixman: Fix build with mips/clang Khem Raj
` (6 subsequent siblings)
12 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
index 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e08e47d953bf5773e19 100644
--- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
+++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
@@ -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."
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 07/13] pixman: Fix build with mips/clang
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (5 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-29 9:23 ` [OE-core] " Richard Purdie
2025-05-29 9:24 ` Ross Burton
2025-05-23 3:52 ` [PATCH v3 08/13] vulkan-samples: Disable overriding-option as error Khem Raj
` (5 subsequent siblings)
12 siblings, 2 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
--- a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
+++ b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 08/13] vulkan-samples: Disable overriding-option as error
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (6 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 07/13] pixman: Fix build with mips/clang Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 09/13] bluez: Disable invalid-pp-token warning with clang Khem Raj
` (4 subsequent siblings)
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: 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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-graphics/vulkan/vulkan-samples_git.bb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
index 554e6eb29022e763de755dd550464cbd986de61e..505b6ab2f2865fec26339c9f1c4aa10c6735355b 100644
--- a/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
+++ b/meta/recipes-graphics/vulkan/vulkan-samples_git.bb
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 09/13] bluez: Disable invalid-pp-token warning with clang
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (7 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 08/13] vulkan-samples: Disable overriding-option as error Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 10/13] systemtap: Pin to build with GCC Khem Raj
` (3 subsequent siblings)
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: 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
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-connectivity/bluez5/bluez5.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index 7bae968094f2a272c4deff7416dbd1208549e6ce..5835662f7a63a23915ec4af94597ec4a614a4640 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -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.
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 10/13] systemtap: Pin to build with GCC
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (8 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 09/13] bluez: Disable invalid-pp-token warning with clang Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 11/13] seatd: Disable sign-compare warning as error on clang Khem Raj
` (2 subsequent siblings)
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: 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));
| | ^
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-kernel/systemtap/systemtap_git.bb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.bb b/meta/recipes-kernel/systemtap/systemtap_git.bb
index 21d50ffb04977bdd9666fbabb5e27289aff01370..254bac4d6f9c8637c575b4b7896322bd42e96841 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.bb
+++ b/meta/recipes-kernel/systemtap/systemtap_git.bb
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 11/13] seatd: Disable sign-compare warning as error on clang
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (9 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 10/13] systemtap: Pin to build with GCC Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 12/13] systemd-boot: Pin to use gcc toolchain on arm Khem Raj
2025-05-23 3:52 ` [PATCH v3 13/13] meta: Add TCOVERRIDE for toolchain selection at recipe scope Khem Raj
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Make it build with clang+musl combo
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-core/seatd/seatd_0.9.1.bb | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/meta/recipes-core/seatd/seatd_0.9.1.bb b/meta/recipes-core/seatd/seatd_0.9.1.bb
index 8ee43a3dc8f61eeb6f1c03dbd5a68585fa471424..87e1c3b67d69ba29cfde14caf17e3a2010046eac 100644
--- a/meta/recipes-core/seatd/seatd_0.9.1.bb
+++ b/meta/recipes-core/seatd/seatd_0.9.1.bb
@@ -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)} \
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 12/13] systemd-boot: Pin to use gcc toolchain on arm
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (10 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 11/13] seatd: Disable sign-compare warning as error on clang Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 13/13] meta: Add TCOVERRIDE for toolchain selection at recipe scope Khem Raj
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj, Ross Burton
clang does not support -mgeneral-regs-only option for arm
Cc: Ross Burton <Ross.Burton@arm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
meta/recipes-core/systemd/systemd-boot_257.5.bb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/meta/recipes-core/systemd/systemd-boot_257.5.bb b/meta/recipes-core/systemd/systemd-boot_257.5.bb
index 6a50ac05aa9915982dca4649f7bda610cfbfa14b..7d22e7aa8c07fd72a3e4fe08ed4218c1031284e5 100644
--- a/meta/recipes-core/systemd/systemd-boot_257.5.bb
+++ b/meta/recipes-core/systemd/systemd-boot_257.5.bb
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 13/13] meta: Add TCOVERRIDE for toolchain selection at recipe scope
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
` (11 preceding siblings ...)
2025-05-23 3:52 ` [PATCH v3 12/13] systemd-boot: Pin to use gcc toolchain on arm Khem Raj
@ 2025-05-23 3:52 ` Khem Raj
12 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-23 3:52 UTC (permalink / raw)
To: openembedded-core; +Cc: 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.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
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(-)
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4..684dfee92040b28bfcc1bce7087faec791443b1b 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -6,6 +6,7 @@
BB_DEFAULT_TASK ?= "build"
CLASSOVERRIDE ?= "class-target"
+TCOVERRIDE ?= "toolchain-gcc"
inherit patch
inherit staging
diff --git a/meta/classes-recipe/cross-canadian.bbclass b/meta/classes-recipe/cross-canadian.bbclass
index de002ede9d3f5d53a4837334bd5474bcfb208499..dda00f9a5cf2edf1cb76ab38879e611363ee4c8c 100644
--- a/meta/classes-recipe/cross-canadian.bbclass
+++ b/meta/classes-recipe/cross-canadian.bbclass
@@ -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}"
diff --git a/meta/classes-recipe/cross.bbclass b/meta/classes-recipe/cross.bbclass
index 5c36222d7aba04448b1ab70d61dd7c6d011b6a17..d1a57cbcfef49d90de23691984141abb8651d089 100644
--- a/meta/classes-recipe/cross.bbclass
+++ b/meta/classes-recipe/cross.bbclass
@@ -11,6 +11,7 @@ inherit relocatable
EXCLUDE_FROM_WORLD = "1"
TOOLCHAIN = ""
+TCOVERRIDE = ""
CLASSOVERRIDE = "class-cross"
PACKAGES = ""
PACKAGES_DYNAMIC = ""
diff --git a/meta/classes-recipe/crosssdk.bbclass b/meta/classes-recipe/crosssdk.bbclass
index 0117afc404c2df77a1f7cb28831fe4098dbb4524..0c0144b26829d3b76d034a89133ee94cf760b86d 100644
--- a/meta/classes-recipe/crosssdk.bbclass
+++ b/meta/classes-recipe/crosssdk.bbclass
@@ -7,6 +7,7 @@
inherit cross
CLASSOVERRIDE = "class-crosssdk"
+TCOVERRIDE = ""
TOOLCHAIN = ""
NATIVESDKLIBC ?= "libc-glibc"
LIBCOVERRIDE = ":${NATIVESDKLIBC}"
diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass
index 12630079cd19d6df29f2da94853f6cf2c5895772..cbdace9b7021e90a4df2684d9eacda36112b46c6 100644
--- a/meta/classes-recipe/native.bbclass
+++ b/meta/classes-recipe/native.bbclass
@@ -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 = ""
diff --git a/meta/classes-recipe/nativesdk.bbclass b/meta/classes-recipe/nativesdk.bbclass
index f41e5b9642d26cbafeab47ec469441ddd3ff1c09..440bc3a5c5434152dfe5c9c19db1c2be857cd794 100644
--- a/meta/classes-recipe/nativesdk.bbclass
+++ b/meta/classes-recipe/nativesdk.bbclass
@@ -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 = ""
diff --git a/meta/classes/toolchain/clang.bbclass b/meta/classes/toolchain/clang.bbclass
index cc4cdc0356b397e07ea2d6fb5840e3fc9f9955b7..8a0a2c315a2d4cddf795d185891a6ca1661f65fa 100644
--- a/meta/classes/toolchain/clang.bbclass
+++ b/meta/classes/toolchain/clang.bbclass
@@ -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"
diff --git a/meta/classes/toolchain/gcc.bbclass b/meta/classes/toolchain/gcc.bbclass
index 2479caf22c2cd48aebcce0abd5e6ac19b1c53a0f..75f9abe999a297c7b17e64e693ffd8f441bb16b1 100644
--- a/meta/classes/toolchain/gcc.bbclass
+++ b/meta/classes/toolchain/gcc.bbclass
@@ -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"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 83e52e7afaaddb19f7418a549c9b34d8d8ee92f1..cfd70498b246fa1bf03e4730ecd5bf5be759ed44 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -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"
--
2.49.0
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib
2025-05-23 3:52 ` [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib Khem Raj
@ 2025-05-29 9:20 ` Richard Purdie
2025-05-29 17:59 ` Khem Raj
0 siblings, 1 reply; 28+ messages in thread
From: Richard Purdie @ 2025-05-29 9:20 UTC (permalink / raw)
To: raj.khem, openembedded-core
On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> This ensures that binutils-ranlib or llvm-ranlib
> behaves same as gcc-ranlib
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
> --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> @@ -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/
>
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang
2025-05-23 3:52 ` [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang Khem Raj
@ 2025-05-29 9:22 ` Richard Purdie
2025-05-29 16:28 ` Khem Raj
0 siblings, 1 reply; 28+ messages in thread
From: Richard Purdie @ 2025-05-29 9:22 UTC (permalink / raw)
To: raj.khem, openembedded-core
On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org
wrote:
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> index
> 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e08e47
> d953bf5773e19 100644
> --- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> +++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> @@ -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"
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang
2025-05-23 3:52 ` [PATCH v3 07/13] pixman: Fix build with mips/clang Khem Raj
@ 2025-05-29 9:23 ` Richard Purdie
2025-05-29 20:05 ` Khem Raj
2025-05-29 9:24 ` Ross Burton
1 sibling, 1 reply; 28+ messages in thread
From: Richard Purdie @ 2025-05-29 9:23 UTC (permalink / raw)
To: raj.khem, openembedded-core
On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
> --- a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> +++ b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> @@ -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"
See the comment on libjpeg-turbo. Should there be a -f here or not?
Cheers,
Richard
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang
2025-05-23 3:52 ` [PATCH v3 07/13] pixman: Fix build with mips/clang Khem Raj
2025-05-29 9:23 ` [OE-core] " Richard Purdie
@ 2025-05-29 9:24 ` Ross Burton
2025-05-29 20:43 ` Khem Raj
1 sibling, 1 reply; 28+ messages in thread
From: Ross Burton @ 2025-05-29 9:24 UTC (permalink / raw)
To: raj.khem@gmail.com; +Cc: openembedded-core@lists.openembedded.org
On 23 May 2025, at 04:52, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
>
> +DEPENDS:append:toolchain-clang:mipsarch = " openmp”
Can you elaborate on why openmp is only needed for mips with clang, and no other targets?
Ross
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain
2025-05-23 3:52 ` [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain Khem Raj
@ 2025-05-29 14:10 ` Richard Purdie
2025-05-29 23:44 ` Peter Kjellerstedt
1 sibling, 0 replies; 28+ messages in thread
From: Richard Purdie @ 2025-05-29 14:10 UTC (permalink / raw)
To: raj.khem, openembedded-core
On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> 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"
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> 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(-)
>
> diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
> index 8215969c7bb37c1a1b91e260cd31714fee2db87c..1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4 100644
> --- a/meta/classes-global/base.bbclass
> +++ b/meta/classes-global/base.bbclass
> @@ -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', '')}
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang
2025-05-29 9:22 ` [OE-core] " Richard Purdie
@ 2025-05-29 16:28 ` Khem Raj
2025-05-29 20:26 ` Richard Purdie
0 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2025-05-29 16:28 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 5/29/25 2:22 AM, Richard Purdie wrote:
> On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org
> wrote:
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>> meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
>> b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
>> index
>> 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e08e47
>> d953bf5773e19 100644
>> --- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
>> +++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
>> @@ -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"
>
> 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.
>
> Cheers,
>
> Richard
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib
2025-05-29 9:20 ` [OE-core] " Richard Purdie
@ 2025-05-29 17:59 ` Khem Raj
2025-05-29 20:15 ` Richard Purdie
0 siblings, 1 reply; 28+ messages in thread
From: Khem Raj @ 2025-05-29 17:59 UTC (permalink / raw)
To: Richard Purdie, openembedded-core
On 5/29/25 2:20 AM, Richard Purdie wrote:
> On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
>> This ensures that binutils-ranlib or llvm-ranlib
>> behaves same as gcc-ranlib
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>> meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
>> index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
>> --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
>> +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
>> @@ -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/
>>
>
> 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?
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
>
> Cheers,
>
> Richard
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang
2025-05-29 9:23 ` [OE-core] " Richard Purdie
@ 2025-05-29 20:05 ` Khem Raj
0 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-29 20:05 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core
On Thu, May 29, 2025 at 2:23 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> > meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> > index c1c71fd42023fbd8c82d49ff623a981139f5ac7e..0c779ac3b4e6d035d9105c98aea0560a71d57ba3 100644
> > --- a/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> > +++ b/meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb
> > @@ -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"
>
> 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.
> Cheers,
>
> Richard
>
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib
2025-05-29 17:59 ` Khem Raj
@ 2025-05-29 20:15 ` Richard Purdie
2025-05-29 20:47 ` Khem Raj
0 siblings, 1 reply; 28+ messages in thread
From: Richard Purdie @ 2025-05-29 20:15 UTC (permalink / raw)
To: Khem Raj, openembedded-core
On Thu, 2025-05-29 at 10:59 -0700, Khem Raj wrote:
>
>
> On 5/29/25 2:20 AM, Richard Purdie wrote:
> > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> > > This ensures that binutils-ranlib or llvm-ranlib
> > > behaves same as gcc-ranlib
> > >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > ---
> > > meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
> > > 1 file changed, 5 insertions(+)
> > >
> > > diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> > > index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
> > > --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> > > +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> > > @@ -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/
> > >
> >
> > 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?
>
> 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
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang
2025-05-29 16:28 ` Khem Raj
@ 2025-05-29 20:26 ` Richard Purdie
2025-05-29 20:48 ` Khem Raj
0 siblings, 1 reply; 28+ messages in thread
From: Richard Purdie @ 2025-05-29 20:26 UTC (permalink / raw)
To: Khem Raj, openembedded-core
On Thu, 2025-05-29 at 09:28 -0700, Khem Raj wrote:
>
>
> On 5/29/25 2:22 AM, Richard Purdie wrote:
> > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via
> > lists.openembedded.org
> > wrote:
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > ---
> > > meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > index
> > > 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e0
> > > 8e47
> > > d953bf5773e19 100644
> > > --- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > +++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > @@ -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"
> >
> > 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.
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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 07/13] pixman: Fix build with mips/clang
2025-05-29 9:24 ` Ross Burton
@ 2025-05-29 20:43 ` Khem Raj
0 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-29 20:43 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core@lists.openembedded.org
On Thu, May 29, 2025 at 2:25 AM Ross Burton <Ross.Burton@arm.com> wrote:
>
> On 23 May 2025, at 04:52, Khem Raj via lists.openembedded.org <raj.khem=gmail.com@lists.openembedded.org> wrote:
> >
> > +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
> Ross
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib
2025-05-29 20:15 ` Richard Purdie
@ 2025-05-29 20:47 ` Khem Raj
0 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-29 20:47 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core
On Thu, May 29, 2025 at 1:15 PM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2025-05-29 at 10:59 -0700, Khem Raj wrote:
> >
> >
> > On 5/29/25 2:20 AM, Richard Purdie wrote:
> > > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via lists.openembedded.org wrote:
> > > > This ensures that binutils-ranlib or llvm-ranlib
> > > > behaves same as gcc-ranlib
> > > >
> > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > ---
> > > > meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++++
> > > > 1 file changed, 5 insertions(+)
> > > >
> > > > diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> > > > index 235936288ba792c86af4dd1899b2f6585328141f..41706f4b60f1f25233ff91c8f112b8122a5c6c30 100644
> > > > --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> > > > +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb
> > > > @@ -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/
> > > >
> > >
> > > 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?
> >
> > 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
>
> 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
>
> Cheers,
>
> Richard
>
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [OE-core] [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang
2025-05-29 20:26 ` Richard Purdie
@ 2025-05-29 20:48 ` Khem Raj
0 siblings, 0 replies; 28+ messages in thread
From: Khem Raj @ 2025-05-29 20:48 UTC (permalink / raw)
To: Richard Purdie; +Cc: openembedded-core
On Thu, May 29, 2025 at 1:26 PM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Thu, 2025-05-29 at 09:28 -0700, Khem Raj wrote:
> >
> >
> > On 5/29/25 2:22 AM, Richard Purdie wrote:
> > > On Thu, 2025-05-22 at 20:52 -0700, Khem Raj via
> > > lists.openembedded.org
> > > wrote:
> > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > ---
> > > > meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb | 6 ++++++
> > > > 1 file changed, 6 insertions(+)
> > > >
> > > > diff --git a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > > b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > > index
> > > > 8533bd8525311e783572cbafb6fccf240db9e0e8..90aa2ef43956f0a1e64f8e0
> > > > 8e47
> > > > d953bf5773e19 100644
> > > > --- a/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > > +++ b/meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb
> > > > @@ -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"
> > >
> > > 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.
>
> 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
> Cheers,
>
> Richard
^ permalink raw reply [flat|nested] 28+ messages in thread
* RE: [OE-core] [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain
2025-05-23 3:52 ` [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain Khem Raj
2025-05-29 14:10 ` [OE-core] " Richard Purdie
@ 2025-05-29 23:44 ` Peter Kjellerstedt
1 sibling, 0 replies; 28+ messages in thread
From: Peter Kjellerstedt @ 2025-05-29 23:44 UTC (permalink / raw)
To: raj.khem@gmail.com, openembedded-core@lists.openembedded.org
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Khem Raj via
> lists.openembedded.org
> Sent: den 23 maj 2025 05:53
> To: openembedded-core@lists.openembedded.org
> Cc: Khem Raj <raj.khem@gmail.com>
> 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"
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> 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(-)
>
> diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
> index 8215969c7bb37c1a1b91e260cd31714fee2db87c..1e7d6fe9b6ac34c17820d9f6378a5aa50f00dff4 100644
> --- a/meta/classes-global/base.bbclass
> +++ b/meta/classes-global/base.bbclass
> @@ -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.
> +inherit toolchain/gcc
Why is toolchain/gcc inherited if ${TOOLCHAIN} == 'clang'?
> +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
> +
> def lsb_distro_identifier(d):
> adjust = d.getVar('LSB_DISTRO_ADJUST')
> adjust_func = None
> diff --git a/meta/classes-recipe/cross-canadian.bbclass b/meta/classes-recipe/cross-canadian.bbclass
> index 059d9aa95f57dd77a0ab5172c4c15c13ed3bc43e..de002ede9d3f5d53a4837334bd5474bcfb208499 100644
> --- a/meta/classes-recipe/cross-canadian.bbclass
> +++ b/meta/classes-recipe/cross-canadian.bbclass
> @@ -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}"
>
> diff --git a/meta/classes-recipe/cross.bbclass b/meta/classes-recipe/cross.bbclass
> index 93de9a527446554b93c1e323c7458cc7aacef799..5c36222d7aba04448b1ab70d61dd7c6d011b6a17 100644
> --- a/meta/classes-recipe/cross.bbclass
> +++ b/meta/classes-recipe/cross.bbclass
> @@ -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 = ""
> diff --git a/meta/classes-recipe/crosssdk.bbclass b/meta/classes-recipe/crosssdk.bbclass
> index 824b1bcff47bcd36a70aa1d7b8724b6cf07131ff..0117afc404c2df77a1f7cb28831fe409 8dbb4524 100644
> --- a/meta/classes-recipe/crosssdk.bbclass
> +++ b/meta/classes-recipe/crosssdk.bbclass
> @@ -7,6 +7,7 @@
> inherit cross
>
> CLASSOVERRIDE = "class-crosssdk"
> +TOOLCHAIN = ""
> NATIVESDKLIBC ?= "libc-glibc"
> LIBCOVERRIDE = ":${NATIVESDKLIBC}"
> MACHINEOVERRIDES = ""
> diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass
> index 625975a69429389a5b231a19b17e8ed7a12d80ad..12630079cd19d6df29f2da94853f6cf2c5895772 100644
> --- a/meta/classes-recipe/native.bbclass
> +++ b/meta/classes-recipe/native.bbclass
> @@ -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 = ""
> diff --git a/meta/classes-recipe/nativesdk.bbclass b/meta/classes-recipe/nativesdk.bbclass
> index 7ecb4c12c1f0f2b9cc48da215006a153679facf8..f41e5b9642d26cbafeab47ec469441ddd3ff1c09 100644
> --- a/meta/classes-recipe/nativesdk.bbclass
> +++ b/meta/classes-recipe/nativesdk.bbclass
> @@ -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 = ""
>
> diff --git a/meta/classes/toolchain/clang-native.bbclass b/meta/classes/toolchain/clang-native.bbclass
> new file mode 100644
> index 0000000000000000000000000000000000000000..bf395eade73eaad18bf15f35d03bc0aec2223090
> --- /dev/null
> +++ b/meta/classes/toolchain/clang-native.bbclass
> @@ -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"
> diff --git a/meta/conf/toolchain/clang.inc b/meta/classes/toolchain/clang.bbclass
> similarity index 78%
> rename from meta/conf/toolchain/clang.inc
> rename to meta/classes/toolchain/clang.bbclass
> index 0e5f0769f85a8373c58d4b54dbe2bb1cf7dbd50b..e35e0f0fb1b010dd0f770b749717370041e0ba0d 100644
> --- a/meta/conf/toolchain/clang.inc
> +++ b/meta/classes/toolchain/clang.bbclass
> @@ -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"
> diff --git a/meta/conf/toolchain/build-gcc.inc b/meta/classes/toolchain/gcc-native.bbclass
> similarity index 99%
> rename from meta/conf/toolchain/build-gcc.inc
> rename to meta/classes/toolchain/gcc-native.bbclass
> index a708bd0389a123504301fd151fb9ebdb677926be..1e1d68b027806b94e8229d4efef025cc1c038ad3 100644
> --- a/meta/conf/toolchain/build-gcc.inc
> +++ b/meta/classes/toolchain/gcc-native.bbclass
> @@ -12,4 +12,3 @@ BUILD_OBJCOPY = "${BUILD_PREFIX}objcopy"
> BUILD_OBJDUMP = "${BUILD_PREFIX}objdump"
> BUILD_NM = "${BUILD_PREFIX}nm"
> BUILD_READELF = "${BUILD_PREFIX}readelf"
> -
> diff --git a/meta/conf/toolchain/gcc.inc b/meta/classes/toolchain/gcc.bbclass
> similarity index 99%
> rename from meta/conf/toolchain/gcc.inc
> rename to meta/classes/toolchain/gcc.bbclass
> index 36d33f5d6d0bfbf0f36158f389c4112ce20d806b..2479caf22c2cd48aebcce0abd5e6ac19b1c53a0f 100644
> --- a/meta/conf/toolchain/gcc.inc
> +++ b/meta/classes/toolchain/gcc.bbclass
> @@ -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"
> -
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index e5037c6277841908df333b16adbe4e6cce55f814..83e52e7afaaddb19f7418a549c9b34d8d8ee92f1 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -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
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2025-05-29 23:44 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 3:52 [PATCH v3 00/13] clang: Add clang C/C++ toolchain Khem Raj
2025-05-23 3:52 ` [PATCH v3 01/13] toolchain: Provide abstraction for choosing per-recipe toolchain Khem Raj
2025-05-29 14:10 ` [OE-core] " Richard Purdie
2025-05-29 23:44 ` Peter Kjellerstedt
2025-05-23 3:52 ` [PATCH v3 02/13] clang.bbclass: Specify ldso when using usermerge Khem Raj
2025-05-23 3:52 ` [PATCH v3 03/13] vte: Disable gi data generation when using clang on arm Khem Raj
2025-05-23 3:52 ` [PATCH v3 04/13] clang: Add compiler-rt to default deps when using clang compiler Khem Raj
2025-05-23 3:52 ` [PATCH v3 05/13] tcf-agent: Fix ranlib call when using llvm-ranlib Khem Raj
2025-05-29 9:20 ` [OE-core] " Richard Purdie
2025-05-29 17:59 ` Khem Raj
2025-05-29 20:15 ` Richard Purdie
2025-05-29 20:47 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 06/13] libjpeg-turbo: Fix build on mips/clang Khem Raj
2025-05-29 9:22 ` [OE-core] " Richard Purdie
2025-05-29 16:28 ` Khem Raj
2025-05-29 20:26 ` Richard Purdie
2025-05-29 20:48 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 07/13] pixman: Fix build with mips/clang Khem Raj
2025-05-29 9:23 ` [OE-core] " Richard Purdie
2025-05-29 20:05 ` Khem Raj
2025-05-29 9:24 ` Ross Burton
2025-05-29 20:43 ` Khem Raj
2025-05-23 3:52 ` [PATCH v3 08/13] vulkan-samples: Disable overriding-option as error Khem Raj
2025-05-23 3:52 ` [PATCH v3 09/13] bluez: Disable invalid-pp-token warning with clang Khem Raj
2025-05-23 3:52 ` [PATCH v3 10/13] systemtap: Pin to build with GCC Khem Raj
2025-05-23 3:52 ` [PATCH v3 11/13] seatd: Disable sign-compare warning as error on clang Khem Raj
2025-05-23 3:52 ` [PATCH v3 12/13] systemd-boot: Pin to use gcc toolchain on arm Khem Raj
2025-05-23 3:52 ` [PATCH v3 13/13] meta: Add TCOVERRIDE for toolchain selection at recipe scope Khem Raj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox