diff mbox series

libcxx: fix libunwind collision with musl builds

Message ID 20260420222742.3790348-1-sunilkumar.dora@windriver.com
State Accepted, archived
Commit 4fd2c4a99edd40dbacb83ea664e35e139d7ebdab
Headers show
Series libcxx: fix libunwind collision with musl builds | expand

Commit Message

Dora, Sunil Kumar April 20, 2026, 10:27 p.m. UTC
From: Sunil Dora <sunilkumar.dora@windriver.com>

Commit 75409c60 (rust: enable fully static linking with TCLIBC=musl)
used install-unwind for musl builds which also installs libunwind.so
and libunwind.h, causing a file collision with the libunwind recipe.

Only libunwind.a is needed for Rust static musl linking. Since no
other recipe in oe-core builds LLVM libunwind, compile it
unconditionally for musl and use do_install to install only the
static library.

Reported-by: Ross Burton <ross.burton@arm.com>
Suggested-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
---
 meta/recipes-devtools/clang/libcxx_git.bb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/libcxx_git.bb b/meta/recipes-devtools/clang/libcxx_git.bb
index dff063ad8b..d7af23ddbc 100644
--- a/meta/recipes-devtools/clang/libcxx_git.bb
+++ b/meta/recipes-devtools/clang/libcxx_git.bb
@@ -32,9 +32,15 @@  OECMAKE_TARGET_COMPILE = "cxxabi cxx"
 OECMAKE_TARGET_INSTALL = "install-cxxabi install-cxx"
 
 # LLVM libunwind.a needed for static Rust musl builds.
-# GNU libunwind never produces .a on musl so no collision risk.
+# Install only static library to avoid collision with libunwind recipe.
 OECMAKE_TARGET_COMPILE:append:libc-musl = " unwind"
-OECMAKE_TARGET_INSTALL:append:libc-musl = " install-unwind"
+
+do_install:append:libc-musl() {
+    if [ -f ${B}/lib${LLVM_LIBDIR_SUFFIX}/libunwind.a ]; then
+        install -m 0644 ${B}/lib${LLVM_LIBDIR_SUFFIX}/libunwind.a \
+            ${D}${libdir}/libunwind.a
+    fi
+}
 
 CC = "${CCACHE}${HOST_PREFIX}clang ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 CXX = "${CCACHE}${HOST_PREFIX}clang++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"