[libcxx-commits] [libcxx] 98c4ea4 - [libc++] Improve diagnostic for libcxxabi missing from the runtimes (#208274)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 14 04:59:44 PDT 2026


Author: Louis Dionne
Date: 2026-07-14T07:59:40-04:00
New Revision: 98c4ea46bd474bff97c99be0800bd7b310185a29

URL: https://github.com/llvm/llvm-project/commit/98c4ea46bd474bff97c99be0800bd7b310185a29
DIFF: https://github.com/llvm/llvm-project/commit/98c4ea46bd474bff97c99be0800bd7b310185a29.diff

LOG: [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 <cxxabi.h> header. Instead, diagnose at
CMake configuration time.

Closes #136480

Added: 
    

Modified: 
    libcxx/cmake/Modules/HandleLibCXXABI.cmake

Removed: 
    


################################################################################
diff  --git a/libcxx/cmake/Modules/HandleLibCXXABI.cmake b/libcxx/cmake/Modules/HandleLibCXXABI.cmake
index 52236f473f35d..f823db8d1ff14 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)


        


More information about the libcxx-commits mailing list