Files
poky/meta/recipes-devtools/clang/libclc_git.bb
Ross Burton f7a6163d4f libclc: do native build of prepare_builtins in a fresh environment
The environment has variables like LDFLAGS set which CMake will try and
use, so until our cmake class is comprehensive enough to nuke those in
the native toolchain file (if that is possible) do a build inside a
clean (apart from PATH) environment to avoid cross-contamination.

As noticed by Khem Raj, this can fail in nativesdk builds as the target
flags will be passed to the native link resulting in failures like:

  Requesting program interpreter: /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-yoesdk-linux/lib/ld-linux-x86-64.so.2

(From OE-Core rev: 0013f501d1de01606b812d930ef6ca842633f551)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-08-07 12:11:15 +01:00

45 lines
1.6 KiB
BlitzBasic

SUMMARY = "Implementation of the library requirements of the OpenCL C programming language."
HOMEPAGE = "https://libclc.llvm.org"
SECTION = "devel"
require common-clang.inc
require common-source.inc
LIC_FILES_CHKSUM = "file://libclc/LICENSE.TXT;md5=7cc795f6cbb2d801d84336b83c8017db"
inherit cmake pkgconfig
# Depend explicitly on clang-native instead of using TOOLCHAIN as the build
# objects from this recipe are build explicitly using clang for GPU targets.
# We could INHIBIT_DEFAULT_DEPS to avoid any other toolchain but then we need
# to wrestle CMake to configure without a toolchain.
DEPENDS += "clang-native spirv-llvm-translator-native"
OECMAKE_SOURCEPATH = "${S}/libclc"
B_NATIVE = "${B}-native"
# Semicolon-separated list of targets to build
LIBCLC_TARGETS ?= "all"
EXTRA_OECMAKE = "-DLIBCLC_TARGETS_TO_BUILD=${LIBCLC_TARGETS}"
EXTRA_OECMAKE:append:class-target = " -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins"
EXTRA_OECMAKE:append:class-nativesdk = " -DPREPARE_BUILTINS=${B_NATIVE}/prepare_builtins"
# Need to build a native prepare_builtins binary in target builds. The easiest
# way to do this is with a second native cmake build tree.
do_build_prepare_builtins() {
env -i PATH=$PATH cmake --fresh -G Ninja \
-S ${OECMAKE_SOURCEPATH} -B ${B_NATIVE} \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${WORKDIR}/toolchain-native.cmake \
-DLIBCLC_TARGETS_TO_BUILD=
cmake --build ${B_NATIVE} --target prepare_builtins
}
do_build_prepare_builtins:class-native() {
:
}
do_configure[prefuncs] += "do_build_prepare_builtins"
FILES:${PN} += "${datadir}/clc"
BBCLASSEXTEND = "native nativesdk"