[Lldb-commits] [lldb] [lldb][windows] print an error if python.dll is not in the DLL search path (PR #164893)
Martin Storsjö via lldb-commits
lldb-commits at lists.llvm.org
Sat Oct 25 13:19:55 PDT 2025
mstorsjo wrote:
First replying to the older messages:
> I'm confused as to where this variable comes from in the first place, because it's not documented and now that I did a clean build, it's gone.
> @mstorsjo my understanding is that `Python3_RUNTIME_LIBRARY` should always be set to something (according to https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindPython/Support.cmake#L3868-3874) and that it's an undocumented public variable.
>
> I see 2 solutions:
>
> * We either rely on this public variable even though it's not documented.
> * We try to guess the Python shared library based on the environment: `if MSVC "python310.dll" else "lib python3.10.dll"`. This is only needed on Windows anyways (for now).
>
> I prefer the first solution because it defers the logic to CMake, but you are saying that `Python3_RUNTIME_LIBRARY` and `_ Python3_RUNTIME_LIBRARY_RELEASE` and `_ Python3_RUNTIME_LIBRARY_DEBUG` are empty when you run it?
I don't see alternative 1 as an option, as you yourself also said that it wasn't set for you after doing a clean build?
---
Anyway, the current suggestion of using `get_target_property(_Python3_LIB_PATH Python3::Python IMPORTED_LIBRARY_LOCATION)` doesn't seem to work for me - I'm getting these warnings:
```
CMake Error at /home/martin/code/llvm-project/lldb/CMakeLists.txt:90 (get_target_property):
get_target_property() called with non-existent target "Python3::Python".
```
It's probably relevant to say, that in my cross compiling setup, I'm not letting `FindPython` do all the digging of locating Python, as that's not necessarily very workable in a cross compile. What I do, is that I configure the LLVM/LLDB build with these parameters:
```
-DLLDB_ENABLE_PYTHON=ON
-DPYTHON_HOME=$PREFIX/python
-DLLDB_PYTHON_HOME=../python
# Relative to the lldb install root
-DLLDB_PYTHON_RELATIVE_PATH=$PYTHON_RELATIVE_PATH # e.g. python/lib/python3.11/site-packages
# Relative to LLDB_PYTHON_HOME
-DLLDB_PYTHON_EXE_RELATIVE_PATH=bin/python3.exe
-DLLDB_PYTHON_EXT_SUFFIX=$EXT_SUFFIX # e.g. .cp311-mingw_x86_64_clang.pyd
-DPython3_INCLUDE_DIRS=$PYTHON_INCLUDE_DIR # e.g. /home/martin/clang-cross-x86_64/python/include/python3.11
-DPython3_LIBRARIES=$PYTHON_LIB # e.g. /home/martin/clang-cross-x86_64/python/lib/libpython3.11.dll.a
```
https://github.com/llvm/llvm-project/pull/164893
More information about the lldb-commits
mailing list