Allow configure with python on macOS

Message ID 20231226154530.1074-1-simon@pushface.org
State New
Headers
Series Allow configure with python on macOS |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed

Commit Message

Simon Wright Dec. 26, 2023, 3:36 p.m. UTC
  PR29070 reports that a framework build of GDB, configured
--with-python, fails becaue of an inappropriately set value in the
LINKFORSHARED variable.

Python PR36508: python-config --ldflags must not contain LINKFORSHARED
("-Xlinker -export-dynamic" on Linux) (https://bugs.python.org/issue36508)
states (2019-04-16) that the issue is resolved in Python 3.7.

This patch removes the use of LINKFORSHARED.

  * gdb/python/python-config.py: --ldflags doesn't include LINKFORSHARED
---

I've seen this problem in binutils-gdb at gcc-12.1-release,
gcc-13.1-release, gcc-14.1-release; previous fixes were as in PR29070,
but looking at Python PR36508 I think that LINKFORSHARED shouldn't be
there at all.

I haven't run the testsuite, because without this patch there's no
build.

I have GCC copyright assignment 1016382.

 gdb/python/python-config.py | 2 --
 1 file changed, 2 deletions(-)
  

Comments

Simon Marchi Dec. 31, 2023, 11:58 p.m. UTC | #1
On 2023-12-26 10:36, Simon Wright wrote:
> PR29070 reports that a framework build of GDB, configured
> --with-python, fails becaue of an inappropriately set value in the
> LINKFORSHARED variable.
> 
> Python PR36508: python-config --ldflags must not contain LINKFORSHARED
> ("-Xlinker -export-dynamic" on Linux) (https://bugs.python.org/issue36508)
> states (2019-04-16) that the issue is resolved in Python 3.7.
> 
> This patch removes the use of LINKFORSHARED.
> 
>   * gdb/python/python-config.py: --ldflags doesn't include LINKFORSHARED
> ---
> 
> I've seen this problem in binutils-gdb at gcc-12.1-release,
> gcc-13.1-release, gcc-14.1-release; previous fixes were as in PR29070,
> but looking at Python PR36508 I think that LINKFORSHARED shouldn't be
> there at all.
> 
> I haven't run the testsuite, because without this patch there's no
> build.
> 
> I have GCC copyright assignment 1016382.
> 
>  gdb/python/python-config.py | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py
> index e89e0fd40bb..748ced64b75 100644
> --- a/gdb/python/python-config.py
> +++ b/gdb/python/python-config.py
> @@ -77,6 +77,4 @@ for opt in opt_flags:
>                      libs.insert(0, "-L" + getvar("LIBPL"))
>                  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())
>          print(to_unix_path(" ".join(libs)))

I can't say that I understand all the reasons behind this change, but
given that we aim to replicate what upstream Python does, I guess it's
fine.

But, can you help me understand what is the point of having this script
in the GDB repo?  Don't Python distributions normally ship with a
python-config.py?  Why would one use the GDB one over the one shipped
with Python?

Simon
  

Patch

diff --git a/gdb/python/python-config.py b/gdb/python/python-config.py
index e89e0fd40bb..748ced64b75 100644
--- a/gdb/python/python-config.py
+++ b/gdb/python/python-config.py
@@ -77,6 +77,4 @@  for opt in opt_flags:
                     libs.insert(0, "-L" + getvar("LIBPL"))
                 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())
         print(to_unix_path(" ".join(libs)))