Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
culler opened this issue Oct 6, 2023 · 2 comments
Closed
Assignees
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error

Comments

@culler
Copy link

culler commented Oct 6, 2023

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

@culler culler added the type-bug An unexpected behavior, bug, or error label Oct 6, 2023
@Eclips4 Eclips4 added OS-mac build The build process and cross-build labels Oct 6, 2023
@ronaldoussoren
Copy link
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])

ronaldoussoren added a commit to ronaldoussoren/cpython that referenced this issue Dec 23, 2023
On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
@ronaldoussoren
Copy link
Contributor

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

@ronaldoussoren ronaldoussoren self-assigned this Dec 23, 2023
ronaldoussoren added a commit that referenced this issue Dec 28, 2023
* gh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 28, 2023
…nGH-113441)

* pythongh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
(cherry picked from commit cc13eab)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
ronaldoussoren added a commit that referenced this issue Dec 28, 2023
…13441) (#113535)

gh-110459: Make sure --with-openssl-rpath works on macOS (GH-113441)

* gh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
(cherry picked from commit cc13eab)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
kulikjak pushed a commit to kulikjak/cpython that referenced this issue Jan 22, 2024
…n#113441)

* pythongh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…n#113441)

* pythongh-110459: Make sure --with-openssl-rpath works on macOS

On macOS the `-rpath` linker flag is spelled differently
than on on platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-mac type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants