From 93f8fa9accb8cb5c83c7ee4d82fc3aa24900dae6 Mon Sep 17 00:00:00 2001 From: Olli Wang Date: Tue, 16 Sep 2025 17:30:23 +0800 Subject: [PATCH] OpenSSL: strip libunwind flags for Clang-based NDK Clang-based Android NDKs bundle unwind support and do not require explicit linking. Passing malformed flags like "-l-l:libunwind.a" caused build failures with ld.lld on NDK r23+. This change removes those flags from configure options to ensure successful builds. --- cmake/projects/OpenSSL/schemes/url_sha1_openssl.cmake.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmake/projects/OpenSSL/schemes/url_sha1_openssl.cmake.in b/cmake/projects/OpenSSL/schemes/url_sha1_openssl.cmake.in index a5f0141914..8a4e58a0de 100644 --- a/cmake/projects/OpenSSL/schemes/url_sha1_openssl.cmake.in +++ b/cmake/projects/OpenSSL/schemes/url_sha1_openssl.cmake.in @@ -104,6 +104,14 @@ if(ANDROID) # * android-ndk-r17-api-24-arm64-v8a-clang-libcxx14 # * android-ndk-r18-api-24-arm64-v8a-clang-libcxx14 list(APPEND configure_opts "-latomic ${CMAKE_EXE_LINKER_FLAGS}") + + # On Clang-based Android NDK toolchains, explicitly linking libunwind is + # unnecessary and results in malformed flags like "-l-l:libunwind.a", which + # break the build. This block strips such flags from configure options to + # ensure successful compilation. + if(CMAKE_C_COMPILER_ID MATCHES "Clang") + string(REPLACE "-l-l:libunwind.a" "" configure_opts "${configure_opts}") + endif() elseif(RASPBERRY_PI) set(configure_opts "linux-generic32") elseif(OPENWRT)