Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline

Add a Post-Build Event on Windows to copy the correct custom Python DLL to the LLDB binaries dir

Authored by enlight on Sep 29 2015, 3:00 AM.



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.

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.

Diff Detail


Event Timeline

enlight updated this revision to Diff 35948.Sep 29 2015, 3:00 AM
enlight retitled this revision from to Add a Post-Build Event on Windows to copy the correct custom Python DLL to the LLDB binaries dir.
enlight updated this object.
enlight added reviewers: brucem, zturner.
enlight set the repository for this revision to rL LLVM.
enlight added a subscriber: lldb-commits.
zturner edited edge metadata.Sep 29 2015, 9:04 AM

This looks great. This has always really annoyed me. One thing I want to point out based on your summary of the patch. A user *must* build Python himself, even if he is building a release version of LLDB. You *cannot* use the version that is installed on the system. The reason is because the release python on is compiled with VC 2008, and LLDB is compiled with VC 2013. The two CRTs are ABI incompatible so you'll get heap corruption and other strange errors if you don't build Python yourself.

Patch looks fine though

zturner accepted this revision.Sep 29 2015, 9:04 AM
zturner edited edge metadata.
This revision is now accepted and ready to land.Sep 29 2015, 9:04 AM
This revision was automatically updated to reflect the committed changes.