Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Aditya Vidyadhar Kamath <akamath996@gmail.com>
To: ulrich.weigand@de.ibm.com, simon.marchi@polymtl.ca, tom@tromey.com
Cc: gdb-patches@sourceware.org, Aditya.Kamath1@ibm.com,
	sangamesh.swamy@in.ibm.com, PRAJWAL.B.MEHENDARKAR@ibm.com
Subject: [PATCH v1] Fix wrong build tree in python.exp path on AIX
Date: Thu, 30 Jul 2026 11:18:27 +0530	[thread overview]
Message-ID: <20260730054826.89712-2-akamath996@gmail.com> (raw)

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


             reply	other threads:[~2026-07-30  5:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  5:48 Aditya Vidyadhar Kamath [this message]
2026-08-21 15:43 ` Tom Tromey
2026-08-24  6:48   ` Aditya Kamath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260730054826.89712-2-akamath996@gmail.com \
    --to=akamath996@gmail.com \
    --cc=Aditya.Kamath1@ibm.com \
    --cc=PRAJWAL.B.MEHENDARKAR@ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.com \
    --cc=ulrich.weigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox