Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH v1] Fix wrong build tree in python.exp path on AIX
@ 2026-07-30  5:48 Aditya Vidyadhar Kamath
  2026-08-21 15:43 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Vidyadhar Kamath @ 2026-07-30  5:48 UTC (permalink / raw)
  To: ulrich.weigand, simon.marchi, tom
  Cc: gdb-patches, Aditya.Kamath1, sangamesh.swamy, PRAJWAL.B.MEHENDARKAR

From: Aditya Kamath <Aditya.Kamath1@ibm.com>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-24  6:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-30  5:48 [PATCH v1] Fix wrong build tree in python.exp path on AIX Aditya Vidyadhar Kamath
2026-08-21 15:43 ` Tom Tromey
2026-08-24  6:48   ` Aditya Kamath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox