Author: brucem
Date: Thu Oct 1 02:55:44 2015
New Revision: 248992
URL: http://llvm.org/viewvc/llvm-project?rev=248992&view=rev
Log:
Add a Post-Build Event on Windows to copy the correct custom Python DLL to the
LLDB binaries dir
Summary:
After a developer builds LLDB from source on Windows (assuming they've built it
with Python support enabled), they may be somewhat flustered when it fails to
launch with a cryptic error.
{F890625}
This happens because Windows can't find python27.dll (or python27_d.dll in case
LLDB was built in debug mode). Many developers may have previously installed a
release build of Python 2.7 and will not notice anything is amiss when they run
a release build of LLDB because Windows will load the python27.dll from one of
the system directories or `PATH` (rather than the one that the LLDB build
instructions tell them to build). The issue tends to be more pronounced with
debug builds of LLDB, since fewer developers probably have python27_d.dll
sitting in one of the Windows system directories.
To ensure Windows loads the correct custom built Python DLL when launching LLDB
I've added a post-build event that copies the relevant DLL (based on the LLDB
build configuration) from `PYTHON_HOME` to the directory in which the LLDB
executable is generated.
Patch by Vadim Macagon. Thanks!
Reviewers: brucem, zturner
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D13237
Modified:
lldb/trunk/CMakeLists.txt
Modified: lldb/trunk/CMakeLists.txt
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=248992&r1=248991&r2=248992&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Thu Oct 1 02:55:44 2015
@@ -26,4 +26,17 @@ if (NOT LLDB_DISABLE_PYTHON)
# Ensure we do the python post-build step when building lldb.
add_dependencies(lldb finish_swig)
+
+ # Add a Post-Build Event to copy the custom Python DLL to the lldb
binaries dir so that Windows can find it when launching
+ # lldb.exe or any other executables that were linked with liblldb.
+ if (WIN32 AND NOT "${PYTHON_DLL}" STREQUAL "")
+ # When using the Visual Studio CMake generator the lldb binaries end
up in Release/bin, Debug/bin etc.
+ file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin"
LLDB_BIN_DIR)
+ file(TO_NATIVE_PATH "${PYTHON_DLL}" PYTHON_DLL_NATIVE_PATH)
+ add_custom_command(
+ TARGET finish_swig
+ POST_BUILD
+ COMMAND "${CMAKE_COMMAND}" -E copy ${PYTHON_DLL_NATIVE_PATH}
${LLDB_BIN_DIR}
+ COMMENT "Copying Python DLL to LLDB binaries directory.")
+ endif ()
endif ()
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits