From 98c4ea46bd474bff97c99be0800bd7b310185a29 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 14 Jul 2026 07:59:40 -0400 Subject: [PATCH] [libc++] Improve diagnostic for libcxxabi missing from the runtimes (#208274) When libc++ is configured to use libc++abi as an ABI library but libcxxabi is not part of the runtimes, we'd end up with a confusing build error about a missing header. Instead, diagnose at CMake configuration time. Closes #136480 --- libcxx/cmake/Modules/HandleLibCXXABI.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake index 52236f473f35..f823db8d1ff1 100644 --- a/libcxx/cmake/Modules/HandleLibCXXABI.cmake +++ b/libcxx/cmake/Modules/HandleLibCXXABI.cmake @@ -148,6 +148,13 @@ elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi") add_library(libcxx-abi-static-objects ALIAS cxxabi_static_objects) endif() + if (NOT TARGET cxxabi_static AND NOT TARGET cxxabi_shared + AND NOT TARGET cxxabi_static_objects AND NOT TARGET cxxabi_shared_objects) + message(FATAL_ERROR "Can't find any libc++abi target but LIBCXX_CXX_ABI is set to libcxxabi, " + "did you forget to include libcxxabi in LLVM_ENABLE_RUNTIMES, or did you " + "intend to use LIBCXX_CXX_ABI=system-libcxxabi instead?") + endif() + # Link against a system-provided libc++abi elseif ("${LIBCXX_CXX_ABI}" STREQUAL "system-libcxxabi") if(NOT LIBCXX_CXX_ABI_INCLUDE_PATHS)