clang-merge: Bring clang recipes from meta-clang
v2 cover clang-merge: Bring clang recipes from meta-clang
Latest mesa 25+ needs libclang during build for tools like mesa_clc, we enahnced already existing llvm recipe to build pieces of clang as well, which worked for mesa's needs but broke static clang compiler provided by meta-clang due to newfound conflicts, since clang is now built with llvm recipe from core and also by meta-clang and they compete for same namespace, an attempt to make them co-habit did reveal more difficulties. Clang compiler from meta-clang is not able to use llvm libraries from core since they patch them differently.
This patch series therefore brings clang and all recipes that build from llvm sources into core. With this changeset, clang recipes can be removed from meta-clang there is a pull request for that already [1] As an aside, we only build clang once and use it for meta-clang needs and core needs.
With this, meta-clang can depend upon core layer to provide clang and related recipes, meta-clang will still provide the toolchain policies around clang based toolchains. Clang compiler from core, while usable for mesa is not yet fully usable out of box, since we need to workout the multi-toolchain architecture for core, which will be done in next phase after this merge.
[1] https://github.com/kraj/meta-clang/pull/1088
---
Changes in v2:
- Address Feedback from Alex and Dmitry.
- Squash similar commits to reduce number of patches.
- Move native toolchain file generation to cmake bbclass instead of
adding new class
- Fix space/tabs indentation inconsistencies
- Reorder the patch sequence to avoid errors in future git bisects
- Fix use before define string problem in one of the patches
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Khem Raj (7):
cmake.bbclass: Enhance to emit a native toolchain cmake file toolchain/clang: Remove duplicate RANLIB setting
sstatesig: Handle special case of llvm-project-source shared-workdir multilib.conf: Add llvm-project-source recipe to NON_MULTILIB_RECIPES kernel-arch.bbclass: Do not use weak assignment for TOOLCHAIN
clang: Merge llvm/clang family recipes from meta-clang maintainers.inc: Add myself as maintainer for clang family of recipes
meta/classes-recipe/cmake.bbclass | 58 +++ meta/classes-recipe/kernel-arch.bbclass | 2 +- meta/conf/distro/include/maintainers.inc | 11 +- meta/conf/multilib.conf | 2 +- meta/conf/toolchain/clang.inc | 1 - meta/lib/oe/sstatesig.py | 3 + .../clang/clang-cross-canadian_git.bb | 36 ++ meta/recipes-devtools/clang/clang-cross_git.bb | 39 ++ meta/recipes-devtools/clang/clang-crosssdk_git.bb | 33 ++ ...ind-libunwind-headers-when-LIBCXXABI_LIBU.patch | 60 +++ ...er-rt-support-a-new-embedded-linux-target.patch | 309 +++++++++++++ ...-Simplify-cross-compilation.-Don-t-use-na.patch | 44 ++ ...LibraryInfo-Undefine-libc-functions-if-th.patch | 90 ++++ ...allow-env-override-of-exe-and-libdir-path.patch | 71 +++ ...-clang-driver-Check-sysroot-for-ldso-path.patch | 78 ++++ ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 32 ++ .../0008-clang-Prepend-trailing-to-sysroot.patch | 39 ++ ...inside-the-target-sysroot-for-compiler-ru.patch | 41 ++ ...ang-Define-releative-gcc-installation-dir.patch | 123 +++++ ...pthread-and-ldl-along-with-lunwind-for-st.patch | 35 ++ ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 24 + .../0013-Check-for-atomic-double-intrinsics.patch | 34 ++ ...configure-for-packages-using-find_package.patch | 2 +- ...esource-dir-location-for-cross-toolchains.patch | 50 +++ ...r-Add-dyld-prefix-when-checking-sysroot-f.patch | 79 ++++ .../0017-clang-Use-python3-in-python-scripts.patch | 35 ++ ...Insert-anchor-for-adding-OE-distro-vendor.patch | 167 +++++++ ...-Do-not-use-backtrace-APIs-on-non-glibc-l.patch | 68 +++ ...86-triple-for-non-debian-multiarch-linux-.patch | 28 ++ ...0021-libunwind-Added-unw_backtrace-method.patch | 56 +++ .../0022-lldb-Link-with-libatomic-on-x86.patch | 33 ++ ...023-compiler-rt-Enable-__int128-for-ppc32.patch | 73 +++ ...-Do-not-use-cmake-infra-to-detect-libzstd.patch | 62 +++ ...ler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch | 46 ++ ...-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch | 43 ++ ...s-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch | 81 ++++ ...vm-Add-OE-specific-ABI-triple-for-N32-ABI.patch | 78 ++++ ...d-libunwind.pc.in-and-llvm-config-scripts.patch | 90 ++++ ...py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch | 92 ++++ ...r-rt-Do-not-pass-target-to-clang-compiler.patch | 29 ++ .../clang/clang/0032-Fix-build-on-ppc64-musl.patch | 97 ++++ ...d-a-build-option-to-disable-building-dexp.patch | 85 ++++ ...itter-sort-ClassInfo-lists-by-name-as-we.patch} | 4 +- ...-remove-LLVM_LDFLAGS-from-ldflags-output.patch} | 12 +- ...ot-emit-date-and-time-into-generate-files.patch | 37 ++ .../clang}/spirv-internal-build.patch | 0 .../clang}/spirv-shared-library.patch | 0 meta/recipes-devtools/clang/clang_git.bb | 496 +++++++++++++++++++++ meta/recipes-devtools/clang/common-clang.inc | 24 + meta/recipes-devtools/clang/common-source.inc | 17 + meta/recipes-devtools/clang/common.inc | 83 ++++ .../clang/compiler-rt-sanitizers_git.bb | 139 ++++++ meta/recipes-devtools/clang/compiler-rt_git.bb | 125 ++++++ meta/recipes-devtools/clang/libcxx_git.bb | 119 +++++ meta/recipes-devtools/clang/llvm-project-source.bb | 12 + .../recipes-devtools/clang/llvm-project-source.inc | 99 ++++ .../recipes-devtools/clang/nativesdk-clang-glue.bb | 36 ++ meta/recipes-devtools/clang/openmp_git.bb | 67 +++ .../0007-llvm-allow-env-override-of-exe-path.patch | 36 -- meta/recipes-devtools/llvm/llvm/llvm-config | 54 --- meta/recipes-devtools/llvm/llvm_20.1.2.bb | 233 ---------- 61 files changed, 3715 insertions(+), 337 deletions(-)
---
base-commit: c807b703cdfc5dc2c7fe98f55a5d323eb3e1877c
change-id: 20250423-clang-merge-ca9130ae95af
Best regards,
Signature · 1 line
Khem Raj <[email protected]>
PATCH v2 1/7 cmake.bbclass: Enhance to emit a native toolchain cmake file
Some components e.g. clang and its runtime needs the native toolchain defines especially when doing nativesdk builds it uses CROSS_TOOLCHAIN_FLAGS_NATIVE to pass native toolchain file, which is then used to build native llvm tools needed during nativesdk builds
Moreover this would enable using OE built native toolchain e.g. clang-native to build cmake based packages. e.g. libcxx and other llvm runtime plus it can be used for build native packages which require clang
--- meta/classes-recipe/cmake.bbclass | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+)
meta/classes-recipe/cmake.bbclass +58 -0
@@ -50,11 +50,34 @@ OECMAKE_C_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CC', d)[1]}" OECMAKE_CXX_COMPILER ?= "${@oecmake_map_compiler('CXX', d)[0]}" OECMAKE_CXX_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('CXX', d)[1]}" +# Native C/C++ Compiler (without cpu arch/tune arguments) +OECMAKE_NATIVE_C_COMPILER ?= "${@oecmake_map_compiler('BUILD_CC', d)[0]}" +OECMAKE_NATIVE_C_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('BUILD_CC', d)[1]}" +OECMAKE_NATIVE_CXX_COMPILER ?= "${@oecmake_map_compiler('BUILD_CXX', d)[0]}" +OECMAKE_NATIVE_CXX_COMPILER_LAUNCHER ?= "${@oecmake_map_compiler('BUILD_CXX', d)[1]}" +OECMAKE_NATIVE_AR ?= "${BUILD_AR}" +OECMAKE_NATIVE_RANLIB ?= "${BUILD_RANLIB}" +OECMAKE_NATIVE_NM ?= "${BUILD_NM}" + +# Native compiler flags +OECMAKE_NATIVE_C_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CFLAGS}" +OECMAKE_NATIVE_CXX_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CXXFLAGS}" +OECMAKE_NATIVE_C_FLAGS_RELEASE ?= "-DNDEBUG" +OECMAKE_NATIVE_CXX_FLAGS_RELEASE ?= "-DNDEBUG" +OECMAKE_NATIVE_C_LINK_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS}" +OECMAKE_NATIVE_CXX_LINK_FLAGS ?= "${BUILD_CC_ARCH} ${BUILD_CXXFLAGS} ${BUILD_LDFLAGS}" +BUILD_CXXFLAGS += "${BUILD_CC_ARCH}" +BUILD_CFLAGS += "${BUILD_CC_ARCH}" + # clear compiler vars for allarch to avoid sig hash difference OECMAKE_C_COMPILER:allarch = "" OECMAKE_C_COMPILER_LAUNCHER:allarch = "" OECMAKE_CXX_COMPILER:allarch = "" OECMAKE_CXX_COMPILER_LAUNCHER:allarch = "" +OECMAKE_NATIVE_C_COMPILER:allarch = "" +OECMAKE_NATIVE_C_COMPILER_LAUNCHER:allarch = "" +OECMAKE_NATIVE_CXX_COMPILER:allarch = "" +OECMAKE_NATIVE_CXX_COMPILER_LAUNCHER:allarch = "" OECMAKE_RPATH ?= "" OECMAKE_PERLNATIVE_DIR ??= ""
@@ -155,6 +178,41 @@ set( CMAKE_LIBRARY_PATH ${libdir} ${base_libdir}) list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${includedir}) list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${includedir}) +EOF + cat > ${WORKDIR}/toolchain-native.cmake <<EOF +set( CMAKE_SYSTEM_NAME ${@map_host_os_to_system_name(d.getVar('BUILD_OS'))} ) +set( CMAKE_SYSTEM_PROCESSOR ${@map_host_arch_to_uname_arch(d.getVar('BUILD_ARCH'))} ) +set( CMAKE_C_COMPILER ${OECMAKE_NATIVE_C_COMPILER} ) +set( CMAKE_CXX_COMPILER ${OECMAKE_NATIVE_CXX_COMPILER} ) +set( CMAKE_ASM_COMPILER ${OECMAKE_NATIVE_C_COMPILER} ) +set( CMAKE_AR ${OECMAKE_NATIVE_AR} CACHE FILEPATH "Archiver" ) +set( CMAKE_RANLIB ${OECMAKE_NATIVE_RANLIB} CACHE FILEPATH "Archive Indexer" ) +set( CMAKE_NM ${OECMAKE_NATIVE_NM} CACHE FILEPATH "Symbol Lister" ) +set( CMAKE_C_FLAGS "${OECMAKE_NATIVE_C_FLAGS}" CACHE STRING "CFLAGS" ) +set( CMAKE_CXX_FLAGS "${OECMAKE_NATIVE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" ) +set( CMAKE_ASM_FLAGS "${OECMAKE_NATIVE_C_FLAGS}" CACHE STRING "ASM FLAGS" ) +set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_NATIVE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" ) +set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_NATIVE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" ) +set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_NATIVE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" ) +set( CMAKE_C_LINK_FLAGS "${OECMAKE_NATIVE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" ) +set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_NATIVE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" ) + +set( CMAKE_FIND_ROOT_PATH ${STAGING_DIR_NATIVE} ) +set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH ) +set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) + +# Use native cmake modules +list(APPEND CMAKE_MODULE_PATH "${STAGING_DATADIR_NATIVE}/cmake/Modules/") + +# add for non /usr/lib libdir, e.g. /usr/lib64 +set( CMAKE_LIBRARY_PATH ${STAGING_BASE_LIBDIR_NATIVE} ${STAGING_LIBDIR_NATIVE}) + +# add include dir to implicit includes in case it differs from /usr/include +list(APPEND CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${STAGING_INCDIR_NATIVE}) +list(APPEND CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${STAGING_INCDIR_NATIVE}) + EOF }
Signature · 1 line
2.49.0
PATCH v2 2/7 toolchain/clang: Remove duplicate RANLIB setting
In reply to Khem RajIts already assigned couple of lines above
--- meta/conf/toolchain/clang.inc | 1 - 1 file changed, 1 deletion(-)
meta/conf/toolchain/clang.inc +0 -1
@@ -7,7 +7,6 @@ CCLD = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" RANLIB = "${HOST_PREFIX}llvm-ranlib" AR = "${HOST_PREFIX}llvm-ar" AS = "${HOST_PREFIX}as ${HOST_AS_ARCH}" -RANLIB = "${HOST_PREFIX}gcc-ranlib" STRIP = "${HOST_PREFIX}llvm-strip" OBJCOPY = "${HOST_PREFIX}llvm-objcopy" OBJDUMP = "${HOST_PREFIX}llvm-objdump"
Signature · 1 line
2.49.0
PATCH v2 3/7 sstatesig: Handle special case of llvm-project-source shared-workdir
In reply to Khem Rajbitbake-dumpsig or bitbake-diffsig tools do not work on any of tasks exposed by llvm-project-source recipe. This is due to it being a shared-workdir recipe.
Fixes
bitbake-diffsigs -t llvm-project-source-20.1.2 do_preconfigure
NOTE: Starting bitbake server...
ERROR: No sigdata files found matching llvm-project-source-20.1.2 do_preconfigure
--- meta/lib/oe/sstatesig.py | 3 +++ 1 file changed, 3 insertions(+)
meta/lib/oe/sstatesig.py +3 -0
@@ -418,6 +418,9 @@ def find_siginfo(pn, taskname, taskhashlist, d): if pn.startswith("gcc-source"): # gcc-source shared workdir is a special case :( stamp = localdata.expand("${STAMPS_DIR}/work-shared/gcc-${PV}-${PR}") + elif pn.startswith("llvm-project-source"): + # llvm-project-source shared workdir is also a special case :*( + stamp = localdata.expand("${STAMPS_DIR}/work-shared/llvm-project-source-${PV}-${PR}") filespec = '%s.%s.sigdata.*' % (stamp, taskname) foundall = False
Signature · 1 line
2.49.0
PATCH v2 4/7 multilib.conf: Add llvm-project-source recipe to NON_MULTILIB_RECIPES
In reply to Khem Rajllvm sourcebase is large and like gcc, it reuses same source tree to build all recipes using clang+llvm sourcebase
--- meta/conf/multilib.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/multilib.conf +1 -1
@@ -25,4 +25,4 @@ APT_ARGS:append = " -o Dpkg::Options::=--force-confnew -o Dpkg::Options::=--forc # These recipes don't need multilib variants, the ${BPN} PROVDES/RPROVDES # ${MLPREFIX}${BPN} -NON_MULTILIB_RECIPES = "grub grub-efi make-mod-scripts ovmf u-boot gcc-source" +NON_MULTILIB_RECIPES = "grub grub-efi make-mod-scripts ovmf u-boot gcc-source llvm-project-source"
Signature · 1 line
2.49.0
PATCH v2 5/7 kernel-arch.bbclass: Do not use weak assignment for TOOLCHAIN
In reply to Khem RajIf a distro sets TOOLCHAIN with ?= or = then it overrides this too, however, we demand GCC to be in there due to KERNEL_CC etal Make it hard assignment, it can still be overturned via a bbappend in that case it is intentional to use non-gcc compiler for kernel
--- meta/classes-recipe/kernel-arch.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/kernel-arch.bbclass +1 -1
@@ -81,4 +81,4 @@ KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}" KERNEL_OBJCOPY = "${HOST_PREFIX}objcopy ${HOST_OBJCOPY_KERNEL_ARCH}" # Code in package.py can't handle options on KERNEL_STRIP KERNEL_STRIP = "${HOST_PREFIX}strip" -TOOLCHAIN ?= "gcc" +TOOLCHAIN = "gcc"
Signature · 1 line
2.49.0
PATCH v2 6/7 clang: Merge llvm/clang family recipes from meta-clang
In reply to Khem RajThis can ensure that meta-clang does not carry them and can rely on core layer while mesa can use them too.
Fix llvm-config.h to be multilib safe
Omit time stamps in openmp from generated files to improve reproducibility
fix the issue that:
| file /usr/include/llvm/Config/llvm-config.h conflicts between attempted installs of lib32-llvm-dev-20.1.2-r0.core2_32 and llvm-dev-20.1.2-r0.core2_64
--- .../clang/clang-cross-canadian_git.bb | 36 ++ meta/recipes-devtools/clang/clang-cross_git.bb | 39 ++ meta/recipes-devtools/clang/clang-crosssdk_git.bb | 33 ++ ...ind-libunwind-headers-when-LIBCXXABI_LIBU.patch | 60 +++ ...er-rt-support-a-new-embedded-linux-target.patch | 309 +++++++++++++ ...-Simplify-cross-compilation.-Don-t-use-na.patch | 44 ++ ...LibraryInfo-Undefine-libc-functions-if-th.patch | 90 ++++ ...allow-env-override-of-exe-and-libdir-path.patch | 71 +++ ...-clang-driver-Check-sysroot-for-ldso-path.patch | 78 ++++ ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 32 ++ .../0008-clang-Prepend-trailing-to-sysroot.patch | 39 ++ ...inside-the-target-sysroot-for-compiler-ru.patch | 41 ++ ...ang-Define-releative-gcc-installation-dir.patch | 123 +++++ ...pthread-and-ldl-along-with-lunwind-for-st.patch | 35 ++ ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 24 + .../0013-Check-for-atomic-double-intrinsics.patch | 34 ++ ...configure-for-packages-using-find_package.patch | 2 +- ...esource-dir-location-for-cross-toolchains.patch | 50 +++ ...r-Add-dyld-prefix-when-checking-sysroot-f.patch | 79 ++++ .../0017-clang-Use-python3-in-python-scripts.patch | 35 ++ ...Insert-anchor-for-adding-OE-distro-vendor.patch | 167 +++++++ ...-Do-not-use-backtrace-APIs-on-non-glibc-l.patch | 68 +++ ...86-triple-for-non-debian-multiarch-linux-.patch | 28 ++ ...0021-libunwind-Added-unw_backtrace-method.patch | 56 +++ .../0022-lldb-Link-with-libatomic-on-x86.patch | 33 ++ ...023-compiler-rt-Enable-__int128-for-ppc32.patch | 73 +++ ...-Do-not-use-cmake-infra-to-detect-libzstd.patch | 62 +++ ...ler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch | 46 ++ ...-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch | 43 ++ ...s-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch | 81 ++++ ...vm-Add-OE-specific-ABI-triple-for-N32-ABI.patch | 78 ++++ ...d-libunwind.pc.in-and-llvm-config-scripts.patch | 90 ++++ ...py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch | 92 ++++ ...r-rt-Do-not-pass-target-to-clang-compiler.patch | 29 ++ .../clang/clang/0032-Fix-build-on-ppc64-musl.patch | 97 ++++ ...d-a-build-option-to-disable-building-dexp.patch | 85 ++++ ...itter-sort-ClassInfo-lists-by-name-as-we.patch} | 4 +- ...-remove-LLVM_LDFLAGS-from-ldflags-output.patch} | 12 +- ...ot-emit-date-and-time-into-generate-files.patch | 37 ++ .../clang}/spirv-internal-build.patch | 0 .../clang}/spirv-shared-library.patch | 0 meta/recipes-devtools/clang/clang_git.bb | 496 +++++++++++++++++++++ meta/recipes-devtools/clang/common-clang.inc | 24 + meta/recipes-devtools/clang/common-source.inc | 17 + meta/recipes-devtools/clang/common.inc | 83 ++++ .../clang/compiler-rt-sanitizers_git.bb | 139 ++++++ meta/recipes-devtools/clang/compiler-rt_git.bb | 125 ++++++ meta/recipes-devtools/clang/libcxx_git.bb | 119 +++++ meta/recipes-devtools/clang/llvm-project-source.bb | 12 + .../recipes-devtools/clang/llvm-project-source.inc | 99 ++++ .../recipes-devtools/clang/nativesdk-clang-glue.bb | 36 ++ meta/recipes-devtools/clang/openmp_git.bb | 67 +++ .../0007-llvm-allow-env-override-of-exe-path.patch | 36 -- meta/recipes-devtools/llvm/llvm/llvm-config | 54 --- meta/recipes-devtools/llvm/llvm_20.1.2.bb | 233 ---------- 55 files changed, 3642 insertions(+), 333 deletions(-)
meta/recipes-devtools/clang/clang-cross-canadian_git.bb new file +36 -0
@@ -0,0 +1,36 @@ +# Copyright (C) 2014 Khem Raj <[email protected]> +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "Clang/LLVM based C/C++ compiler (cross-canadian for ${TARGET_ARCH} target)" +HOMEPAGE = "http://clang.llvm.org/" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab" +SECTION = "devel" + +PN = "clang-cross-canadian-${TRANSLATED_TARGET_ARCH}" + +require common-clang.inc +require common-source.inc +inherit cross-canadian + +DEPENDS += "nativesdk-clang binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} virtual/nativesdk-cross-binutils virtual/nativesdk-libc" +# We have to point gcc at a sysroot but we don't need to rebuild if this changes +# e.g. we switch between different machines with different tunes. +EXTRA_OECONF_PATHS[vardepsexclude] = "TUNE_PKGARCH" +TARGET_ARCH[vardepsexclude] = "TUNE_ARCH" + +do_install() { + install -d ${D}${bindir} + for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \ + llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \ + llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov + do + ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool + done +} +SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-llvm-ar \ + *-llvm-ranlib *-llvm-nm *-lld *-ld.lld *-llvm-as *-llvm-strip \ + *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \ + *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov" +do_install:append() { + cross_canadian_bindirlinks +}
meta/recipes-devtools/clang/clang-cross_git.bb new file +39 -0
@@ -0,0 +1,39 @@ +# Copyright (C) 2014 Khem Raj <[email protected]> +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "Cross compiler wrappers for LLVM based C/C++ compiler" +HOMEPAGE = "http://clang.llvm.org/" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab" +SECTION = "devel" + +PN = "clang-cross-${TARGET_ARCH}" + +require common-clang.inc +require common-source.inc +inherit cross +DEPENDS += "clang-native virtual/cross-binutils" + +#INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_SYSROOT_STRIP = "1" +do_install() { + install -d ${D}${bindir} + for tool in clang-tidy lld ld.lld llvm-profdata \ + llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \ + llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov + do + ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool + done + install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang + install -m 0755 ${STAGING_BINDIR_NATIVE}/clang ${D}${bindir}/${TARGET_PREFIX}clang++ +} +SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-lld *-ld.lld \ + *-llvm-nm *-llvm-ar *-llvm-as *-llvm-ranlib *-llvm-strip \ + *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \ + *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov" + +SYSROOT_PREPROCESS_FUNCS += "clangcross_sysroot_preprocess" + +clangcross_sysroot_preprocess () { + sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir} +} +PACKAGES = ""
meta/recipes-devtools/clang/clang-crosssdk_git.bb new file +33 -0
@@ -0,0 +1,33 @@ +# Copyright (C) 2014 Khem Raj <[email protected]> +# Released under the MIT license (see COPYING.MIT for the terms) + +SUMMARY = "SDK Cross compiler wrappers for LLVM based C/C++ compiler" +HOMEPAGE = "http://clang.llvm.org/" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0-with-LLVM-exception;md5=0bcd48c3bdfef0c9d9fd17726e4b7dab" +SECTION = "devel" + +PN = "clang-crosssdk-${SDK_SYS}" + +require common-clang.inc +require common-source.inc +inherit crosssdk +DEPENDS += "clang-native nativesdk-clang-glue virtual/nativesdk-cross-binutils virtual/nativesdk-libc" + +do_install() { + install -d ${D}${bindir} + for tool in clang clang++ clang-tidy lld ld.lld llvm-profdata \ + llvm-nm llvm-ar llvm-as llvm-ranlib llvm-strip llvm-objcopy llvm-objdump llvm-readelf \ + llvm-addr2line llvm-dwp llvm-size llvm-strings llvm-cov + do + ln -sf ../$tool ${D}${bindir}/${TARGET_PREFIX}$tool + done +} +SSTATE_SCAN_FILES += "*-clang *-clang++ *-llvm-profdata *-lld *-ld.lld \ + *-llvm-nm *-llvm-ar *-llvm-as *-llvm-ranlib *-llvm-strip \ + *-llvm-objcopy *-llvm-objdump *-llvm-readelf *-llvm-addr2line \ + *-llvm-dwp *-llvm-size *-llvm-strings *-llvm-cov" +sysroot_stage_all () { + sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir} +} + +PACKAGES = ""
meta/recipes-devtools/clang/clang/0001-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch new file +60 -0
60 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0002-compiler-rt-support-a-new-embedded-linux-target.patch new file +309 -0
309 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0003-compiler-rt-Simplify-cross-compilation.-Don-t-use-na.patch new file +44 -0
44 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0004-llvm-TargetLibraryInfo-Undefine-libc-functions-if-th.patch new file +90 -0
90 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0005-llvm-allow-env-override-of-exe-and-libdir-path.patch new file +71 -0
71 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0006-clang-driver-Check-sysroot-for-ldso-path.patch new file +78 -0
78 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0007-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch new file +32 -0
@@ -0,0 +1,32 @@ +From 47dfdd42687c403c044fdb830472d7bedc1b3d39 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Thu, 19 May 2016 21:11:06 -0700 +Subject: [PATCH] clang: Driver/tools.cpp: Add -lssp_nonshared on musl + +musl driver will need to add ssp_nonshared for stack_check_local +on the linker cmdline when using stack protector commands on +compiler cmdline + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + clang/lib/Driver/ToolChains/Gnu.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp +index f56eeda3cb5f..9f7b9e8d42a8 100644 +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -631,6 +631,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, + if (IsIAMCU) + CmdArgs.push_back("-lgloss"); + ++ if (ToolChain.getTriple().isMusl() && ++ (Args.hasArg(options::OPT_fstack_protector) || ++ Args.hasArg(options::OPT_fstack_protector_strong) || ++ Args.hasArg(options::OPT_fstack_protector_all))) { ++ CmdArgs.push_back("-lssp_nonshared"); ++ } + if (IsStatic || IsStaticPIE) + CmdArgs.push_back("--end-group"); + else
meta/recipes-devtools/clang/clang/0008-clang-Prepend-trailing-to-sysroot.patch new file +39 -0
@@ -0,0 +1,39 @@ +From 4b64a243ce69f782964d4841d1079689a62ebdc1 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Thu, 16 Mar 2017 09:02:13 -0700 +Subject: [PATCH] clang: Prepend trailing '/' to sysroot + +This is needed to handle a case where clang +isntall and target sysroot are perilously same + +e.g. + +sysroot = /mnt/clang/recipe-sysroot +clang install = /mnt/clang/recipe-sysroot-native + +in this case it will mistakenly assume that +clang is installed under the same sysroot dir +and it will try to add relative ../lib paths +to linker steps which would then be wrong +since they will become relative to clang +installation and not sysroot + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + clang/lib/Driver/ToolChains/Linux.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index e5a696f63fd0..621fa17e0603 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -216,7 +216,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + Multilibs = GCCInstallation.getMultilibs(); + SelectedMultilibs.assign({GCCInstallation.getMultilib()}); + llvm::Triple::ArchType Arch = Triple.getArch(); +- std::string SysRoot = computeSysRoot(); ++ std::string SysRoot = computeSysRoot() + "/"; + ToolChain::path_list &PPaths = getProgramPaths(); + + Generic_GCC::PushPPaths(PPaths);
meta/recipes-devtools/clang/clang/0009-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch new file +41 -0
41 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0010-clang-Define-releative-gcc-installation-dir.patch new file +123 -0
123 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0011-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 42dc7f1fd3e7bc549f87b9c28fb3024a3970e96d Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Wed, 31 Jul 2019 22:51:39 -0700 +Subject: [PATCH] clang: Add -lpthread and -ldl along with -lunwind for static + linking + +When doing static liking with --unwindlib=libunwind -static we encounter +undefined symbols +libunwind/src/RWMutex.hpp:68: undefined reference to `pthread_rwlock_wrlock' + +and + +libunwind/src/AddressSpace.hpp:597: undefined reference to `dladdr' + +therefore we need to link in libpthread and libdl to fill these symbols + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp +index ae635fb6a180..255e7e0b7150 100644 +--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp ++++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp +@@ -2254,6 +2254,8 @@ static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, + CmdArgs.push_back("-lunwind"); + } else if (LGT == LibGccType::StaticLibGcc) { + CmdArgs.push_back("-l:libunwind.a"); ++ CmdArgs.push_back("-lpthread"); ++ CmdArgs.push_back("-ldl"); + } else if (LGT == LibGccType::SharedLibGcc) { + if (TC.getTriple().isOSCygMing()) + CmdArgs.push_back("-l:libunwind.dll.a");
meta/recipes-devtools/clang/clang/0012-Pass-PYTHON_EXECUTABLE-when-cross-compiling-for-nati.patch new file +24 -0
@@ -0,0 +1,24 @@ +From 0e60706bcddbb9a97ab28df6fba39bf6bd49ab27 Mon Sep 17 00:00:00 2001 +From: Anuj Mittal <[email protected]> +Date: Thu, 26 Dec 2019 12:56:16 -0800 +Subject: [PATCH] Pass PYTHON_EXECUTABLE when cross compiling for native build + +Upstream-Status: Pending +Signed-off-by: Anuj Mittal <[email protected]> +Signed-off-by: Khem Raj <[email protected]> +--- + llvm/cmake/modules/CrossCompile.cmake | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake +index 3b31d3e218a3..a07ab45878fd 100644 +--- a/llvm/cmake/modules/CrossCompile.cmake ++++ b/llvm/cmake/modules/CrossCompile.cmake +@@ -100,6 +100,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}" + -DLLVM_INCLUDE_BENCHMARKS=OFF + -DLLVM_INCLUDE_TESTS=OFF ++ -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}" + ${build_type_flags} ${linker_flag} ${external_clang_dir} ${libc_flags} + ${ARGN} + WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD}
meta/recipes-devtools/clang/clang/0013-Check-for-atomic-double-intrinsics.patch new file +34 -0
@@ -0,0 +1,34 @@ +From f7ef28286dd0adfd384ef55c9039022b4f92f99c Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Mon, 18 Nov 2019 17:00:29 -0800 +Subject: [PATCH] Check for atomic<double> intrinsics + +On some architectures e.g. x86/32bit gcc decides to inline calls to +double atomic variables but clang does not and defers it to libatomic +therefore detect if clang can use built-ins for atomic<double> if not +then link libatomic, this helps building clangd for x86 on linux systems +with gcc runtime + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + llvm/cmake/modules/CheckAtomic.cmake | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake +index f11cadf39ff6..80a18a92956a 100644 +--- a/llvm/cmake/modules/CheckAtomic.cmake ++++ b/llvm/cmake/modules/CheckAtomic.cmake +@@ -30,10 +30,11 @@ function(check_working_cxx_atomics64 varname) + #include <atomic> + #include <cstdint> + std::atomic<uint64_t> x (0); ++std::atomic<double> y (0); + int main() { + uint64_t i = x.load(std::memory_order_relaxed); + (void)i; +- return 0; ++ return int(y); + } + " ${varname}) + set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
meta/recipes-devtools/clang/clang/0014-cmake-Fix-configure-for-packages-using-find_package.patch renamed from meta/recipes-devtools/llvm/llvm/0014-cmake-Fix-configure-for-packages-using-find_package.patch +1 -1
@@ -1,4 +1,4 @@ -From 93141cee493022d9f39dbd1f5f0bb0a1110ac829 Mon Sep 17 00:00:00 2001 +From aae87f7ce9d07ba1c401de8f2981b046321fba3b Mon Sep 17 00:00:00 2001 From: Ovidiu Panait <[email protected]> Date: Fri, 31 Jan 2020 10:56:11 +0200 Subject: [PATCH] cmake: Fix configure for packages using find_package()
meta/recipes-devtools/clang/clang/0015-clang-Fix-resource-dir-location-for-cross-toolchains.patch new file +50 -0
50 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0016-clang-driver-Add-dyld-prefix-when-checking-sysroot-f.patch new file +79 -0
79 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0017-clang-Use-python3-in-python-scripts.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 02ce42db3325d5fab553627dfc73750270c0b665 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Wed, 14 Oct 2020 22:19:57 -0700 +Subject: [PATCH] clang: Use python3 in python scripts + +Some scripts ask for python, but they work fine with python3 +and in OE python symlink is not exposed to build, only python3 is + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + .../find-all-symbols/tool/run-find-all-symbols.py | 2 +- + clang/tools/scan-view/bin/scan-view | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py +index 471dbf8c110b..f98385dc6651 100755 +--- a/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py ++++ b/clang-tools-extra/clang-include-fixer/find-all-symbols/tool/run-find-all-symbols.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + # + # =- run-find-all-symbols.py - Parallel find-all-symbols runner -*- python -*-=# + # +diff --git a/clang/tools/scan-view/bin/scan-view b/clang/tools/scan-view/bin/scan-view +index d01aebb4029a..f3375804654d 100755 +--- a/clang/tools/scan-view/bin/scan-view ++++ b/clang/tools/scan-view/bin/scan-view +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 + + from __future__ import print_function +
meta/recipes-devtools/clang/clang/0018-llvm-clang-Insert-anchor-for-adding-OE-distro-vendor.patch new file +167 -0
167 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0019-compiler-rt-Do-not-use-backtrace-APIs-on-non-glibc-l.patch new file +68 -0
68 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0020-clang-Fix-x86-triple-for-non-debian-multiarch-linux-.patch new file +28 -0
@@ -0,0 +1,28 @@ +From 1ef38e252a55d2cdb00c3b29154387fce02e9911 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Wed, 19 May 2021 17:56:03 -0700 +Subject: [PATCH] clang: Fix x86 triple for non-debian multiarch linux distros + +OpenEmbedded does not hardcode mutli-arch like debian therefore ensure +that it still uses the proper tuple + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + clang/lib/Driver/ToolChains/Linux.cpp | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp +index fb9d433a80be..ee0b4acbcef0 100644 +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp +@@ -728,6 +728,9 @@ void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + GCCInstallation.getTriple().getArch() == llvm::Triple::x86 + ? "i386-linux-gnu" + : TripleStr; ++ // OpenEmbedded does not hardcode the triple to i386-linux-gnu like debian ++ if (GCCInstallation.getTriple().getVendor() == llvm::Triple::OpenEmbedded) ++ DebianMultiarch = TripleStr; + + // Try generic GCC detection first. + if (Generic_GCC::addGCCLibStdCxxIncludePaths(DriverArgs, CC1Args,
meta/recipes-devtools/clang/clang/0021-libunwind-Added-unw_backtrace-method.patch new file +56 -0
56 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0022-lldb-Link-with-libatomic-on-x86.patch new file +33 -0
@@ -0,0 +1,33 @@ +From f4f9b07a41449a0acbe5ea1717bb0e2ceabbfaab Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 8 Feb 2022 01:31:26 -0800 +Subject: [PATCH] lldb: Link with libatomic on x86 + +cmake atomic check is not sufficient for i686 target where clang14 still +generates __atomic_store calls but the check does not entail this +function and happily thinks that compiler can resolve all atomic via intrinsics +on i686, but thats not the case, ideally the check for determining +atomic operation should be make more robust but until then lets ask to +link with libatomic on i686/linux + +Upstream-Status: Inappropriate [OE-Specific] +Signed-off-by: Khem Raj <[email protected]> +--- + lldb/source/Utility/CMakeLists.txt | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lldb/source/Utility/CMakeLists.txt b/lldb/source/Utility/CMakeLists.txt +index 6954a2508ffe..b8bf8c07fefb 100644 +--- a/lldb/source/Utility/CMakeLists.txt ++++ b/lldb/source/Utility/CMakeLists.txt +@@ -19,6 +19,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows") + list(APPEND LLDB_SYSTEM_LIBS ws2_32 rpcrt4) + endif () + ++if (CMAKE_SYSTEM_PROCESSOR MATCHES "i686" AND CMAKE_SYSTEM_NAME MATCHES "Linux") ++ list(APPEND LLDB_SYSTEM_LIBS atomic) ++endif() ++ + if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB ) + list(APPEND LLDB_SYSTEM_LIBS atomic) + endif()
meta/recipes-devtools/clang/clang/0023-compiler-rt-Enable-__int128-for-ppc32.patch new file +73 -0
73 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0024-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch new file +62 -0
62 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0025-compiler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch new file +46 -0
46 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0026-compiler-rt-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch new file +43 -0
43 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0027-ToolChains-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch new file +81 -0
81 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0028-clang-llvm-Add-OE-specific-ABI-triple-for-N32-ABI.patch new file +78 -0
78 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0029-llvm-Add-libunwind.pc.in-and-llvm-config-scripts.patch new file +90 -0
90 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0030-scan-build-py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch new file +92 -0
92 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0031-compiler-rt-Do-not-pass-target-to-clang-compiler.patch new file +29 -0
@@ -0,0 +1,29 @@ +From cbb5bca513714f539c899a123bf5dc17651c9737 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Thu, 13 Mar 2025 00:30:38 -0700 +Subject: [PATCH] compiler-rt: Do not pass --target to clang compiler + +In OE we use <tuple>-clang and <tuple>-clang++ which +should resolve the --target correctly. + +Upstream-Status: Inappropriate [ OE-Specific ] +Signed-off-by: Khem Raj <[email protected]> +--- + compiler-rt/lib/fuzzer/CMakeLists.txt | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt +index 6db24610df1f..692e194c2a98 100644 +--- a/compiler-rt/lib/fuzzer/CMakeLists.txt ++++ b/compiler-rt/lib/fuzzer/CMakeLists.txt +@@ -140,10 +140,6 @@ if(OS_NAME MATCHES "Android|Linux|Fuchsia" AND + COMPILER_RT_LIBCXXABI_PATH) + macro(partially_link_libcxx name dir arch) + get_target_flags_for_arch(${arch} target_cflags) +- if(CMAKE_CXX_COMPILER_ID MATCHES Clang) +- get_compiler_rt_target(${arch} target) +- set(target_cflags --target=${target} ${target_cflags}) +- endif() + set(cxx_${arch}_merge_dir "${CMAKE_CURRENT_BINARY_DIR}/cxx_${arch}_merge.dir") + file(MAKE_DIRECTORY ${cxx_${arch}_merge_dir}) + add_custom_command(TARGET clang_rt.${name}-${arch} POST_BUILD
meta/recipes-devtools/clang/clang/0032-Fix-build-on-ppc64-musl.patch new file +97 -0
97 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0033-clangd-Add-a-build-option-to-disable-building-dexp.patch new file +85 -0
85 lines not on this page · raw message
meta/recipes-devtools/clang/clang/0034-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch renamed from meta/recipes-devtools/llvm/llvm/0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch +2 -2
@@ -1,4 +1,4 @@ -From 001d56983078842c5aa2a1786b84dc429bd46abd Mon Sep 17 00:00:00 2001 +From 59921cb127dcfb2c655b357e8deb95004f3da41f Mon Sep 17 00:00:00 2001 From: Alexander Kanavin <[email protected]> Date: Fri, 27 Nov 2020 10:11:08 +0000 Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well
@@ -14,7 +14,7 @@ Signed-off-by: Alexander Kanavin <[email protected]> 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp -index 7684387d8..d225a3b6d 100644 +index 7684387d80fe..d225a3b6dfa9 100644 --- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp +++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp @@ -361,7 +361,10 @@ public:
meta/recipes-devtools/clang/clang/0035-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch renamed from meta/recipes-devtools/llvm/llvm/0001-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch +5 -7
@@ -1,4 +1,4 @@ -From caff2482f786dd7fd5f1f46f2667f7ed847cb8f8 Mon Sep 17 00:00:00 2001 +From e414f6489e055c981970b7210b941c2a41cc322b Mon Sep 17 00:00:00 2001 From: Dmitry Baryshkov <[email protected]> Date: Wed, 2 Apr 2025 17:05:17 +0300 Subject: [PATCH] llvm-config: remove LLVM_LDFLAGS from --ldflags output
@@ -10,17 +10,18 @@ behaviour in llvm-config since crossscripts are not being used for native builds. As a OE-specific modification ignore LLVM_LDFLAGS for native builds. -Signed-off-by: Dmitry Baryshkov <[email protected]> Upstream-Status: Inappropriate [OE-Specific] +Signed-off-by: Dmitry Baryshkov <[email protected]> +Signed-off-by: Khem Raj <[email protected]> --- llvm/tools/llvm-config/llvm-config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp -index d5b76b1bb6c1..29f7c2eaa419 100644 +index a739f0d8dbea..3120f95fba9d 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp +++ b/llvm/tools/llvm-config/llvm-config.cpp -@@ -529,7 +529,7 @@ int main(int argc, char **argv) { +@@ -542,7 +542,7 @@ int main(int argc, char **argv) { OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; } else if (Arg == "--ldflags") { OS << ((HostTriple.isWindowsMSVCEnvironment()) ? "-LIBPATH:" : "-L")
@@ -29,6 +30,3 @@ index d5b76b1bb6c1..29f7c2eaa419 100644 } else if (Arg == "--system-libs") { PrintSystemLibs = true; } else if (Arg == "--libs") { --- -2.39.5 -
meta/recipes-devtools/clang/clang/0036-openmp-Do-not-emit-date-and-time-into-generate-files.patch new file +37 -0
@@ -0,0 +1,37 @@ +From f79ebc5bc696e8747c79a2277ffcf8d91bdadfd5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Wed, 23 Apr 2025 11:52:48 -0700 +Subject: [PATCH] openmp: Do not emit date and time into generate files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This improves reproducibility where the generated files do not +contain time stamps e.g. + +//·The·file·was·generated·from·en_US.txt·by·message-converter.py·on·Wed·Apr·23·16:00:53·2025.·// +./usr/src/debug/openmp/20.1.2/runtime/src/kmp_i18n_id.inc + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + openmp/runtime/tools/message-converter.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/openmp/runtime/tools/message-converter.py b/openmp/runtime/tools/message-converter.py +index a493d64c1692..0bd5f929fab6 100644 +--- a/openmp/runtime/tools/message-converter.py ++++ b/openmp/runtime/tools/message-converter.py +@@ -188,11 +188,10 @@ def insert_header(f, data, commentChar="//"): + f.write( + "{0} Do not edit this file! {0}\n" + "{0} The file was generated from" +- " {1} by {2} on {3}. {0}\n\n".format( ++ " {1} by {2} {0}\n\n".format( + commentChar, + os.path.basename(data.filename), + os.path.basename(__file__), +- datetime.datetime.now().ctime(), + ) + ) +
meta/recipes-devtools/clang/clang/spirv-internal-build.patch renamed from meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch +0 -0
meta/recipes-devtools/clang/clang/spirv-shared-library.patch renamed from meta/recipes-devtools/llvm/llvm/spirv-shared-library.patch +0 -0
meta/recipes-devtools/clang/clang_git.bb new file +496 -0
496 lines not on this page · raw message
meta/recipes-devtools/clang/common-clang.inc new file +24 -0
@@ -0,0 +1,24 @@ +LLVM_RELEASE = "" +LLVM_DIR = "llvm${LLVM_RELEASE}" + +LLVM_HTTP ?= "https://github.com/llvm" + +MAJOR_VER = "20" +MINOR_VER = "1" +PATCH_VER = "2" +# could be 'rcX' or 'git' or empty ( for release ) +VER_SUFFIX = "" + +PV = "${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}${VER_SUFFIX}" + +LLVMMD5SUM = "8a15a0759ef07f2682d2ba4b893c9afe" +CLANGMD5SUM = "ff42885ed2ab98f1ecb8c1fc41205343" +LLDMD5SUM = "ae7dc7c027b1fa89b5b013d391d3ee2b" +LLDBMD5SUM = "2e0d44968471fcde980034dbb826bea9" + +LLVM_LIBDIR_SUFFIX = "${@d.getVar('baselib').replace('lib', '')}" + +# set the default pigz thread +export PIGZ = "-p ${@oe.utils.cpu_count(at_least=2)}" + +require common.inc
meta/recipes-devtools/clang/common-source.inc new file +17 -0
@@ -0,0 +1,17 @@ +do_fetch() { + : +} +do_fetch[noexec] = "1" +deltask do_unpack +deltask do_patch + +SRC_URI = "" + +do_configure[depends] += "llvm-project-source-${PV}:do_preconfigure" +do_populate_lic[depends] += "llvm-project-source-${PV}:do_unpack" +do_create_spdx[depends] += "llvm-project-source-${PV}:do_preconfigure" +
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/clang/common.inc new file +83 -0
83 lines not on this page · raw message
meta/recipes-devtools/clang/compiler-rt-sanitizers_git.bb new file +139 -0
139 lines not on this page · raw message
meta/recipes-devtools/clang/compiler-rt_git.bb new file +125 -0
125 lines not on this page · raw message
meta/recipes-devtools/clang/libcxx_git.bb new file +119 -0
119 lines not on this page · raw message
meta/recipes-devtools/clang/llvm-project-source.bb new file +12 -0
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/clang/llvm-project-source.inc new file +99 -0
99 lines not on this page · raw message
meta/recipes-devtools/clang/nativesdk-clang-glue.bb new file +36 -0
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/clang/openmp_git.bb new file +67 -0
67 lines not on this page · raw message
meta/recipes-devtools/llvm/llvm/0007-llvm-allow-env-override-of-exe-path.patch deleted +0 -36
Lines of this file are not shown. View the raw message.
meta/recipes-devtools/llvm/llvm/llvm-config deleted +0 -54
54 lines not on this page · raw message
meta/recipes-devtools/llvm/llvm_20.1.2.bb deleted +0 -233
233 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.49.0
Part of the diff is not shown here. View the raw message.
PATCH v2 7/7 maintainers.inc: Add myself as maintainer for clang family of recipes
In reply to Khem Raj--- meta/conf/distro/include/maintainers.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
meta/conf/distro/include/maintainers.inc +10 -1
@@ -97,8 +97,14 @@ RECIPE_MAINTAINER:pn-cantarell-fonts = "Unassigned <[email protected]> RECIPE_MAINTAINER:pn-ccache = "Robert Yang <[email protected]>" RECIPE_MAINTAINER:pn-cdrtools-native = "Yi Zhao <[email protected]>" RECIPE_MAINTAINER:pn-chrpath = "Yi Zhao <[email protected]>" +RECIPE_MAINTAINER:pn-clang = "Khem Raj <[email protected]>" +RECIPE_MAINTAINER:pn-clang-cross-${TARGET_ARCH} = "Khem Raj <[email protected]>" +RECIPE_MAINTAINER:pn-clang-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Khem Raj <[email protected]>" +RECIPE_MAINTAINER:pn-clang-crosssdk-${SDK_SYS} = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-cmake = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-cmake-native = "Unassigned <[email protected]>" +RECIPE_MAINTAINER:pn-compiler-rt = "Khem Raj <[email protected]>" +RECIPE_MAINTAINER:pn-compiler-rt-sanitizers = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-connman = "Changhyeok Bae <[email protected]>" RECIPE_MAINTAINER:pn-connman-conf = "Ross Burton <[email protected]>" RECIPE_MAINTAINER:pn-connman-gnome = "Ross Burton <[email protected]>"
@@ -325,6 +331,7 @@ RECIPE_MAINTAINER:pn-libcgroup = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-libcheck = "Yi Zhao <[email protected]>" RECIPE_MAINTAINER:pn-libcomps = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-libconvert-asn1-perl = "Tim Orling <[email protected]>" +RECIPE_MAINTAINER:pn-libcxx = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-libdaemon = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-libdazzle = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-libdisplay-info = "Hiago De Franco <[email protected]>"
@@ -472,7 +479,7 @@ RECIPE_MAINTAINER:pn-linux-yocto = "Bruce Ashfield <[email protected]>" RECIPE_MAINTAINER:pn-linux-yocto-dev = "Bruce Ashfield <[email protected]>" RECIPE_MAINTAINER:pn-linux-yocto-rt = "Bruce Ashfield <[email protected]>" RECIPE_MAINTAINER:pn-linux-yocto-tiny = "Bruce Ashfield <[email protected]>" -RECIPE_MAINTAINER:pn-llvm = "Khem Raj <[email protected]>" +RECIPE_MAINTAINER:pn-llvm-project-source-20.1.2 = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-logrotate = "Yi Zhao <[email protected]>" RECIPE_MAINTAINER:pn-log4cplus = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-lrzsz = "Anuj Mittal <[email protected]>"
@@ -540,6 +547,7 @@ RECIPE_MAINTAINER:pn-musl-obstack = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-musl-utils = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-nasm = "Richard Purdie <[email protected]>" RECIPE_MAINTAINER:pn-nativesdk-buildtools-perl-dummy = "Richard Purdie <[email protected]>" +RECIPE_MAINTAINER:pn-nativesdk-clang-glue = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-nativesdk-icecc-toolchain = "Joshua Watt <[email protected]>" RECIPE_MAINTAINER:pn-nativesdk-libtool = "Richard Purdie <[email protected]>" RECIPE_MAINTAINER:pn-nativesdk-packagegroup-sdk-host = "Ross Burton <[email protected]>"
@@ -559,6 +567,7 @@ RECIPE_MAINTAINER:pn-npth = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-nss-myhostname = "Anuj Mittal <[email protected]>" RECIPE_MAINTAINER:pn-numactl = "Richard Purdie <[email protected]>" RECIPE_MAINTAINER:pn-ofono = "Ross Burton <[email protected]>" +RECIPE_MAINTAINER:pn-openmp = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-opensbi = "Thomas Perrot <[email protected]>" RECIPE_MAINTAINER:pn-openssh = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-openssl = "Unassigned <[email protected]>"
Signature · 1 line
2.49.0
Quoted 22 lines · Khem Raj
Latest mesa 25+ needs libclang during build for tools like
mesa_clc, we enahnced already existing llvm recipe to build pieces of clang as well, which worked for mesa's needs but broke static clang compiler provided by meta-clang due to newfound conflicts, since clang is now built with llvm recipe from core and also by meta-clang and they compete for same namespace, an attempt to make them co-habit did reveal more difficulties. Clang compiler from meta-clang is not able to use llvm libraries from core since they patch them differently.This patch series therefore brings clang and all recipes that build from llvm sources into core. With this changeset, clang recipes can be removed from meta-clang there is a pull request for that already [1] As an aside, we only build clang once and use it for meta-clang needs and core needs.
With this, meta-clang can depend upon core layer to provide clang and related recipes, meta-clang will still provide the toolchain policies around clang based toolchains. Clang compiler from core, while usable for mesa is not yet fully usable out of box, since we need to workout the multi-toolchain architecture for core, which will be done in next phase after this merge.
Quoted 3 lines
[1] https://github.com/kraj/meta-clang/pull/1088
Signed-off-by Khem Raj <[email protected]>
With the following lines in local.conf I got the RPROVIDES error:
PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
$ DISTRO=poky MACHINE=qemux86-64 bitbake mesa
ERROR: Nothing RPROVIDES 'spirv-llvm-translator' (but /home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'spirv-llvm-translator' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['spirv-llvm-translator']
ERROR: Required build target 'mesa' has no buildable providers.
Missing or unbuildable dependency chain was: ['mesa', 'spirv-llvm-translator']
Quoted 92 lines
---
Changes in v2:
- Address Feedback from Alex and Dmitry.
- Squash similar commits to reduce number of patches.
- Move native toolchain file generation to cmake bbclass instead of
adding new class
- Fix space/tabs indentation inconsistencies
- Reorder the patch sequence to avoid errors in future git bisects
- Fix use before define string problem in one of the patches
- Link to v1: https://lore.kernel.org/r/[email protected]---
Khem Raj (7):
cmake.bbclass: Enhance to emit a native toolchain cmake file toolchain/clang: Remove duplicate RANLIB setting
sstatesig: Handle special case of llvm-project-source shared-workdir multilib.conf: Add llvm-project-source recipe toNON_MULTILIB_RECIPESkernel-arch.bbclass: Do not use weak assignment for TOOLCHAIN
clang: Merge llvm/clang family recipes from meta-clang maintainers.inc: Add myself as maintainer for clang family of recipesmeta/classes-recipe/cmake.bbclass | 58 +++ meta/classes-recipe/kernel-arch.bbclass | 2 +- meta/conf/distro/include/maintainers.inc | 11 +- meta/conf/multilib.conf | 2 +- meta/conf/toolchain/clang.inc | 1 - meta/lib/oe/sstatesig.py | 3 + .../clang/clang-cross-canadian_git.bb | 36 ++ meta/recipes-devtools/clang/clang-cross_git.bb | 39 ++ meta/recipes-devtools/clang/clang-crosssdk_git.bb | 33 ++ ...ind-libunwind-headers-when-LIBCXXABI_LIBU.patch | 60 +++ ...er-rt-support-a-new-embedded-linux-target.patch | 309 +++++++++++++ ...-Simplify-cross-compilation.-Don-t-use-na.patch | 44 ++ ...LibraryInfo-Undefine-libc-functions-if-th.patch | 90 ++++ ...allow-env-override-of-exe-and-libdir-path.patch | 71 +++ ...-clang-driver-Check-sysroot-for-ldso-path.patch | 78 ++++ ...iver-tools.cpp-Add-lssp_nonshared-on-musl.patch | 32 ++ .../0008-clang-Prepend-trailing-to-sysroot.patch | 39 ++ ...inside-the-target-sysroot-for-compiler-ru.patch | 41 ++ ...ang-Define-releative-gcc-installation-dir.patch | 123 +++++ ...pthread-and-ldl-along-with-lunwind-for-st.patch | 35 ++ ..._EXECUTABLE-when-cross-compiling-for-nati.patch | 24 + .../0013-Check-for-atomic-double-intrinsics.patch | 34 ++ ...configure-for-packages-using-find_package.patch | 2 +- ...esource-dir-location-for-cross-toolchains.patch | 50 +++ ...r-Add-dyld-prefix-when-checking-sysroot-f.patch | 79 ++++ .../0017-clang-Use-python3-in-python-scripts.patch | 35 ++ ...Insert-anchor-for-adding-OE-distro-vendor.patch | 167 +++++++ ...-Do-not-use-backtrace-APIs-on-non-glibc-l.patch | 68 +++ ...86-triple-for-non-debian-multiarch-linux-.patch | 28 ++ ...0021-libunwind-Added-unw_backtrace-method.patch | 56 +++ .../0022-lldb-Link-with-libatomic-on-x86.patch | 33 ++ ...023-compiler-rt-Enable-__int128-for-ppc32.patch | 73 +++ ...-Do-not-use-cmake-infra-to-detect-libzstd.patch | 62 +++ ...ler-rt-Fix-stat-struct-s-size-for-O32-ABI.patch | 46 ++ ...-Undef-_TIME_BITS-along-with-_FILE_OFFSET.patch | 43 ++ ...s-Gnu.cpp-ARMLibDirs-search-also-in-lib32.patch | 81 ++++ ...vm-Add-OE-specific-ABI-triple-for-N32-ABI.patch | 78 ++++ ...d-libunwind.pc.in-and-llvm-config-scripts.patch | 90 ++++ ...py-respect-LLVM_LIBDIR_SUFFIX-like-other-.patch | 92 ++++ ...r-rt-Do-not-pass-target-to-clang-compiler.patch | 29 ++ .../clang/clang/0032-Fix-build-on-ppc64-musl.patch | 97 ++++ ...d-a-build-option-to-disable-building-dexp.patch | 85 ++++ ...itter-sort-ClassInfo-lists-by-name-as-we.patch} | 4 +- ...-remove-LLVM_LDFLAGS-from-ldflags-output.patch} | 12 +- ...ot-emit-date-and-time-into-generate-files.patch | 37 ++ .../clang}/spirv-internal-build.patch | 0 .../clang}/spirv-shared-library.patch | 0 meta/recipes-devtools/clang/clang_git.bb | 496 +++++++++++++++++++++ meta/recipes-devtools/clang/common-clang.inc | 24 + meta/recipes-devtools/clang/common-source.inc | 17 + meta/recipes-devtools/clang/common.inc | 83 ++++ .../clang/compiler-rt-sanitizers_git.bb | 139 ++++++ meta/recipes-devtools/clang/compiler-rt_git.bb | 125 ++++++ meta/recipes-devtools/clang/libcxx_git.bb | 119 +++++ meta/recipes-devtools/clang/llvm-project-source.bb | 12 + .../recipes-devtools/clang/llvm-project-source.inc | 99 ++++ .../recipes-devtools/clang/nativesdk-clang-glue.bb | 36 ++ meta/recipes-devtools/clang/openmp_git.bb | 67 +++ .../0007-llvm-allow-env-override-of-exe-path.patch | 36 -- meta/recipes-devtools/llvm/llvm/llvm-config | 54 --- meta/recipes-devtools/llvm/llvm_20.1.2.bb | 233 ---------- 61 files changed, 3715 insertions(+), 337 deletions(-)---
base-commit:c807b703cdfc5dc2c7fe98f55a5d323eb3e1877c
change-id: 20250423-clang-merge-ca9130ae95afBest regards,
Signature · 1 line
Khem Raj <[email protected]>
Signature · 2 lines
With best wishes Dmitry
Quoted 33 lines · Dmitry Baryshkov
Quoted 22 lines · Khem Raj
Latest mesa 25+ needs libclang during build for tools like
mesa_clc, we enahnced already existing llvm recipe to build pieces of clang as well, which worked for mesa's needs but broke static clang compiler provided by meta-clang due to newfound conflicts, since clang is now built with llvm recipe from core and also by meta-clang and they compete for same namespace, an attempt to make them co-habit did reveal more difficulties. Clang compiler from meta-clang is not able to use llvm libraries from core since they patch them differently.This patch series therefore brings clang and all recipes that build from llvm sources into core. With this changeset, clang recipes can be removed from meta-clang there is a pull request for that already [1] As an aside, we only build clang once and use it for meta-clang needs and core needs.
With this, meta-clang can depend upon core layer to provide clang and related recipes, meta-clang will still provide the toolchain policies around clang based toolchains. Clang compiler from core, while usable for mesa is not yet fully usable out of box, since we need to workout the multi-toolchain architecture for core, which will be done in next phase after this merge.
Quoted 3 lines
[1] https://github.com/kraj/meta-clang/pull/1088
Signed-off-by Khem Raj <[email protected]>With the following lines in local.conf I got the RPROVIDES error:
PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
Quoted 7 lines
$ DISTRO=poky MACHINE=qemux86-64 bitbake mesaERROR: Nothing RPROVIDES 'spirv-llvm-translator' (but
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bbRDEPENDS on or otherwise requires it)
NOTE: Runtime target 'spirv-llvm-translator' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['spirv-llvm-translator']
ERROR: Required build target 'mesa' has no buildable providers.
Missing or unbuildable dependency chain was: ['mesa', 'spirv-llvm-translator']
After adding the RPROVIDES for libclc and spirv-llvm-translator, the same command fails with:
ERROR: mesa-2_25.0.2-r0 do_package_qa: QA Issue: File /usr/lib/libMesaOpenCL.so.1.0.0 in package libopencl-mesa contains reference to TMPDIR [buildpaths]
ERROR: mesa-2_25.0.2-r0 do_package_qa: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in: /home/lumag/Projects/RPB/build-rpb/tmp-poky/work/core2-64-poky-linux/mesa/25.0.2/temp/log.do_package_qa.3491435
ERROR: Task (/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bb:do_package_qa) failed with exit code '1'
Signature · 2 lines
With best wishes Dmitry
Quoted 42 lines · Dmitry Baryshkov
Quoted 33 lines · Dmitry Baryshkov
Quoted 22 lines · Khem Raj
Latest mesa 25+ needs libclang during build for tools like
mesa_clc, we enahnced already existing llvm recipe to build pieces of clang as well, which worked for mesa's needs but broke static clang compiler provided by meta-clang due to newfound conflicts, since clang is now built with llvm recipe from core and also by meta-clang and they compete for same namespace, an attempt to make them co-habit did reveal more difficulties. Clang compiler from meta-clang is not able to use llvm libraries from core since they patch them differently.This patch series therefore brings clang and all recipes that build from llvm sources into core. With this changeset, clang recipes can be removed from meta-clang there is a pull request for that already [1] As an aside, we only build clang once and use it for meta-clang needs and core needs.
With this, meta-clang can depend upon core layer to provide clang and related recipes, meta-clang will still provide the toolchain policies around clang based toolchains. Clang compiler from core, while usable for mesa is not yet fully usable out of box, since we need to workout the multi-toolchain architecture for core, which will be done in next phase after this merge.
Quoted 3 lines
[1] https://github.com/kraj/meta-clang/pull/1088
Signed-off-by Khem Raj <[email protected]>With the following lines in local.conf I got the RPROVIDES error:
PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
Quoted 7 lines
$ DISTRO=poky MACHINE=qemux86-64 bitbake mesaERROR: Nothing RPROVIDES 'spirv-llvm-translator' (but
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bbRDEPENDS on or otherwise requires it)
NOTE: Runtime target 'spirv-llvm-translator' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['spirv-llvm-translator']
ERROR: Required build target 'mesa' has no buildable providers.
Missing or unbuildable dependency chain was: ['mesa', 'spirv-llvm-translator']
Quoted 7 lines
After adding the RPROVIDES for libclc and spirv-llvm-translator, the same command fails with:
ERROR: mesa-2_25.0.2-r0
do_package_qa: QA Issue: File/usr/lib/libMesaOpenCL.so.1.0.0in package libopencl-mesa contains reference to TMPDIR [buildpaths]
ERROR: mesa-2_25.0.2-r0do_package_qa: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in:/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/core2-64-poky-linux/mesa/25.0.2/temp/log.do_package_qa.3491435
ERROR: Task (/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bb:do_package_qa) failed with exit code '1'
As with the v1, building with the RPROVIDES and PACKAGECONFIG being set for poky/qemuarm64 fails with:
/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not f ound
Unable to generate bindings: clang diagnosed error: /home/lumag/Projects/RPB/build-rpb/tmp-poky/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/Den seMapInfo.h:17:10: fatal error: 'cassert' file not found
Signature · 2 lines
With best wishes Dmitry
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Dmitry Baryshkov
Quoted 40 lines · Dmitry Baryshkov
Quoted 22 lines · Khem Raj
Latest mesa 25+ needs libclang during build for tools like
mesa_clc, we enahnced already existing llvm recipe to build pieces of clang as well, which worked for mesa's needs but broke static clang compiler provided by meta-clang due to newfound conflicts, since clang is now built with llvm recipe from core and also by meta-clang and they compete for same namespace, an attempt to make them co-habit did reveal more difficulties. Clang compiler from meta-clang is not able to use llvm libraries from core since they patch them differently.This patch series therefore brings clang and all recipes that build from llvm sources into core. With this changeset, clang recipes can be removed from meta-clang there is a pull request for that already [1] As an aside, we only build clang once and use it for meta-clang needs and core needs.
With this, meta-clang can depend upon core layer to provide clang and related recipes, meta-clang will still provide the toolchain policies around clang based toolchains. Clang compiler from core, while usable for mesa is not yet fully usable out of box, since we need to workout the multi-toolchain architecture for core, which will be done in next phase after this merge.
Quoted 3 lines
[1] https://github.com/kraj/meta-clang/pull/1088
Signed-off-by Khem Raj <[email protected]>With the following lines in local.conf I got the RPROVIDES error:
PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
$ DISTRO=poky MACHINE=qemux86-64 bitbake mesaERROR: Nothing RPROVIDES 'spirv-llvm-translator' (but
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bbRDEPENDS on or otherwise requires it)
NOTE: Runtime target 'spirv-llvm-translator' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['spirv-llvm-translator']
ERROR: Required build target 'mesa' has no buildable providers.
Missing or unbuildable dependency chain was: ['mesa', 'spirv-llvm-translator']
Quoted 4 lines
Quoted 4 lines
After adding the RPROVIDES for libclc and spirv-llvm-translator, the same command fails with:
ERROR: mesa-2_25.0.2-r0
do_package_qa: QA Issue: File/usr/lib/libMesaOpenCL.so.1.0.0in package libopencl-mesa contains reference to TMPDIR [buildpaths]
I can see this on qemux86-64 as well.
Quoted 4 lines
Quoted 3 lines
ERROR: mesa-2_25.0.2-r0
do_package_qa: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in:/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/core2-64-poky-linux/mesa/25.0.2/temp/log.do_package_qa.3491435
ERROR: Task (/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bb:do_package_qa) failed with exit code '1'
Quoted 8 lines
As with the v1, building with the RPROVIDES and PACKAGECONFIG being set for poky/qemuarm64 fails with:
/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not f ound
Unable to generate bindings: clang diagnosed error:/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
this header comes from C++ runtime package either libstdc++ or libcxx, do you still see this with v2 series ?
Quoted 58 lines · Khem Raj
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Dmitry Baryshkov
Quoted 40 lines · Dmitry Baryshkov
Quoted 22 lines · Khem Raj
Latest mesa 25+ needs libclang during build for tools like
mesa_clc, we enahnced already existing llvm recipe to build pieces of clang as well, which worked for mesa's needs but broke static clang compiler provided by meta-clang due to newfound conflicts, since clang is now built with llvm recipe from core and also by meta-clang and they compete for same namespace, an attempt to make them co-habit did reveal more difficulties. Clang compiler from meta-clang is not able to use llvm libraries from core since they patch them differently.This patch series therefore brings clang and all recipes that build from llvm sources into core. With this changeset, clang recipes can be removed from meta-clang there is a pull request for that already [1] As an aside, we only build clang once and use it for meta-clang needs and core needs.
With this, meta-clang can depend upon core layer to provide clang and related recipes, meta-clang will still provide the toolchain policies around clang based toolchains. Clang compiler from core, while usable for mesa is not yet fully usable out of box, since we need to workout the multi-toolchain architecture for core, which will be done in next phase after this merge.
Quoted 3 lines
[1] https://github.com/kraj/meta-clang/pull/1088
Signed-off-by Khem Raj <[email protected]>With the following lines in local.conf I got the RPROVIDES error:
PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm " PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
$ DISTRO=poky MACHINE=qemux86-64 bitbake mesaERROR: Nothing RPROVIDES 'spirv-llvm-translator' (but
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/ recipes-graphics/mesa/mesa.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'spirv-llvm-translator' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['spirv-llvm-translator']
ERROR: Required build target 'mesa' has no buildable providers.
Missing or unbuildable dependency chain was: ['mesa', 'spirv-llvm- translator']Quoted 4 lines
Quoted 4 lines
After adding the RPROVIDES for libclc and spirv-llvm-translator, the same command fails with:
ERROR: mesa-2_25.0.2-r0
do_package_qa: QA Issue: File/usr/lib/libMesaOpenCL.so.1.0.0 in package libopencl-mesa contains reference to TMPDIR [buildpaths]I can see this on qemux86-64 as well.
Quoted 7 lines
Quoted 3 lines
ERROR: mesa-2_25.0.2-r0
do_package_qa: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in:/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/core2-64-poky-linux/mesa/25.0.2/temp/ log.do_package_qa.3491435
ERROR: Task (/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-graphics/mesa/mesa.bb:do_package_qa) failed with exit code '1'As with the v1, building with the RPROVIDES and PACKAGECONFIG being set for poky/qemuarm64 fails with:
Quoted 7 lines
Quoted 5 lines
/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not f ound
Unable to generate bindings: clang diagnosed error:/home/lumag/Projects/RPB/build-rpb/tmp-poky/work/cortexa57-poky-linux/mesa/25.0.2/ recipe-sysroot/usr/include/llvm/ADT/Den seMapInfo.h:17:10: fatal error: 'cassert' file not foundthis header comes from C++ runtime package either libstdc++ or libcxx, do you still see this with v2 series ?
Yes, I've been running the test against v2 + RPROVIDES
Signature · 2 lines
With best wishes Dmitry