[PATCH v1] Fix wrong build tree in python.exp path on AIX
Aditya Vidyadhar Kamath <[email protected]> Thu, 30 Jul 2026 11:18:27 +0530
| Newsgroups | gmane.comp.gdb.patches |
|---|---|
| Message-ID | <[email protected]> |
From: Aditya Kamath <[email protected]> Python records the path to the export file in LINKFORSHARED sysconfig variable as a build tree relative path: -Wl,bE:Modules/python.exp But this will fail in AIX. When configure runs python-config.py --ldflags to test for libpython, the linker cannot find Modules/python.exp, the link test fails, and GDB is built without Python support. So in this patch we fix the same by replacing the relative path with LIBPL/python.exp (e.g. /opt/freeware/lib64/python3.12/config-3.12/python.exp) on AIX only, where LIBPL is the installed config directory that already contains the file. --- gdb/python/python-config.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py index 061eae1ac64..7190f799b0a 100644 --- a/gdb/python/python-config.py +++ b/gdb/python/python-config.py @@ -78,5 +78,16 @@ for opt in opt_flags: elif os.name == "nt": libs.insert(0, "-L" + os.path.normpath(sys.prefix) + "/libs") if getvar("LINKFORSHARED") is not None: - libs.extend(getvar("LINKFORSHARED").split()) + linkforshared = getvar("LINKFORSHARED") + # On AIX, LINKFORSHARED contains "-Wl,-bE:Modules/python.exp" + # where "Modules/python.exp" is a build-tree-relative path that + # does not exist on installed systems. Replace it with the + # absolute installed path using LIBPL, which always points to + # the pythonX.Y/config-X.Y directory where python.exp is kept. + if sys.platform.startswith("aix") and getvar("LIBPL") is not None: + linkforshared = linkforshared.replace( + "Modules/python.exp", + getvar("LIBPL") + "/python.exp", + ) + libs.extend(linkforshared.split()) print(to_unix_path(" ".join(libs))) -- 2.51.2