From: Haseeb Ashraf <haseeb.ash...@siemens.com>

The correct way to configure cmake for cross-compilation includes
setting the LLVM_HOST_TRIPLE as well.

Documentation Ref:
https://github.com/llvm/llvm-project/blob/llvmorg-19.1.6/llvm/docs/HowToCrossCompileLLVM.rst#configuring-cmake

This fixes bug when LLVM is cross-compiled for AAarch64 but it
was getting built with the triple of native build system instead of
the TARGET_SYS (aarch64-oe-linux) in my case.

`No available targets are compatible with triple "x86_64-unknown-linux-gnu"`

Signed-off-by: Haseeb Ashraf <haseeb.ash...@siemens.com>
---
 meta/recipes-devtools/llvm/llvm_19.1.6.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-devtools/llvm/llvm_19.1.6.bb 
b/meta/recipes-devtools/llvm/llvm_19.1.6.bb
index 003676a652..3efd6c40c3 100644
--- a/meta/recipes-devtools/llvm/llvm_19.1.6.bb
+++ b/meta/recipes-devtools/llvm/llvm_19.1.6.bb
@@ -82,12 +82,14 @@ EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
 
 EXTRA_OECMAKE:append:class-target = "\
                   -DCMAKE_CROSSCOMPILING:BOOL=ON \
+                  -DLLVM_HOST_TRIPLE=${TARGET_SYS} \
                   -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
                   -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} 
\
                  "
 
 EXTRA_OECMAKE:append:class-nativesdk = "\
                   -DCMAKE_CROSSCOMPILING:BOOL=ON \
+                  -DLLVM_HOST_TRIPLE=${SDK_SYS} \
                   -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \
                   -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} 
\
                  "
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#210258): 
https://lists.openembedded.org/g/openembedded-core/message/210258
Mute This Topic: https://lists.openembedded.org/mt/110804985/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to