[Lldb-commits] [lldb] [lldb] Use the right MinGW name for the Python DLLs (PR #201325)

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 3 04:40:24 PDT 2026


https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/201325

In MinGW mode, the Python DLLs have different names than they have in MSVC mode; they are named `libpython<major>.<minor>.dll` (a "lib" prefix and a dot between major and minor) and `libpython3.dll`.

This avoids a warning on startup after
142ad481b6254104a51da7d636ad9e3f30518a32 and total failures to start up after 3eb13f8db39ed42827122489c830c414cb6660e3.

>From 3e1b318df66335cdb1defd5c75c30a3a9fdc5583 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Wed, 3 Jun 2026 14:31:52 +0300
Subject: [PATCH] [lldb] Use the right MinGW name for the Python DLLs

In MinGW mode, the Python DLLs have different names than they have
in MSVC mode; they are named libpython<major>.<minor>.dll (a
"lib" prefix and a dot between major and minor) and libpython3.dll.

This avoids a warning on startup after
142ad481b6254104a51da7d636ad9e3f30518a32 and total failures to start
up after 3eb13f8db39ed42827122489c830c414cb6660e3.
---
 lldb/CMakeLists.txt | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 89d96cfcba9e3..48544505c203b 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -100,12 +100,22 @@ if (LLDB_ENABLE_PYTHON)
   if(WIN32)
     # On Windows, FindPython3 doesn't reliably expose the runtime DLL path,
     # only the import library. CPython's DLL naming is standard, though:
-    # python3.dll for the limited API, otherwise python<MAJOR><MINOR>.dll.
-    if(LLDB_ENABLE_PYTHON_LIMITED_API)
-      set(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME "python${Python3_VERSION_MAJOR}.dll")
+    # python3.dll for the limited API, otherwise python<MAJOR><MINOR>.dll,
+    # and libpython3.dll and libpython<MAJOR>.<MINOR>.dll in MinGW mode.
+    if(MINGW)
+      if(LLDB_ENABLE_PYTHON_LIMITED_API)
+        set(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME "libpython${Python3_VERSION_MAJOR}.dll")
+      else()
+        set(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
+            "libpython${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.dll")
+      endif()
     else()
-      set(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
-          "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.dll")
+      if(LLDB_ENABLE_PYTHON_LIMITED_API)
+        set(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME "python${Python3_VERSION_MAJOR}.dll")
+      else()
+        set(LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
+            "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}.dll")
+      endif()
     endif()
     message(STATUS "LLDB Python runtime DLL: ${LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME} "
                    "(Python3_VERSION=${Python3_VERSION}, "



More information about the lldb-commits mailing list