From 63866a356e747633c7fa0e9f25c9c01b1e99eec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= Date: Wed, 17 Dec 2025 14:27:22 +0100 Subject: [PATCH] devel::llvm: fix cross compilation When cross-compiling llvm, the devel::llvm-host-tools package is built with the host-compat-toolchain. In contrast to other packages, the llvm tools are still linked shared. That is, libLLVM.so and friends need to be available when executing these tools. Fortunately, the llvm build system sets a proper RPATH so that we just have to install the shared libraries. --- recipes/devel/llvm.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/recipes/devel/llvm.yaml b/recipes/devel/llvm.yaml index e584341..c41ebc4 100644 --- a/recipes/devel/llvm.yaml +++ b/recipes/devel/llvm.yaml @@ -68,14 +68,22 @@ multiPackage: -DLIBCLANG_BUILD_STATIC=ON \ -DLLVM_ENABLE_ZSTD=OFF \ -DLLVM_ENABLE_BINDINGS=OFF \ - -DLLVM_BUILD_LLVM_DYLIB==ON \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ -DLLVM_LINK_LLVM_DYLIB=ON # Need to copy extra host tools that are not installed by default. cp build/bin/{clang-tidy-confusable-chars-gen,llvm-lit} install/usr/bin/ packageScript: | - cmakePackageBin + # We must force shared libs installation. The host-tools package + # is compiled with the host-compat toolchain which assumes static + # linking by default. + INSTALL_SHARED=1 + + # Package everything. The binaries will link dynamically with + # libclang and friends. Luckily, the RPATH is set appropriately... + cmakePackageTgt + # Get rid of debug symbols. This package is really just to cross # compile the real llvm. find -type d -name .debug | xargs /bin/rm -rf