[Lldb-commits] [lldb] [lldb][windows] copy vcpkg runtime dlls (PR #200416)

via lldb-commits lldb-commits at lists.llvm.org
Fri May 29 07:16:16 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

When liblldb is built against vcpkg supplied libraries `(libxml2 and zlib)` on Windows, importing `_lldb` fails with "DLL load failed" because Python 3.8+ loads extensions with `LOAD_LIBRARY_SEARCH_DEFAULT_DIRS`, which excludes `PATH`. 

This patch copies the vcpkg runtime DLLs next to `_lldb.pyd` so the loader finds them.

 This is currently causing https://ci-external.swift.org/job/lldb-windows/job/main/ to fail.

This error can be reproduced at desk with the following CMake flags:
`-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -DLLDB_ENABLE_LIBXML2=ON`

---
Full diff: https://github.com/llvm/llvm-project/pull/200416.diff


1 Files Affected:

- (modified) lldb/bindings/python/CMakeLists.txt (+10) 


``````````diff
diff --git a/lldb/bindings/python/CMakeLists.txt b/lldb/bindings/python/CMakeLists.txt
index 2916d004a389e..b540dcdba8d55 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -157,6 +157,16 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
   create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST}
                           ${lldb_python_target_dir}/native/ ${LIBLLDB_SYMLINK_OUTPUT_FILE})
 
+  if(WIN32 AND DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET)
+    file(GLOB _lldb_vcpkg_runtime_dlls
+      "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/*.dll")
+    if(_lldb_vcpkg_runtime_dlls)
+      add_custom_command(TARGET ${swig_target} POST_BUILD
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different
+          ${_lldb_vcpkg_runtime_dlls} "${lldb_python_target_dir}/native/"
+        COMMENT "Staging vcpkg runtime DLLs next to _lldb.pyd")
+    endif()
+  endif()
 
   if (NOT WIN32)
   add_dependencies(${swig_target} lldb-python-wrapper)

``````````

</details>


https://github.com/llvm/llvm-project/pull/200416


More information about the lldb-commits mailing list