https://github.com/Nerixyz created https://github.com/llvm/llvm-project/pull/209464
On Windows, we used to embed `PYTHONHOME` by default on Windows. In the documentation, we say > This is most useful for developers who simply want to run LLDB after they > build it. Since we use the limited/stable API now, we're less restricted in the Python version, so I think it's less of an issue that LLDB won't find Python. The only configuration where it might cause issues is the debug configuration, since, when installing Python, you usually don't include the debug libraries. Thus, you might not have the debug version (`python3_d.py`) of Python in your PATH. >From 233da1d2e1b26b842b3d0b1872bbaa7992132e7e Mon Sep 17 00:00:00 2001 From: Nerixyz <[email protected]> Date: Tue, 14 Jul 2026 14:26:29 +0200 Subject: [PATCH] [lldb][Windows] Only embed python home in Debug config --- lldb/cmake/modules/LLDBConfig.cmake | 2 +- lldb/docs/resources/build.md | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake index e086aaf5d3632..5f239139bab6f 100644 --- a/lldb/cmake/modules/LLDBConfig.cmake +++ b/lldb/cmake/modules/LLDBConfig.cmake @@ -198,7 +198,7 @@ endif() option(LLDB_ENABLE_DYNAMIC_SCRIPTINTERPRETERS "Build the script interpreter plugins as shared libraries" ${default_enable_dynamic_scriptinterpreters}) if (LLDB_ENABLE_PYTHON) - if(CMAKE_SYSTEM_NAME MATCHES "Windows") + if(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_BUILD_TYPE STREQUAL "Debug") set(default_embed_python_home ON) else() set(default_embed_python_home OFF) diff --git a/lldb/docs/resources/build.md b/lldb/docs/resources/build.md index 2ad5fb8c91bda..759acf9056203 100644 --- a/lldb/docs/resources/build.md +++ b/lldb/docs/resources/build.md @@ -282,15 +282,15 @@ are commonly used on Windows. crash, rather than having to reproduce a failure or use a crash dump. - `PYTHON_HOME` (Required): Path to the folder where the Python distribution is installed. For example, `C:\Python35`. -- `LLDB_EMBED_PYTHON_HOME` (Default=1 on Windows): When this is 1, LLDB will bind - statically to the location specified in the `PYTHON_HOME` CMake variable, - ignoring any value of `PYTHONHOME` set in the environment. This is most - useful for developers who simply want to run LLDB after they build it. If you - wish to move a build of LLDB to a different machine where Python will be in a - different location, setting `LLDB_EMBED_PYTHON_HOME` to 0 will cause - Python to use its default mechanism for finding the python installation at - runtime (looking for installed Pythons, or using the `PYTHONHOME` - environment variable if it is specified). +- `LLDB_EMBED_PYTHON_HOME` (Default=1 on Windows in the Debug configuration): + When this is 1, LLDB will bind statically to the location specified in the + `PYTHON_HOME` CMake variable, ignoring any value of `PYTHONHOME` set in the + environment. This is most useful for developers who simply want to run LLDB + after they build it. If you wish to move a build of LLDB to a different + machine where Python will be in a different location, setting + `LLDB_EMBED_PYTHON_HOME` to 0 will cause Python to use its default mechanism + for finding the python installation at runtime (looking for installed + Pythons, or using the `PYTHONHOME` environment variable if it is specified). Sample command line: _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
