Skip to content

[lldb] Fix deps loading for lldb-python on Windows and Python3.8+ #9370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 11, 2024
18 changes: 18 additions & 0 deletions lldb/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,24 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
COMMENT "Copying Python DLL to LLDB binaries directory.")
endif()

# Since Python3.8 the Windows runtime loads dependent DLLs only from the directory of the binary
# itself (and not Path). Windows has no RPATHs, so we must copy all DLLs that we depend on into
# the Python package.
if (WIN32)
# TARGET_RUNTIME_DLLS is supported in CMake 3.21+
if ("${CMAKE_VERSION}" VERSION_LESS "3.21.0")
if (LLDB_INCLUDE_TESTS)
message(SEND_ERROR
"Your CMake version is ${CMAKE_VERSION}. In order to run LLDB tests "
"on Windows please upgrade to 3.21.0 at least (or disable tests with "
"LLDB_INCLUDE_TESTS=Off)")
endif()
else()
add_custom_command(TARGET ${swig_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy -t ${lldb_python_target_dir} $<TARGET_RUNTIME_DLLS:liblldb>
COMMAND_EXPAND_LISTS)
endif()
endif()

endfunction()

Expand Down