Project

General

Profile

Actions

Feature #19422

open

Make `--enabled-shared` mandatory on macOS

Added by nobu (Nobuyoshi Nakada) almost 2 years ago. Updated 9 months ago.

Status:
Assigned
Target version:
-
[ruby-core:112262]

Description

From the troubles around linker on macOS, I propose --enable-shared option mandatory on macOS.
This patch enables the option by default, and abort if --disable-shared option is given explicitly.

diff --git i/configure.ac w/configure.ac
index 7db2ab5257c..923ac7d1199 100644
--- i/configure.ac
+++ w/configure.ac
@@ -504,6 +504,11 @@ AS_CASE(["$target_os"],
     rb_cv_binary_elf=no
     : ${enable_shared=yes}
     ],
+[darwin*], [
+    AS_IF([test "${enable_shared=yes}" = no], [
+        AC_MSG_ERROR([--disable-shared is not supported on this platform])
+    ])
+],
 [hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)])    # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
 
 AC_PROG_LN_S
@@ -3055,14 +3060,7 @@ AC_SUBST(EXTOBJS)
 			: ${LDFLAGS=""}
 			: ${LIBPATHENV=DYLD_FALLBACK_LIBRARY_PATH}
 			: ${PRELOADENV=DYLD_INSERT_LIBRARIES}
-                        AS_IF([test x"$enable_shared" = xyes], [
-                            # Resolve symbols from libruby.dylib when --enable-shared
-                            EXTDLDFLAGS='$(LIBRUBYARG_SHARED)'
-                        ], [test "x$EXTSTATIC" = x], [
-                            # When building exts as bundles, a mach-o bundle needs to know its loader
-                            # program to bind symbols from the ruby executable
-                            EXTDLDFLAGS="-bundle_loader '\$(BUILTRUBY)'"
-			])
+			EXTDLDFLAGS='$(LIBRUBYARG_SHARED)'
 			rb_cv_dlopen=yes],
         [aix*], [	: ${LDSHARED='$(CC)'}
 			AS_IF([test "$GCC" = yes], [
@@ -3356,10 +3354,6 @@ AS_IF([test x"$cross_compiling" = xyes], [
   AC_SUBST(XRUBY_RUBYLIBDIR)
   AC_SUBST(XRUBY_RUBYHDRDIR)
   PREP='$(arch)-fake.rb'
-  AS_CASE(["$enable_shared:$EXTSTATIC:$target_os"], [no::darwin*], [
-    # darwin target requires miniruby for linking ext bundles
-    PREP="$PREP"' miniruby$(EXEEXT)'
-  ])
   RUNRUBY_COMMAND='$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`'
   RUNRUBY='$(RUNRUBY_COMMAND)'
   XRUBY='$(MINIRUBY)'

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #18912: Build failure with Xcode 14 and macOS 13 (Ventura) BetaClosedhsbt (Hiroshi SHIBATA)Actions
Related to Ruby master - Bug #20004: Release CI is broken with Ruby masterClosedActions

Updated by nobu (Nobuyoshi Nakada) almost 2 years ago

  • Status changed from Open to Assigned
  • Assignee set to mrkn (Kenta Murata)
Actions #2

Updated by naruse (Yui NARUSE) almost 2 years ago

  • Related to Bug #18912: Build failure with Xcode 14 and macOS 13 (Ventura) Beta added

Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago

  • Assignee changed from mrkn (Kenta Murata) to hsbt (Hiroshi SHIBATA)

We discuss this feature in DevMeeting.

We will back to use dynamic_lookup and suppress warnings. But Apple may remove dynamic_lookup completely in the future. We need to look and test Xcode 15 in this summer.

After that, we will decide how to handle this problem.

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

Although the problem seems avoided (or postponed maybe) now, this would still make sense, I think.
Since the ruby 2.6 bundled with macOS is configured to --enable-shared too, there is no reason for us to disable the shared option.

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

We discuss this at dev meeting.

We only change default configuration to --enable-shared for macOS. If user want to use --disable-shared explicitly, we accept it.

Actions #6

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Assigned to Closed

Applied in changeset git|9694445051c4192c8f659529133acab253bd0bc3.


[Feature #19422] Enable shared by default on macOS

Actions #7

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

  • Related to Bug #20004: Release CI is broken with Ruby master added

Updated by hsbt (Hiroshi SHIBATA) about 1 year ago

  • Status changed from Closed to Open

This change affect some environment like GitHub Actions.

Updated by misdoro (Mikhail Doronin) 11 months ago

Should this be tried again? Maybe the failures were caused by the bug #20072 ?

Updated by katei (Yuta Saito) 11 months ago

This feature has been reverted due to #20004 and we are planning to land it again after 3.3 release by https://github.com/ruby/ruby/pull/9090

Actions #11

Updated by hsbt (Hiroshi SHIBATA) 9 months ago

  • Status changed from Open to Assigned
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like1Like0