Skip to content

configure --with-openssl-rpath=DIR generates invalid linker option on macOS #110459

Closed

Description

@culler

Bug report

Bug description:

On macOS, running configure with the option --with-openssl-rpath=/x/y/z causes the linker to be invoked with the option:
-rpath=/x/y/z
which causes a linker error when compiling python with Apple's compiler. The form of this option which the Apple linker expects is:
-rpath /x/y/z

The invalid option is generated on line 28077 of the configure script, which reads:
rpath_arg="-Wl,-rpath="
Changing that line to:
rpath_arg="-rpath "
corrects the problem. Presumably that only works with the Apple linker, and the current form is correct when using the gcc linker, rather than the gcc emulation provided by Apple. So this fix should only be applied when using Apple's linker.

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Oct 6, 2023
  2. ronaldoussoren commented on Dec 23, 2023

    @ronaldoussoren
    Contributor

    The easiest fix here is to change rpath_arg to "-Wl,-rpath," (comma instead of equals sign at the end) for macOS.

    The patch below fixes the issue for me. I haven't created a PR yet because I patched both configure.ac and configure manually because my system is not set up correctly to run autoconf ATM (no docker or podman).

    diff --git a/configure b/configure
    index 668a0efd77..06d8b40eb6 100755
    --- a/configure
    +++ b/configure
    @@ -27472,8 +27472,12 @@ then :
     
     else $as_nop
     
    -  rpath_arg="-Wl,-rpath="
    -
    +  if test "$ac_sys_system" = "Darwin"
    +  then
    +      rpath_arg="-Wl,-rpath,"
    +  else
    +      rpath_arg="-Wl,-rpath="
    +  fi
     fi
     
     { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --with-openssl-rpath" >&5
    diff --git a/configure.ac b/configure.ac
    index 020553abd7..8b1f3d2550 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -6807,7 +6807,12 @@ AX_CHECK_OPENSSL([have_openssl=yes],[have_openssl=no])
     AS_VAR_IF([GNULD], [yes], [
       rpath_arg="-Wl,--enable-new-dtags,-rpath="
     ], [
    -  rpath_arg="-Wl,-rpath="
    +  if test "$ac_sys_system" = "Darwin"
    +  then
    +     rpath_arg="-Wl,-rpath,"
    +  else
    +     rpath_arg="-Wl,-rpath="
    +  fi
     ])
     
     AC_MSG_CHECKING([for --with-openssl-rpath])
  3. added a commit that references this issue on Dec 23, 2023
  4. ronaldoussoren commented on Dec 23, 2023

    @ronaldoussoren
    Contributor

    Now with PR after installing docker and runningmake regex-configure.

  5. added a commit that references this issue on Dec 28, 2023
  6. added a commit that references this issue on Dec 28, 2023
  7. added a commit that references this issue on Dec 28, 2023
  8. added a commit that references this issue on Jan 22, 2024
  9. added a commit that references this issue on Feb 11, 2024
  10. added a commit that references this issue on Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

OS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions