clang: Add clang C/C++ toolchain
v2 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 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 (28):
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
gnu-efi: Use objcopy from GNU binutils with clang
tcf-agent: Fix ranlib call when using llvm-ranlib
pulseaudio: Treat -Wunused-command-line-argument as error
libjpeg-turbo: Fix build on mips/clang
pixman: Fix build with mips/clang
systemd-boot: Remove -mfpmath=sse option from cflags
vulkan-samples: Disable overriding-option as error
openssl: Link with libatomic on x86/clang
qemu: Link with libatomic on x86/clang
bluez: Disable invalid-pp-token warning with clang
gcc: Always use GCC toolchain
glibc: Always use GCC toolchain
grub,grub-efi: Pin to using gcc on aarch64
valgrind: Use gcc to compile on riscv64
syslinux: Pin to using GCC toolchain
systemtap: Pin to build with GCC
webkitgtk: Use gcc to compile for arm target
pseudo: Pin to using GCC compiler
rpm: Always use gcc compiler
pulseaudio: Pin to use GCC compiler
seatd: Disable sign-compare warning as error on clang
busybox: Fix build on architectures without SYS_settimeofday
systemd-boot: Use gcc on musl/arm
perf: Do not treat maybe-uninitialized warnings as errors
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/clang-native.bbclass | 28 ++++++++++++ .../toolchain/clang.inc => classes/clang.bbclass} | 17 +++++-- .../build-gcc.inc => classes/gcc-native.bbclass} | 1 - .../toolchain/gcc.inc => classes/gcc.bbclass} | 1 + meta/conf/bitbake.conf | 7 ++- meta/recipes-bsp/gnu-efi/gnu-efi_4.0.0.bb | 4 ++ meta/recipes-bsp/grub/grub2.inc | 4 ++ meta/recipes-connectivity/bluez5/bluez5.inc | 1 + meta/recipes-connectivity/openssl/openssl_3.5.0.bb | 3 ++ ...ck-for-SYS_settimeofday-before-calling-sy.patch | 52 ++++++++++++++++++++++ meta/recipes-core/busybox/busybox_1.37.0.bb | 1 + meta/recipes-core/glibc/glibc-common.inc | 2 + meta/recipes-core/seatd/seatd_0.9.1.bb | 8 ++++ meta/recipes-core/systemd/systemd-boot_257.5.bb | 8 ++++ meta/recipes-devtools/gcc/gcc-15.1.inc | 2 + meta/recipes-devtools/pseudo/pseudo_git.bb | 7 +++ meta/recipes-devtools/qemu/qemu_10.0.0.bb | 1 + meta/recipes-devtools/rpm/rpm_4.20.0.bb | 4 ++ .../syslinux/syslinux_6.04-pre2.bb | 5 +++ meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | 5 +++ meta/recipes-devtools/valgrind/valgrind_3.25.0.bb | 8 ++++ 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/perf/perf.bb | 10 +++++ meta/recipes-kernel/systemtap/systemtap_git.bb | 4 ++ meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 8 ++++ meta/recipes-sato/webkit/webkitgtk_2.48.1.bb | 2 + meta/recipes-support/vte/vte_0.78.2.bb | 4 ++ 35 files changed, 216 insertions(+), 9 deletions(-)
---
base-commit: e3402fe00ca5602dbcfd151ab3fd4bfb3371f76c
change-id: 20250518-clang-toolchain-f9a8a0572306
Best regards,
Signature · 1 line
Khem Raj <[email protected]>
PATCH v2 1/28 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"
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 toolchain policy in distro.
toolchain: Use TOOLCHAIN_NATIVE for defining native compiler
This helps in selecting gcc or clang for native compiler irrespective of cross-compiler selection via TOOLCHAIN variable
--- 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/clang-native.bbclass | 28 ++++++++++++++++++++++ .../toolchain/clang.inc => classes/clang.bbclass} | 10 ++++---- .../build-gcc.inc => classes/gcc-native.bbclass} | 1 - .../toolchain/gcc.inc => classes/gcc.bbclass} | 1 + meta/conf/bitbake.conf | 7 +++--- 11 files changed, 53 insertions(+), 9 deletions(-)
meta/classes-global/base.bbclass +5 -0
@@ -6,6 +6,7 @@ BB_DEFAULT_TASK ?= "build" CLASSOVERRIDE ?= "class-target" +TCOVERRIDE ?= "toolchain-gcc" inherit patch inherit staging
@@ -19,6 +20,10 @@ PACKAGECONFIG_CONFARGS ??= "" inherit metadata_scm +inherit gcc-native +inherit gcc +inherit_defer ${@oe.utils.ifelse(d.getVar('TOOLCHAIN') == 'clang', 'clang', '')} + def lsb_distro_identifier(d): adjust = d.getVar('LSB_DISTRO_ADJUST') adjust_func = None
meta/classes-recipe/cross-canadian.bbclass +2 -0
@@ -14,6 +14,8 @@ EXCLUDE_FROM_WORLD = "1" NATIVESDKLIBC ?= "libc-glibc" LIBCOVERRIDE = ":${NATIVESDKLIBC}" +TCOVERRIDE = "" +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 +2 -0
@@ -10,6 +10,8 @@ inherit relocatable # no need for them to be a direct target of 'world' EXCLUDE_FROM_WORLD = "1" +TCOVERRIDE = "" +TOOLCHAIN = "" CLASSOVERRIDE = "class-cross" PACKAGES = "" PACKAGES_DYNAMIC = ""
meta/classes-recipe/crosssdk.bbclass +2 -0
@@ -7,6 +7,8 @@ inherit cross CLASSOVERRIDE = "class-crosssdk" +TCOVERRIDE = "" +TOOLCHAIN = "" NATIVESDKLIBC ?= "libc-glibc" LIBCOVERRIDE = ":${NATIVESDKLIBC}" MACHINEOVERRIDES = ""
meta/classes-recipe/native.bbclass +2 -0
@@ -108,6 +108,8 @@ 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 = "" MACHINE_FEATURES = ""
meta/classes-recipe/nativesdk.bbclass +2 -0
@@ -13,6 +13,8 @@ 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/clang-native.bbclass new file +28 -0
@@ -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/clang.bbclass renamed from meta/conf/toolchain/clang.inc +6 -4
@@ -17,9 +17,11 @@ 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" + +TCOVERRIDE = "toolchain-clang"
meta/classes/gcc-native.bbclass renamed from meta/conf/toolchain/build-gcc.inc +0 -1
@@ -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/gcc.bbclass renamed from meta/conf/toolchain/gcc.inc +1 -0
@@ -24,3 +24,4 @@ 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 +3 -4
@@ -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"
@@ -801,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"
@@ -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
Re: [OE-core] [PATCH v2 01/28] toolchain: Provide abstraction for choosing per-recipe toolchain
Quoted 46 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"
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 toolchain policy in distro.
toolchain: Use
TOOLCHAIN_NATIVEfor defining native compilerThis helps in selecting gcc or clang for native compiler irrespective of cross-compiler selection via TOOLCHAIN variable
Signed-off-by Khem Raj <[email protected]>---
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/clang-native.bbclass | 28 ++++++++++++++++++++++ .../toolchain/clang.inc => classes/clang.bbclass} | 10 ++++---- .../build-gcc.inc => classes/gcc-native.bbclass} | 1 - .../toolchain/gcc.inc => classes/gcc.bbclass} | 1 + meta/conf/bitbake.conf | 7 +++---
Quoted 1 line
11 files changed, 53 insertions(+), 9 deletions(-)
This is definitely getting there, thanks for working through it.
I think we're ready to agree that we should support toolchain selection with the TOOLCHAIN variable and we should support toolchain overrides. There are therefore some patches in this series which can merge as we agree on that.
One of the concerns I have left is the class naming as I think "gcc.bbclass" is confusing in its own right. I'm wondering if we put these classes into a toolchain directory to make it clearer.
I do also conceptually prefer the idea of an inc file so I'm wondering if we should see if some kind of require_defer syntax could work?
Quoted 16 lines
meta/classes-global/base.bbclass +0
-0@@ -6,6 +6,7 @@
BB_DEFAULT_TASK ?= "build"
CLASSOVERRIDE ?= "class-target"
+TCOVERRIDE ?= "toolchain-gcc"
inherit patch
inherit stagingmeta/classes-global/base.bbclass +0
-0@@ -19,6 +20,10 @@ PACKAGECONFIG_CONFARGS ??= ""
inheritmetadata_scm
meta/classes-global/base.bbclass PACKAGECONFIG_CONFARGS ??= "" · line 25
Quoted 3 lines
meta/classes-global/base.bbclass +3
-0+inherit gcc-native +inherit gcc +inherit_defer ${@oe.utils.ifelse(d.getVar('TOOLCHAIN') == 'clang', 'clang', '')}
I'm a bit puzzled on why we can't defer the gcc inherit here too? I guess that didn't work for some reason?
Quoted 27 lines
+
deflsb_distro_identifier(d):
adjust =d.getVar('LSB_DISTRO_ADJUST')
adjust_func= Nonemeta/classes-recipe/cross-canadian.bbclass +0
-0@@ -14,6 +14,8 @@EXCLUDE_FROM_WORLD = "1"
NATIVESDKLIBC ?= "libc-glibc"
LIBCOVERRIDE = ":${NATIVESDKLIBC}"meta/classes-recipe/cross-canadian.bbclass +2
-0+TCOVERRIDE = "" +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 +0
-0@@ -10,6 +10,8 @@ inherit relocatable # no need for them to be a direct target of 'world'EXCLUDE_FROM_WORLD = "1"
meta/classes-recipe/cross.bbclass +2
-0+TCOVERRIDE = "" +TOOLCHAIN = ""
Quoted 3 lines
CLASSOVERRIDE = "class-cross"
PACKAGES = ""
PACKAGES_DYNAMIC = ""
Wouldn't the recipes that include this class set TOOLCHAIN correctly anyway?
Quoted 10 lines
meta/classes-recipe/crosssdk.bbclass +0
-0@@ -7,6 +7,8 @@inherit cross
CLASSOVERRIDE = "class-crosssdk"meta/classes-recipe/crosssdk.bbclass +2
-0+TCOVERRIDE = "" +TOOLCHAIN = ""
Quoted 3 lines
NATIVESDKLIBC ?= "libc-glibc"
LIBCOVERRIDE = ":${NATIVESDKLIBC}"
MACHINEOVERRIDES = ""
Same question here.
Quoted 10 lines
meta/classes-recipe/native.bbclass +0
-0@@ -108,6 +108,8 @@ PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1"# we dont want libc-*libc to kick in for native recipes LIBCOVERRIDE = ""meta/classes-recipe/native.bbclass +2
-0+TCOVERRIDE = "" +TOOLCHAIN = ""
Quoted 3 lines
CLASSOVERRIDE = "class-native"
MACHINEOVERRIDES = ""
MACHINE_FEATURES = ""
This, I can understand although I know there was "clang-native" support in places. I guess that is deferred for now?
Quoted 10 lines
meta/classes-recipe/nativesdk.bbclass +0
-0@@ -13,6 +13,8 @@ STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${S # libc for the SDK can be different to that of the targetNATIVESDKLIBC ?= "libc-glibc"
LIBCOVERRIDE = ":${NATIVESDKLIBC}"meta/classes-recipe/nativesdk.bbclass +2
-0+TCOVERRIDE = "" +TOOLCHAIN = ""
Quoted 2 lines
CLASSOVERRIDE = "class-nativesdk"
MACHINEOVERRIDES = ""
Do you have any plans to support building the SDK with clang? I'm just wondering on the code direction here in the future.
Quoted 24 lines
meta/classes/clang-native.bbclass new file +18
-0@@ -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"
meta/classes/clang-native.bbclass line 28
Quoted 10 lines
meta/classes/clang-native.bbclass new file +10
-0+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"
Where/how does this get used?
Quoted 21 lines
meta/classes/clang.bbclass renamed from meta/conf/toolchain/clang.inc +0
-0@@ -17,9 +17,11 @@ 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"
meta/classes/clang.bbclass renamed from meta/conf/toolchain/clang.inc +2
-2-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}"meta/classes/clang.bbclass renamed from meta/conf/toolchain/clang.inc +2
-2-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/clang.bbclass READELF = "${HOST_PREFIX}llvm-readelf" · line 27
Quoted 2 lines
meta/classes/clang.bbclass renamed from meta/conf/toolchain/clang.inc +2
-0+ +TCOVERRIDE = "toolchain-clang"
This can probably be split into a separate patch and merged sooner.
Quoted 20 lines
meta/classes/gcc-native.bbclass renamed from meta/conf/toolchain/build-gcc.inc +0
-0@@ -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/gcc-native.bbclass renamed from meta/conf/toolchain/build-gcc.inc +0
-1-meta/classes/gcc.bbclass renamed from meta/conf/toolchain/gcc.inc +0
-0@@ -24,3 +24,4 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}"
Quoted 4 lines
PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "gcc-crosssdk-${SDK_SYS}" PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime"
+TCOVERRIDE = "toolchain-gcc"
The TCOVERRIDE pieces could also be a separate patch to move things forward until we resolve the inherit_defer/require/naming discussion?
Quoted 14 lines
meta/conf/bitbake.conf +0
-0@@ -13,6 +13,8 @@ BASELIB = "lib"BASELIB:libc-glibc:powerpc64 = "lib64"
BASELIB:libc-glibc:powerpc64le = "lib64"meta/conf/bitbake.conf +2
-0+TOOLCHAIN ??= "gcc" +# Path prefixes
exportbase_prefix= ""
export prefix = "/usr"
meta/conf/bitbake.conf DISTRO_NAME ??= "OpenEmbedded" · line 806
Quoted 5 lines
meta/conf/bitbake.conf +1
-1@@ -801,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"
Lets pull the overrides bit into a separate patch.
Cheers,
Richard
Re: [OE-core] [PATCH v2 01/28] toolchain: Provide abstraction for choosing per-recipe toolchain
Quoted 51 lines · Richard Purdie
Quoted 34 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"
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 toolchain policy in distro.
toolchain: Use
TOOLCHAIN_NATIVEfor defining native compilerThis helps in selecting gcc or clang for native compiler irrespective of cross-compiler selection via TOOLCHAIN variable
Signed-off-by Khem Raj <[email protected]>Quoted 13 lines
--- 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/clang-native.bbclass | 28 ++++++++++++++++++++++ .../toolchain/clang.inc => classes/clang.bbclass} | 10 ++++---- .../build-gcc.inc => classes/gcc-native.bbclass} | 1 - .../toolchain/gcc.inc => classes/gcc.bbclass} | 1 + meta/conf/bitbake.conf | 7 +++--- 11 files changed, 53 insertions(+), 9 deletions(-)This is definitely getting there, thanks for working through it.
Quoted 8 lines
I think we're ready to agree that we should support toolchain selection with the TOOLCHAIN variable and we should support toolchain overrides. There are therefore some patches in this series which can merge as we agree on that.
One of the concerns I have left is the class naming as I think "gcc.bbclass" is confusing in its own right. I'm wondering if we put these classes into a toolchain directory to make it clearer.
thats a good idea, perhaps I will move them into classes-toolchain/ folder.
Quoted 4 lines
I do also conceptually prefer the idea of an inc file so I'm wondering if we should see if some kind of
require_defersyntax could work?
We will always have exceptions where packages are not buildable with one toolchain or other and I found that doing it in class + override is quite good and extensible to other toolchains in future with a global fallback.
Quoted 14 lines
Quoted 14 lines
meta/classes-global/base.bbclass +1
-0@@ -6,6 +6,7 @@ BB_DEFAULT_TASK ?= "build" CLASSOVERRIDE ?= "class-target" +TCOVERRIDE ?= "toolchain-gcc" inherit patch inherit staging@@ -19,6 +20,10 @@ PACKAGECONFIG_CONFARGS ??= ""
Quoted 9 lines
meta/classes-global/base.bbclass PACKAGECONFIG_CONFARGS ??= "" · line 25
Quoted 5 lines
meta/classes-global/base.bbclass +3
-0inherit metadata_scm +inherit gcc-native +inherit gcc +inherit_defer ${@oe.utils.ifelse(d.getVar('TOOLCHAIN') == 'clang', 'clang', '')}I'm a bit puzzled on why we can't defer the gcc inherit here too? I guess that didn't work for some reason?
TOOLCHAIN variable is processed later for bbclassextend'ed recipes and competes with nativesdk's quest to be last in line of inherits, then having a default fallback toolchain to be gcc is a reasonable choice since we can not _yet_ use non-gcc toolchains to build complete set of
recipes. Its getting there though.
Quoted 68 lines
Quoted 22 lines
meta/classes-global/base.bbclass +1
-0+ def lsb_distro_identifier(d): adjust = d.getVar('LSB_DISTRO_ADJUST') adjust_func = Nonemeta/classes-recipe/cross-canadian.bbclass +2
-0@@ -14,6 +14,8 @@ EXCLUDE_FROM_WORLD = "1" NATIVESDKLIBC ?= "libc-glibc" LIBCOVERRIDE = ":${NATIVESDKLIBC}" +TCOVERRIDE = "" +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 +0
-0meta/classes-recipe/cross.bbclass inherit relocatable · line 17
Quoted 8 lines
meta/classes-recipe/cross.bbclass +2
-0@@ -10,6 +10,8 @@ inherit relocatable # no need for them to be a direct target of 'world' EXCLUDE_FROM_WORLD = "1" +TCOVERRIDE = "" +TOOLCHAIN = "" CLASSOVERRIDE = "class-cross" PACKAGES = "" PACKAGES_DYNAMIC = ""Wouldn't the recipes that include this class set TOOLCHAIN correctly anyway?
meta/classes-recipe/crosssdk.bbclass line 14
Quoted 13 lines
meta/classes-recipe/crosssdk.bbclass +2
-0@@ -7,6 +7,8 @@ inherit cross CLASSOVERRIDE = "class-crosssdk" +TCOVERRIDE = "" +TOOLCHAIN = "" NATIVESDKLIBC ?= "libc-glibc" LIBCOVERRIDE = ":${NATIVESDKLIBC}" MACHINEOVERRIDES = ""Same question here.
meta/classes-recipe/native.bbclass PKG_CONFIG_SYSTEM_INCLUDE_PATH[unexport] = "1" · line 115
Quoted 13 lines
meta/classes-recipe/native.bbclass +2
-0@@ -108,6 +108,8 @@ 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 = "" MACHINE_FEATURES = ""This, I can understand although I know there was "clang-native" support in places. I guess that is deferred for now?
Quoted 16 lines
meta/classes-recipe/nativesdk.bbclass STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${SDK_ARCH}${S · line 19
Quoted 12 lines
meta/classes-recipe/nativesdk.bbclass +2
-0@@ -13,6 +13,8 @@ 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 = ""Do you have any plans to support building the SDK with clang? I'm just wondering on the code direction here in the future.
yes precisely the reason, we can today create SDKs with both gcc and clang compiler toolchains in it.
Quoted 29 lines
Quoted 29 lines
meta/classes/clang-native.bbclass new file +22
-0@@ -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"
Quoted 8 lines
meta/classes/clang-native.bbclass line 28
Quoted 6 lines
meta/classes/clang-native.bbclass new file +6
-0+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"Where/how does this get used?
This is used when using clang-native to build native portions ( want to override native gcc ) e.g. chromium which requires it, there are other packages which can optionally use it when using clang toolchains qtwebengine, rust-llvm, rust to name a few. It makes it easy to use clang as native compiler.
Quoted 18 lines
Quoted 18 lines
meta/classes/clang.bbclass renamed from meta/conf/toolchain/clang.inc +2
-2@@ -17,9 +17,11 @@ 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}"
Quoted 10 lines
meta/classes/clang.bbclass READELF = "${HOST_PREFIX}llvm-readelf" · line 27
Quoted 7 lines
meta/classes/clang.bbclass renamed from meta/conf/toolchain/clang.inc +4
-2-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" + +TCOVERRIDE = "toolchain-clang"This can probably be split into a separate patch and merged sooner.
I kept this together for keep things building atomically across bisects etc. But I think I can separate adding the TCOVERRIDE logic to patch of its own.
Quoted 56 lines
Quoted 21 lines
meta/classes/gcc-native.bbclass renamed from meta/conf/toolchain/build-gcc.inc +0
-1@@ -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/gcc.bbclass renamed from meta/conf/toolchain/gcc.inc +0
-0meta/classes/gcc.bbclass PREFERRED_PROVIDER_virtual/nativesdk-cross-cc = "gcc-crosssdk-${SDK_SYS}" · line 27
Quoted 4 lines
meta/classes/gcc.bbclass renamed from meta/conf/toolchain/gcc.inc +1
-0@@ -24,3 +24,4 @@ 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"The TCOVERRIDE pieces could also be a separate patch to move things forward until we resolve the inherit_defer/require/naming discussion?
Quoted 14 lines
meta/conf/bitbake.conf +2
-0@@ -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"meta/conf/bitbake.conf DISTRO_NAME ??= "OpenEmbedded" · line 806
Quoted 5 lines
meta/conf/bitbake.conf +1
-1@@ -801,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"Lets pull the overrides bit into a separate patch.
Cheers,
Richard
PATCH v2 2/28 clang.bbclass: Specify ldso when using usermerge
In reply to Khem RajThis matches the expectations of distro setups and clang's understanding of what the ldso should look like
--- meta/classes/clang.bbclass | 5 +++++ 1 file changed, 5 insertions(+)
meta/classes/clang.bbclass +5 -0
@@ -25,3 +25,8 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-c++ = "clang-crosssdk-${SDK_SYS}" PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs = "nativesdk-gcc-runtime" TCOVERRIDE = "toolchain-clang" + +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
PATCH v2 3/28 vte: Disable gi data generation when using clang on arm
In reply to Khem RajFixes 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
@@ -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
Re: [OE-core] [PATCH v2 03/28] vte: Disable gi data generation when using clang on arm
meta/recipes-support/vte/vte_0.78.2.bb SRC_URI[archive.sha256sum] = "35d7bcde07356846b4a12881c8e016705b70a9004a9082285e · line 31
Quoted 6 lines · Khem Raj via lists.openembedded.org
meta/recipes-support/vte/vte_0.78.2.bb +3
-0+# 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"
No need for :pn-vte:
Ross
Re: [OE-core] [PATCH v2 03/28] vte: Disable gi data generation when using clang on arm
In reply to Khem Rajmeta/recipes-support/vte/vte_0.78.2.bb SRC_URI[archive.sha256sum] = "35d7bcde07356846b4a12881c8e016705b70a9004a9082285e · line 31
Quoted 3 lines · Khem Raj via lists.openembedded.org
meta/recipes-support/vte/vte_0.78.2.bb +3
-0+# 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"
Was this failure replicated with current master? I’m concerned as to why vte fails but nothing else using G-I.
Ross
Re: [OE-core] [PATCH v2 03/28] vte: Disable gi data generation when using clang on arm
Quoted 8 lines · Ross Burton
meta/recipes-support/vte/vte_0.78.2.bb SRC_URI[archive.sha256sum] = "35d7bcde07356846b4a12881c8e016705b70a9004a9082285e · line 31
Quoted 3 lines · Khem Raj via lists.openembedded.org
meta/recipes-support/vte/vte_0.78.2.bb +3
-0+# 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"Was this failure replicated with current master? I’m concerned as to why vte fails but nothing else using G-I.
Yes it still happens.
qemu in usermode crashes during gi data generation with binaries built with clang, I did not have time to go look
why qemu is crashing if someone can it would help.
Quoted 1 line
Ross
Re: [OE-core] [PATCH v2 03/28] vte: Disable gi data generation when using clang on arm
In reply to Khem RajQuoted 19 lines · Khem Raj via lists.openembedded.org
Fixes Qemu usermode crashes
Signed-off-by Khem Raj <[email protected]>---
meta/recipes-support/vte/vte_0.78.2.bb | 4 ++++1 file changed, 4 insertions(+)meta/recipes-support/vte/vte_0.78.2.bb +0
-0@@ -26,6 +26,10 @@ SRC_URI[archive.sha256sum] = "35d7bcde07356846b4a12881c8e016705b70a9004a9082285e
ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"meta/recipes-support/vte/vte_0.78.2.bb +4
-0+# 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" +
Quoted 2 lines
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)}"
I don't really want to regress a feature like like this in a very specific target as it is just going to confuse people. We should probably just force gcc until this gets resolved.
I'm also puzzled why some people can replicate and some can't. We need therefore better data on this too.
As such I'm reluctant to merge due to the difference in features it creates.
Cheers,
Richard
PATCH v2 4/28 clang: Add compiler-rt to default deps when using clang compiler
In reply to Khem RajThis provides needed built-ins which clang uses along with libgcc its not yet a full replacement for libgcc
--- meta/classes/clang.bbclass | 2 ++ 1 file changed, 2 insertions(+)
meta/classes/clang.bbclass +2 -0
@@ -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" + TCOVERRIDE = "toolchain-clang" TUNE_CCARGS += "${@bb.utils.contains("DISTRO_FEATURES", "usrmerge", " --dyld-prefix=/usr", "", d)}"
Signature · 1 line
2.49.0
PATCH v2 5/28 gnu-efi: Use objcopy from GNU binutils with clang
In reply to Khem Rajllvm-objcopy reports errors which needs further investigations but stick to binutils provided objcopy meanwhile
--- meta/recipes-bsp/gnu-efi/gnu-efi_4.0.0.bb | 4 ++++ 1 file changed, 4 insertions(+)
meta/recipes-bsp/gnu-efi/gnu-efi_4.0.0.bb +4 -0
@@ -22,6 +22,10 @@ SRCREV = "5ea320f0f01c8de8f9dd4e4e38a245608f0287dd" S = "${WORKDIR}/git" +# llvm-objcopy fails +# arm-poky-linux-gnueabi-llvm-objcopy: error: 't8.so': section '.dynstr' cannot be removed because it is referenced by the section '.dynamic' +OBJCOPY:toolchain-clang = "${HOST_PREFIX}objcopy" + inherit github-releases do_configure:linux-gnux32:prepend() {
Signature · 1 line
2.49.0
PATCH v2 6/28 tcf-agent: Fix ranlib call when using llvm-ranlib
In reply to Khem RajThis 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
@@ -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
PATCH v2 7/28 pulseaudio: Treat -Wunused-command-line-argument as error
In reply to Khem RajThis ensures that it does not enble SSE when -msse flag is passed, clang warns about unused option on non-x86 targets but it must be flagged as error for configure to notice and fail the check to enable SSE on non-x86 machines
--- meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 3 +++ 1 file changed, 3 insertions(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +3 -0
@@ -71,6 +71,9 @@ inherit bash-completion meson pkgconfig useradd gettext perlnative systemd manpa # if using --disable-nls USE_NLS = "yes" +# Helps tests for -msse fail on non-SSE architectures which is all non-x86 +TUNE_CCARGS:append:toolchain-clang = " -Werror=unused-command-line-argument" + EXTRA_OEMESON = "\ -Dhal-compat=false \ -Dorc=disabled \
Signature · 1 line
2.49.0
PATCH v2 8/28 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
@@ -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
Re: [OE-core] [PATCH v2 08/28] libjpeg-turbo: Fix build on mips/clang
Quoted 14 lines · Khem Raj via lists.openembedded.org
Signed-off-by Khem Raj <[email protected]>---
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@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEADEBUG_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 EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA · line 54
Quoted 5 lines
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +5
-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"
The log is from 2.0.2, did you replicate this with 3.1.0 before moving from meta-clang?
Ross
Re: [OE-core] [PATCH v2 08/28] libjpeg-turbo: Fix build on mips/clang
Quoted 16 lines · Ross Burton
Quoted 14 lines · Khem Raj via lists.openembedded.org
Signed-off-by Khem Raj <[email protected]>---
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@@ -47,6 +47,12 @@ EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEADEBUG_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 7 lines
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb EXTRA_OECMAKE:append:class-target:powerpc64le = " ${@bb.utils.contains("TUNE_FEA · line 54
Quoted 5 lines
meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb +5
-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"The log is from 2.0.2, did you replicate this with 3.1.0 before moving from meta-clang?
Yes, I have started with vanilla poky and waded through world builds for all qemu machines, bringing only the changes which were still failing and not fixable differently. If this helps.
Quoted 3 lines
Ross
PATCH v2 9/28 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
@@ -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
PATCH v2 10/28 systemd-boot: Remove -mfpmath=sse option from cflags
In reply to Khem RajEFI sources in systemd uses -mgeneral-regs-only which conflicts with -mfpmath=sse specified by OE via tune arguments. It needs to be removed, clang errors about it and fails the build
Fixes
error: the 'sse' unit is not supported with this instruction set
--- meta/recipes-core/systemd/systemd-boot_257.5.bb | 5 +++++ 1 file changed, 5 insertions(+)
meta/recipes-core/systemd/systemd-boot_257.5.bb +5 -0
@@ -47,6 +47,11 @@ FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" RDEPENDS:${PN} += "virtual-systemd-bootconf" +# efi portions use -mgeneral-regs-only option which conflicts with SSE +# especially clang throws errors about it +# error: the 'sse' unit is not supported with this instruction set +TUNE_CCARGS:remove = "-mfpmath=sse" + CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t" COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*|riscv.*)-linux"
Signature · 1 line
2.49.0
PATCH v2 11/28 vulkan-samples: Disable overriding-option as error
In reply to Khem RajClang 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
@@ -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
Re: [OE-core] [PATCH v2 11/28] vulkan-samples: Disable overriding-option as error
meta/recipes-graphics/vulkan/vulkan-samples_git.bb EXTRA_OECMAKE += "-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON" · line 38
Quoted 6 lines · Khem Raj via lists.openembedded.org
meta/recipes-graphics/vulkan/vulkan-samples_git.bb +3
-0+# 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"
Where are these conflicting flags coming from? Feels like we should be fixing the upstream Makefiles instead?
Ross
Re: [OE-core] [PATCH v2 11/28] vulkan-samples: Disable overriding-option as error
Quoted 9 lines · Ross Burton
meta/recipes-graphics/vulkan/vulkan-samples_git.bb EXTRA_OECMAKE += "-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON" · line 38
Quoted 7 lines · Khem Raj via lists.openembedded.org
meta/recipes-graphics/vulkan/vulkan-samples_git.bb +3
-0+# 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"Where are these conflicting flags coming from? Feels like we should be fixing the upstream Makefiles instead?
Maybe, the end effect is that the last option wins and that is correct here so I did not see a need to fix it. If someone wants to that is appreciated,
Quoted 2 lines
Ross
PATCH v2 12/28 openssl: Link with libatomic on x86/clang
In reply to Khem RajFixes
threads_pthread.c:(.text+0x372): undefined reference to `__atomic_is_lock_free'
--- meta/recipes-connectivity/openssl/openssl_3.5.0.bb | 3 +++ 1 file changed, 3 insertions(+)
meta/recipes-connectivity/openssl/openssl_3.5.0.bb +3 -0
@@ -53,6 +53,9 @@ EXTRA_OECONF:append:class-nativesdk = " --with-rand-seed=os,devrandom" EXTRA_OEMAKE:append:task-compile:class-native = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"' EXTRA_OEMAKE:append:task-compile:class-nativesdk = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"' +#| threads_pthread.c:(.text+0x372): undefined reference to `__atomic_is_lock_free' +EXTRA_OECONF:append:toolchain-clang:x86 = " -latomic" + # This allows disabling deprecated or undesirable crypto algorithms. # The default is to trust upstream choices. DEPRECATED_CRYPTO_FLAGS ?= ""
Signature · 1 line
2.49.0
Re: [OE-core] [PATCH v2 12/28] openssl: Link with libatomic on x86/clang
Quoted 3 lines · Khem Raj via lists.openembedded.org
Fixes
threads_pthread.c:(.text+0x372): undefined reference to `__atomic_is_lock_free'
Khem,
These changes make sense to enable clang builds. (Yay and wow!)
There are a couple of cases where we need to add -latomic, here for openssl and also for qemu.
Is that an upstream <pkg> or clang/lld issue?
Is there a bug reported or should Sunil do that?
In general, how do you want to handle the exceptions?
I'm tempted to ignore the arm32 issue but I expect that some people will not be happy with that for several years if every. Right Ross?
Thanks,
../Randy
Quoted 30 lines
Signed-off-by Khem Raj<[email protected]>--- meta/recipes-connectivity/openssl/openssl_3.5.0.bb | 3 +++ 1 file changed, 3 insertions(+)meta/recipes-connectivity/openssl/openssl_3.5.0.bb +3
-1@@ -53,6 +53,9 @@ EXTRA_OECONF:append:class-nativesdk = " --with-rand-seed=os,devrandom" EXTRA_OEMAKE:append:task-compile:class-native = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"' EXTRA_OEMAKE:append:task-compile:class-nativesdk = ' OPENSSLDIR="/not/builtin" ENGINESDIR="/not/builtin" MODULESDIR="/not/builtin"' +#| threads_pthread.c:(.text+0x372): undefined reference to `__atomic_is_lock_free' +EXTRA_OECONF:append:toolchain-clang:x86 = " -latomic" + # This allows disabling deprecated or undesirable crypto algorithms. # The default is to trust upstream choices. DEPRECATED_CRYPTO_FLAGS ?= "" -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#216980):https://lists.openembedded.org/g/openembedded-core/message/216980 Mute This Topic:https://lists.openembedded.org/mt/113225023/3616765
Group Owner:[email protected] Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
# Randy MacLeod # Wind River Linux
PATCH v2 13/28 qemu: Link with libatomic on x86/clang
In reply to Khem RajClang does need libatomic to provide 64bit atomic
builtins on 32bit x86
--- meta/recipes-devtools/qemu/qemu_10.0.0.bb | 1 + 1 file changed, 1 insertion(+)
meta/recipes-devtools/qemu/qemu_10.0.0.bb +1 -0
@@ -7,6 +7,7 @@ DEPENDS += "glib-2.0 zlib pixman" DEPENDS:append:libc-musl = " libucontext" CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}" +LDFLAGS:append:toolchain-clang:x86 = " -latomic" RDEPENDS:${PN}-common:class-target += "bash"
Signature · 1 line
2.49.0
PATCH v2 14/28 bluez: Disable invalid-pp-token warning with clang
In reply to Khem RajWe 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
@@ -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
Re: [OE-core] [PATCH v2 14/28] bluez: Disable invalid-pp-token warning with clang
Quoted 29 lines · Khem Raj via lists.openembedded.org
We add
FIRMWARE_DIRvia CFLAGS using escapes for string and clang option parser flags it<command line>:4:23: warning: missing terminating '"' character [-Winvalid-pp-token]
4 | #defineFIRMWARE_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 <[email protected]>---
meta/recipes-connectivity/bluez5/bluez5.inc | 1 +1 file changed, 1 insertion(+)meta/recipes-connectivity/bluez5/bluez5.inc +0
-0@@ -84,6 +84,7 @@ EXTRA_OECONF = "\"
Quoted 2 lines
CFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\"" +CFLAGS:append:toolchain-clang = " -Wno-invalid-pp-token”
Wouldn’t it be neater to change the line above to:
CFLAGS += "-DFIRMWARE_DIR="${nonarch_base_libdir}/firmware”"
Bitbake’s parser is crazy and stuff like that works.
Ross
Re: [OE-core] [PATCH v2 14/28] bluez: Disable invalid-pp-token warning with clang
Quoted 29 lines · Ross Burton
Quoted 29 lines · Khem Raj via lists.openembedded.org
We add
FIRMWARE_DIRvia CFLAGS using escapes for string and clang option parser flags it<command line>:4:23: warning: missing terminating '"' character [-Winvalid-pp-token]
4 | #defineFIRMWARE_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 <[email protected]>---
meta/recipes-connectivity/bluez5/bluez5.inc | 1 +1 file changed, 1 insertion(+)meta/recipes-connectivity/bluez5/bluez5.inc +0
-0@@ -84,6 +84,7 @@ EXTRA_OECONF = "\"
Quoted 8 lines
Quoted 2 lines
CFLAGS += "-DFIRMWARE_DIR=\\"${nonarch_base_libdir}/firmware\\"" +CFLAGS:append:toolchain-clang = " -Wno-invalid-pp-token”
Wouldn’t it be neater to change the line above to:
CFLAGS += "-DFIRMWARE_DIR="${nonarch_base_libdir}/firmware”"
Bitbake’s parser is crazy and stuff like that works.
I have tried several ways to pass it, what you suggest was in fact first thing I tried and it passes -DFIRMWARE_DIR="/usr/lib/firmware” as seen in bitbake preprocessing output but emits following into an implicit header file that compiler sees
#define FIRMWARE_DIR /usr/lib/firmware
which is not right string syntax in C. what we need is
#define FIRMWARE_DIR "/usr/lib/firmware"
on compiler commandline it should look like
-DFIRMWARE_DIR=\"/usr/lib/firmware\"
So how can we teach bitbake to do this ?
Quoted 2 lines
Ross
PATCH v2 15/28 gcc: Always use GCC toolchain
In reply to Khem RajGCC is not yet compilable with clang e.g.
--- meta/recipes-devtools/gcc/gcc-15.1.inc | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-devtools/gcc/gcc-15.1.inc +2 -0
@@ -10,6 +10,8 @@ BINV = "15.1.0" FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:" +TOOLCHAIN = "gcc" + DEPENDS =+ "mpfr gmp libmpc zlib zstd flex-native" NATIVEDEPS = "mpfr-native gmp-native libmpc-native zlib-native flex-native zstd-native"
Signature · 1 line
2.49.0
PATCH v2 16/28 glibc: Always use GCC toolchain
In reply to Khem RajGlibc is not yet buildable with non-gcc compilers e.g. clang
--- meta/recipes-core/glibc/glibc-common.inc | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-core/glibc/glibc-common.inc +2 -0
@@ -23,3 +23,5 @@ ARM_INSTRUCTION_SET:armv6 = "arm" COMPATIBLE_HOST:libc-musl:class-target = "null" PV = "2.41+git" + +TOOLCHAIN = "gcc"
Signature · 1 line
2.49.0
PATCH v2 17/28 grub,grub-efi: Pin to using gcc on aarch64
In reply to Khem RajIt needs porting to work with clang
--- meta/recipes-bsp/grub/grub2.inc | 4 ++++ 1 file changed, 4 insertions(+)
meta/recipes-bsp/grub/grub2.inc +4 -0
@@ -106,3 +106,7 @@ do_configure:prepend() { FROM_BOOTSTRAP=1 ${S}/autogen.sh cd ${B} } + +# | aarch64-poky-linux-clang: error: invalid argument '-mcmodel=large' only allowed with '-fno-pic' +# see - https://bugs.gentoo.org/942843 +TOOLCHAIN:aarch64 = "gcc"
Signature · 1 line
2.49.0
PATCH v2 18/28 valgrind: Use gcc to compile on riscv64
In reply to Khem Rajclang does not yet support __builtin_longjmp on riscv64
--- meta/recipes-devtools/valgrind/valgrind_3.25.0.bb | 8 ++++++++ 1 file changed, 8 insertions(+)
meta/recipes-devtools/valgrind/valgrind_3.25.0.bb +8 -0
@@ -106,3 +106,11 @@ INHIBIT_PACKAGE_STRIP_FILES = "${PKGD}${libexecdir}/valgrind/vgpreload_memcheck- # valgrind needs debug information for ld.so at runtime in order to # redirect functions like strlen. RRECOMMENDS:${PN} += "${TCLIBC}-dbg" + +# Valgrind needs intrinsics which are not provided by clang +# m_signals.c:2213:7: error: __builtin_longjmp is not supported for the current target +# 2213 | VG_MINIMAL_LONGJMP(tst->sched_jmpbuf); +# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# It needs something like - https://bugs.kde.org/show_bug.cgi?id=369723 +TOOLCHAIN:riscv64 = "gcc"
Signature · 1 line
2.49.0
PATCH v2 19/28 syslinux: Pin to using GCC toolchain
In reply to Khem RajIt does not compile with clang due to include_next stdarg.h not working as the system expects to match gcc behavior
--- meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb | 5 +++++ 1 file changed, 5 insertions(+)
meta/recipes-devtools/syslinux/syslinux_6.04-pre2.bb +5 -0
@@ -130,3 +130,8 @@ FILES:${PN}-staticdev += "${datadir}/${BPN}/com32/lib*.a ${libdir}/${BPN}/com32/ FILES:${PN}-misc = "${datadir}/${BPN}/* ${libdir}/${BPN}/* ${bindir}/*" BBCLASSEXTEND = "native nativesdk" + +# com32/lib/../include/stdarg.h:9:15: fatal error: 'stdarg.h' file not found +# 9 | #include_next <stdarg.h> +# | ^~~~~~~~~~ +TOOLCHAIN = "gcc"
Signature · 1 line
2.49.0
PATCH v2 20/28 systemtap: Pin to build with GCC
In reply to Khem Rajclang 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
@@ -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
Re: [OE-core] [PATCH v2 20/28] systemtap: Pin to build with GCC
Quoted 21 lines · Khem Raj via lists.openembedded.org
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 <[email protected]>---
meta/recipes-kernel/systemtap/systemtap_git.bb | 4 ++++1 file changed, 4 insertions(+)meta/recipes-kernel/systemtap/systemtap_git.bb +0
-0@@ -99,3 +99,7 @@ do_install:append () { }BBCLASSEXTEND = "nativesdk"
meta/recipes-kernel/systemtap/systemtap_git.bb do_install:append () {
Quoted 4 lines
meta/recipes-kernel/systemtap/systemtap_git.bb +4
-0+ +# Emits lot of warning which are treated as errors +# They must be looked into before disabling +TOOLCHAIN = “gcc"
Upstream configure.ac has a —disable-error which is probably the right thing to do:
Ross
Re: [OE-core] [PATCH v2 20/28] systemtap: Pin to build with GCC
Quoted 30 lines · Ross Burton
Quoted 21 lines · Khem Raj via lists.openembedded.org
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 <[email protected]>---
meta/recipes-kernel/systemtap/systemtap_git.bb | 4 ++++1 file changed, 4 insertions(+)meta/recipes-kernel/systemtap/systemtap_git.bb +0
-0@@ -99,3 +99,7 @@ do_install:append () { }BBCLASSEXTEND = "nativesdk"
meta/recipes-kernel/systemtap/systemtap_git.bb do_install:append () {
Quoted 4 lines
meta/recipes-kernel/systemtap/systemtap_git.bb +4
-0+ +# Emits lot of warning which are treated as errors +# They must be looked into before disabling +TOOLCHAIN = “gcc"Upstream configure.ac has a —disable-error which is probably the right thing to do:
Quoted 2 lines
yeah it is not sufficient though, there still are warnings reported as errors - https://termbin.com/o1qn
Quoted 1 line
Ross
PATCH v2 21/28 webkitgtk: Use gcc to compile for arm target
In reply to Khem RajBuilds with clang run into compiler errors
<inline asm>:320:1: error: Relocation Not In Range
320 | movw r4, #:lower16:.Lllint_op_tail_call_varargs - .Lllint_relativePCBase
| ^
--- meta/recipes-sato/webkit/webkitgtk_2.48.1.bb | 2 ++ 1 file changed, 2 insertions(+)
meta/recipes-sato/webkit/webkitgtk_2.48.1.bb +2 -0
@@ -176,3 +176,5 @@ src_package_preprocess () { ${B}/WebKitGTK/DerivedSources/webkit/*.cpp } +# Clang-20 issue - https://github.com/llvm/llvm-project/issues/132322 +TOOLCHAIN:arm = "gcc"
Signature · 1 line
2.49.0
PATCH v2 22/28 pseudo: Pin to using GCC compiler
In reply to Khem RajIt uses compiler built-ins which clang does not provide
--- meta/recipes-devtools/pseudo/pseudo_git.bb | 7 +++++++ 1 file changed, 7 insertions(+)
meta/recipes-devtools/pseudo/pseudo_git.bb +7 -0
@@ -25,3 +25,10 @@ TARGET_CC_ARCH:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS # error: use of undeclared identifier '_STAT_VER' COMPATIBLE_HOST:libc-musl = 'null' + +#| ./ports/linux/pseudo_wrappers.c:80:14: error: use of unknown builtin '__builtin_apply' [-Wimplicit-function-declaration] +#| void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7); +#| ^ +#| ./ports/linux/pseudo_wrappers.c:80:57: error: use of unknown builtin '__builtin_apply_args' [-Wimplicit-function-declaration] +#| void *res = __builtin_apply((void (*)()) real_syscall, __builtin_apply_args(), sizeof(long) * 7); +TOOLCHAIN = "gcc"
Signature · 1 line
2.49.0
PATCH v2 23/28 rpm: Always use gcc compiler
In reply to Khem Rajclang can build it ok but the openmp directives get emitted with full paths into binaries [1] until thats fixed in clang/openmp stick to gcc
[1] https://github.com/llvm/llvm-project/issues/82541
--- meta/recipes-devtools/rpm/rpm_4.20.0.bb | 4 ++++ 1 file changed, 4 insertions(+)
meta/recipes-devtools/rpm/rpm_4.20.0.bb +4 -0
@@ -62,6 +62,10 @@ OECMAKE_GENERATOR = "Unix Makefiles" BBCLASSEXTEND = "native nativesdk" +# Clang results in a reproducibility issue +# https://github.com/llvm/llvm-project/issues/82541 +TOOLCHAIN = "gcc" + PACKAGECONFIG ??= "archive" PACKAGECONFIG[plugins] = "-DENABLE_PLUGINS=ON,-DENABLE_PLUGINS=OFF"
Signature · 1 line
2.49.0
PATCH v2 24/28 pulseaudio: Pin to use GCC compiler
In reply to Khem RajInline assembly is not written in portable fashion
--- meta/recipes-multimedia/pulseaudio/pulseaudio.inc | 5 +++++ 1 file changed, 5 insertions(+)
meta/recipes-multimedia/pulseaudio/pulseaudio.inc +5 -0
@@ -74,6 +74,11 @@ USE_NLS = "yes" # Helps tests for -msse fail on non-SSE architectures which is all non-x86 TUNE_CCARGS:append:toolchain-clang = " -Werror=unused-command-line-argument" +# mix_neon.c:179:9: error: invalid operand in inline asm: 'vld1.s32 ${0:h}, [$2] +# vld1.s32 ${1:h}, [$3] ' +TOOLCHAIN:armv7ve = "gcc" +TOOLCHAIN:armv7a = "gcc" + EXTRA_OEMESON = "\ -Dhal-compat=false \ -Dorc=disabled \
Signature · 1 line
2.49.0
PATCH v2 25/28 seatd: Disable sign-compare warning as error on clang
In reply to Khem RajMake 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
@@ -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
Re: [OE-core] [PATCH v2 25/28] seatd: Disable sign-compare warning as error on clang
meta/recipes-core/seatd/seatd_0.9.1.bb inherit meson pkgconfig systemd update-rc.d useradd · line 25
Quoted 8 lines · Khem Raj via lists.openembedded.org
meta/recipes-core/seatd/seatd_0.9.1.bb +8
-0+#../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"
This is silencing an error, and it would be better to fix the issue instead. Also, why is it musl-specific?
Alex
Re: [OE-core] [PATCH v2 25/28] seatd: Disable sign-compare warning as error on clang
Quoted 14 lines · Alexander Kanavin
meta/recipes-core/seatd/seatd_0.9.1.bb inherit meson pkgconfig systemd update-rc.d useradd · line 25
Quoted 8 lines · Khem Raj via lists.openembedded.org
meta/recipes-core/seatd/seatd_0.9.1.bb +8
-0+#../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"This is silencing an error, and it would be better to fix the issue instead. Also, why is it musl-specific?
It does not look like a problem in the package but rather something in system headers from musl since CMSG_NXTHDR is from sys/socket.h thats why its done
the way it is. I am working with musl to see if this is the right behavior for musl
Quoted 2 lines
Alex
PATCH v2 26/28 busybox: Fix build on architectures without SYS_settimeofday
In reply to Khem RajFixes following errors on riscv32/musl
| util-linux/hwclock.c:143:20: error: use of undeclared identifier 'SYS_settimeofday' | 143 | int ret = syscall(SYS_settimeofday, NULL, tz); | | ^ | 1 error generated.
--- ...ck-for-SYS_settimeofday-before-calling-sy.patch | 52 ++++++++++++++++++++++ meta/recipes-core/busybox/busybox_1.37.0.bb | 1 + 2 files changed, 53 insertions(+)
meta/recipes-core/busybox/busybox/0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch new file +52 -0
@@ -0,0 +1,52 @@ +From 4e1eafc6e0de3e58cac9f62e57b552eddb50ca8e Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Sun, 7 Mar 2021 17:30:24 -0800 +Subject: [PATCH] hwclock: Check for SYS_settimeofday before calling syscall + +Some newer architectures e.g. RISCV32 have 64bit time_t from get go and +thusly do not have gettimeofday_time64/settimeofday_time64 implemented +therefore check for SYS_settimeofday definition before making the +syscall. Fixes build for riscv32 and it will bail out at runtime. + +This issue has been discussed on the musl mailing list, and +the musl developers' opinion is that Busybox is wrong: + +https://www.openwall.com/lists/musl/2024/03/03/2 +https://www.openwall.com/lists/musl/2024/04/07/2 + +The correct fix isn't clear, and in the mean time, the patch +turns the build issue into a runtime error only on the problematic +architecture (riscv32), which seems like a reasonable trade-off + +Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2021-March/088583.html]] +Signed-off-by: Khem Raj <[email protected]> +--- + util-linux/hwclock.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c +index c3fd0eb57..dea9c9a55 100644 +--- a/util-linux/hwclock.c ++++ b/util-linux/hwclock.c +@@ -132,6 +132,7 @@ static void show_clock(const char **pp_rtcname, int utc) + + static void set_kernel_tz(const struct timezone *tz) + { ++ int ret = 1; + #if LIBC_IS_MUSL + /* musl libc does not pass tz argument to syscall + * because "it's deprecated by POSIX, therefore it's fine +@@ -140,9 +141,11 @@ static void set_kernel_tz(const struct timezone *tz) + #if !defined(SYS_settimeofday) && defined(SYS_settimeofday_time32) + # define SYS_settimeofday SYS_settimeofday_time32 + #endif +- int ret = syscall(SYS_settimeofday, NULL, tz); ++#if defined(SYS_settimeofday) ++ ret = syscall(SYS_settimeofday, NULL, tz); ++#endif + #else +- int ret = settimeofday(NULL, tz); ++ ret = settimeofday(NULL, tz); + #endif + if (ret) + bb_simple_perror_msg_and_die("settimeofday");
meta/recipes-core/busybox/busybox_1.37.0.bb +1 -0
@@ -54,6 +54,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://0002-start-stop-daemon-fix-tests.patch \ file://0003-start-stop-false.patch \ file://0001-archival-disallow-path-traversals-CVE-2023-39810.patch \ + file://0001-hwclock-Check-for-SYS_settimeofday-before-calling-sy.patch \ " SRC_URI:append:libc-musl = " file://musl.cfg" SRC_URI:append:x86-64 = " file://sha_accel.cfg"
Signature · 1 line
2.49.0
PATCH v2 27/28 systemd-boot: Use gcc on musl/arm
In reply to Khem Rajclang 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
@@ -54,6 +54,9 @@ TUNE_CCARGS:remove = "-mfpmath=sse" 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:libc-musl:arm = "gcc" + COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*|riscv.*)-linux" COMPATIBLE_HOST:x86-x32 = "null"
Signature · 1 line
2.49.0
Re: [OE-core] [PATCH v2 27/28] systemd-boot: Use gcc on musl/arm
meta/recipes-core/systemd/systemd-boot_257.5.bb TUNE_CCARGS:remove = "-mfpmath=sse" · line 58
Quoted 5 lines · Khem Raj via lists.openembedded.org
clang does not support -mgeneral-regs-only option for arm
meta/recipes-core/systemd/systemd-boot_257.5.bb +2
-0+# arm-poky-linux-musleabi-clang: error: unsupported option '-mgeneral-regs-only' for target 'arm-poky-linux-musleabi' +TOOLCHAIN:libc-musl:arm = "gcc"
Why is this specific to musl, does the choice of libc really control whether this option exists in clang?
Ross
Re: [OE-core] [PATCH v2 27/28] systemd-boot: Use gcc on musl/arm
Quoted 10 lines · Ross Burton
meta/recipes-core/systemd/systemd-boot_257.5.bb TUNE_CCARGS:remove = "-mfpmath=sse" · line 58
Quoted 5 lines · Khem Raj via lists.openembedded.org
clang does not support -mgeneral-regs-only option for arm
meta/recipes-core/systemd/systemd-boot_257.5.bb +2
-0+# arm-poky-linux-musleabi-clang: error: unsupported option '-mgeneral-regs-only' for target 'arm-poky-linux-musleabi' +TOOLCHAIN:libc-musl:arm = "gcc"Why is this specific to musl, does the choice of libc really control whether this option exists in clang?
good question. I will rebuild once more for arm/glibc combo, The option does not exist for arm in clang so glibc version should fail as well. I wanted to keep the scope of these settings as narrow as possible thats why make is libc-musl:arm
Quoted 2 lines
Ross
Re: [OE-core] [PATCH v2 27/28] systemd-boot: Use gcc on musl/arm
In reply to Ross BurtonQuoted 9 lines · Ross Burton
meta/recipes-core/systemd/systemd-boot_257.5.bb TUNE_CCARGS:remove = "-mfpmath=sse" · line 58
Quoted 5 lines · Khem Raj via lists.openembedded.org
clang does not support -mgeneral-regs-only option for arm
meta/recipes-core/systemd/systemd-boot_257.5.bb +2
-0+# arm-poky-linux-musleabi-clang: error: unsupported option '-mgeneral-regs-only' for target 'arm-poky-linux-musleabi' +TOOLCHAIN:libc-musl:arm = "gcc"Why is this specific to musl, does the choice of libc really control whether this option exists in clang?
This is not musl specific, build with arm/glibc failed with exact same error. I have removed the libc override for v3. Thanks for feedback
Quoted 2 lines
Ross
PATCH v2 28/28 perf: Do not treat maybe-uninitialized warnings as errors
In reply to Khem RajClang finds more warnings in kernel code, make clang happy to not treat these extra warnings as errors
--- meta/recipes-kernel/perf/perf.bb | 10 ++++++++++ 1 file changed, 10 insertions(+)
meta/recipes-kernel/perf/perf.bb +10 -0
@@ -81,6 +81,16 @@ LDFLAGS = "-ldl -lutil" # avoiding the 'buildpaths' QA warning. TARGET_CC_ARCH += "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}" +#| libbpf.c: In function 'find_kernel_btf_id.constprop': +#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized] +#| 10009 | if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0) +#| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#| libbpf.c:9979:21: note: 'mod_len' was declared here +#| 9979 | int ret, i, mod_len; +#| | ^~~~~~~ +#| cc1: all warnings being treated as errors +TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized" + EXTRA_OEMAKE = '\ V=1 \ VF=1 \
Signature · 1 line
2.49.0
Re: [OE-core] [PATCH v2 28/28] perf: Do not treat maybe-uninitialized warnings as errors
I just sent a patch to linux-yocto to silence this at root.
Ross
Quoted 44 lines · Khem Raj via lists.openembedded.org
Clang finds more warnings in kernel code, make clang happy to not treat these extra warnings as errors
Signed-off-by Khem Raj <[email protected]>---
meta/recipes-kernel/perf/perf.bb | 10 ++++++++++1 file changed, 10 insertions(+)meta/recipes-kernel/perf/perf.bb +0
-0@@ -81,6 +81,16 @@ LDFLAGS = "-ldl -lutil" # avoiding the 'buildpaths' QA warning.
TARGET_CC_ARCH+= "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"meta/recipes-kernel/perf/perf.bb +10
-0+#| libbpf.c: In function 'find_kernel_btf_id.constprop': +#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized] +#| 10009 | if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0) +#| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#| libbpf.c:9979:21: note: 'mod_len' was declared here +#| 9979 | int ret, i, mod_len; +#| | ^~~~~~~ +#| cc1: all warnings being treated as errors +TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized" +EXTRA_OEMAKE = '\ V=1 \ VF=1 \Signature · 10 lines
2.49.0 -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#216996): https://lists.openembedded.org/g/openembedded-core/message/216996 Mute This Topic: https://lists.openembedded.org/mt/113225040/6875888 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH v2 28/28] perf: Do not treat maybe-uninitialized warnings as errors
Quoted 3 lines · Ross Burton
I just sent a patch to linux-yocto to silence this at root.
Thanks, we need to send a revert for this to OE-core as well once the linux-yocto change is merged with link to it.
Quoted 47 lines
Ross
Quoted 44 lines · Khem Raj via lists.openembedded.org
Clang finds more warnings in kernel code, make clang happy to not treat these extra warnings as errors
Signed-off-by Khem Raj <[email protected]>---
meta/recipes-kernel/perf/perf.bb | 10 ++++++++++1 file changed, 10 insertions(+)meta/recipes-kernel/perf/perf.bb +0
-0@@ -81,6 +81,16 @@ LDFLAGS = "-ldl -lutil" # avoiding the 'buildpaths' QA warning.
TARGET_CC_ARCH+= "${SELECTED_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"meta/recipes-kernel/perf/perf.bb +10
-0+#| libbpf.c: In function 'find_kernel_btf_id.constprop': +#| libbpf.c:10009:33: error: 'mod_len' may be used uninitialized [-Werror=maybe-uninitialized] +#| 10009 | if (mod_name && strncmp(mod->name, mod_name, mod_len) != 0) +#| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#| libbpf.c:9979:21: note: 'mod_len' was declared here +#| 9979 | int ret, i, mod_len; +#| | ^~~~~~~ +#| cc1: all warnings being treated as errors +TARGET_CC_ARCH:append:toolchain-clang:arm = " -fno-error=maybe-uninitialized" +EXTRA_OEMAKE = '\ V=1 \ VF=1 \--
2.49.0-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#216996): https://lists.openembedded.org/g/openembedded-core/message/216996
Mute This Topic: https://lists.openembedded.org/mt/113225040/6875888
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-