There are few problems in current recipe:

(1)
Observed that we need to invoke native llvm-config from target
sysroot to list LLVM libraries.

clang already provides crossscripts/llvm-config, which does
the job.

LLVM_TOOLS_BINARY_DIR points to target sysroot but interestingly
does not allow to pick llvm-config from target 
recipe-sysroot/usr/bin/crossscripts/

So removing LLVM_TOOLS_BINARY_DIR from search path for llvm-config.

(2)

Error:
ispc/1.19.0-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-ld:
ispc/1.19.0-r0/recipe-sysroot-native/usr/lib/libclang-cpp.so: undefined 
reference to 
`std::condition_variable::wait(std::unique_lock<std::mutex>&)@GLIBCXX_3.4.30'
error: linker command failed with exit code 1 (use -v to see invocation)

Currently native libraries were being linked to target build wrongly, which 
causes
above failure. After having proper DEPENDS and setting native tools path, it 
fixes the issues.

Drop un-needed RDEPENDS.

Signed-off-by: Naveen Saini <[email protected]>
---
 ...llow-to-pick-llvm-config-from-usr-bi.patch | 41 +++++++++++++++++++
 .../recipes-core/ispc/ispc_1.19.0.bb          | 10 +++--
 2 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 
dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-allow-to-pick-llvm-config-from-usr-bi.patch

diff --git 
a/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-allow-to-pick-llvm-config-from-usr-bi.patch
 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-allow-to-pick-llvm-config-from-usr-bi.patch
new file mode 100644
index 00000000..51152720
--- /dev/null
+++ 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc/0001-CMakeLists.txt-allow-to-pick-llvm-config-from-usr-bi.patch
@@ -0,0 +1,41 @@
+From 51d248d3b470f3fa1cf2ed3f5742851091acb65f Mon Sep 17 00:00:00 2001
+From: Naveen Saini <[email protected]>
+Date: Fri, 12 May 2023 09:10:11 +0800
+Subject: [PATCH] CMakeLists.txt: allow to pick llvm-config from
+ usr/bin/crossscripts/
+
+Problems statement is, we need to invoke native llvm-config from target
+sysroot to list LLVM libraries.
+
+clang already provides crossscripts/llvm-config, which does
+the job.
+
+LLVM_TOOLS_BINARY_DIR points to target sysroot but interestingly
+does not allow to pick llvm-config from target 
recipe-sysroot/usr/bin/crossscripts/
+
+So removing LLVM_TOOLS_BINARY_DIR from search path.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Naveen Saini <[email protected]>
+---
+ cmake/FindLLVM.cmake | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake
+index d0297d5d..90d9fed2 100644
+--- a/cmake/FindLLVM.cmake
++++ b/cmake/FindLLVM.cmake
+@@ -41,8 +41,7 @@ find_package(LLVM REQUIRED CONFIG)
+     set(LLVM_VERSION "LLVM_${LLVM_VERSION_MAJOR}_${LLVM_VERSION_MINOR}")
+     message(STATUS "Found LLVM ${LLVM_VERSION}")
+ 
+-find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config
+-    PATHS ${LLVM_TOOLS_BINARY_DIR} PATH_SUFFIXES bin NO_DEFAULT_PATH)
++find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config)
+     if (NOT LLVM_CONFIG_EXECUTABLE)
+         message(FATAL_ERROR "Failed to find llvm-config")
+     endif()
+-- 
+2.37.3
+
diff --git a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.19.0.bb 
b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.19.0.bb
index db4f31b4..a471b154 100644
--- a/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.19.0.bb
+++ b/dynamic-layers/clang-layer/recipes-core/ispc/ispc_1.19.0.bb
@@ -16,6 +16,7 @@ SRC_URI = 
"git://github.com/ispc/ispc.git;protocol=https;branch=main \
            file://0002-cmake-don-t-build-for-32-bit-targets.patch \
            file://0001-Fix-QA-Issues.patch \
            
file://0001-Add-print-function-to-print-test-run-status-in-ptest.patch \
+           
file://0001-CMakeLists.txt-allow-to-pick-llvm-config-from-usr-bi.patch \
            file://run-ptest \
            "
 
@@ -24,7 +25,7 @@ SRCREV = "ee43967286215a0511c2bc090e604848b4a32bed"
 COMPATIBLE_HOST = '(x86_64).*-linux'
 
 DEPENDS += " clang-native bison-native flex-native"
-RDEPENDS:${PN} += " clang-libllvm clang clang-libclang-cpp"
+DEPENDS:append:class-target = " clang"
 RDEPENDS:${PN}-ptest += " python3-multiprocessing"
 
 YFLAGS='-d -t -v -y 
--file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}'
@@ -54,7 +55,10 @@ EXTRA_OECMAKE += " \
                   -DISPC_WINDOWS_TARGET=OFF  \
                   -DISPC_IOS_TARGET=OFF  \
                   -DISPC_PS4_TARGET=OFF  \
-                  -DSYSROOT_DIR=${STAGING_DIR_NATIVE}  \
+                  -DSYSROOT_DIR=${STAGING_DIR} \
+                  -DCLANG_EXECUTABLE=${STAGING_BINDIR_NATIVE}/clang \
+                  -DCLANGPP_EXECUTABLE=${STAGING_BINDIR_NATIVE}/clang++ \
+                  -DLLVM_DIS_EXECUTABLE=${STAGING_BINDIR_NATIVE}/llvm-dis \
+                  -DLLVM_AS_EXECUTABLE=${STAGING_BINDIR_NATIVE}/llvm-as \
                   "
-
 BBCLASSEXTEND = "native nativesdk"
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7948): 
https://lists.yoctoproject.org/g/meta-intel/message/7948
Mute This Topic: https://lists.yoctoproject.org/mt/98846173/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to