[llvm] 1892ec0 - [cmake] Use the C++ linker when checking libxml2 (#221970)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 08:05:35 PDT 2026


Author: miyan
Date: 2026-09-16T17:05:28+02:00
New Revision: 1892ec00f9f30f17794cbbe0947ce4a47bead65f

URL: https://github.com/llvm/llvm-project/commit/1892ec00f9f30f17794cbbe0947ce4a47bead65f
DIFF: https://github.com/llvm/llvm-project/commit/1892ec00f9f30f17794cbbe0947ce4a47bead65f.diff

LOG: [cmake] Use the C++ linker when checking libxml2 (#221970)

When libxml2 is built statically with ICU support, its link interface
contains C++ libraries. `check_symbol_exists()` uses the C linker
driver, causing the libxml2 check to fail on unresolved C++ runtime
symbols and incorrectly report that `xmlReadMemory` is unavailable.

This issue was found in https://github.com/microsoft/vcpkg/pull/53727

Added: 
    

Modified: 
    llvm/cmake/config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 1e33b4795fee5..44e027494626b 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -213,7 +213,7 @@ if(LLVM_ENABLE_LIBXML2)
     # library on a 64-bit system which would result in a link-time failure.
     cmake_push_check_state()
     list(APPEND CMAKE_REQUIRED_LIBRARIES LibXml2::LibXml2)
-    check_symbol_exists(xmlReadMemory libxml/xmlreader.h HAVE_LIBXML2)
+    check_cxx_symbol_exists(xmlReadMemory libxml/xmlreader.h HAVE_LIBXML2)
     cmake_pop_check_state()
     if(LLVM_ENABLE_LIBXML2 STREQUAL FORCE_ON AND NOT HAVE_LIBXML2)
       message(FATAL_ERROR "Failed to configure libxml2")
@@ -227,7 +227,7 @@ if(LLVM_ENABLE_LIBXML2)
       list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBXML2_INCLUDE_DIR})
       list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBXML2_STATIC_LIBRARY} ${LIBXML2_STATIC_DEPS})
       list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LIBXML2_DEFINITIONS})
-      check_symbol_exists(xmlReadMemory libxml/xmlreader.h HAVE_LIBXML2_STATIC)
+      check_cxx_symbol_exists(xmlReadMemory libxml/xmlreader.h HAVE_LIBXML2_STATIC)
       cmake_pop_check_state()
       if(NOT HAVE_LIBXML2_STATIC)
         message(FATAL_ERROR "Failed to configure static libxml2, but LLVM_USE_STATIC_LIBXML2=ON")


        


More information about the llvm-commits mailing list