Skip to contentSkip to conversation

libcxx: fix libunwind collision with musl builds

PATCH New [email protected] 1 participant 1 message Apr 20

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libcxx: fix libunwind collision with musl builds

From: Sunil Dora <[email protected]>

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.

---
 meta/recipes-devtools/clang/libcxx_git.bb | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
meta/recipes-devtools/clang/libcxx_git.bb +8 -2
index dff063ad8b..d7af23ddbc 100644
@@ -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}"
Signature · 1 line
2.49.0