From: "misdoro (Mikhail Doronin) via ruby-core" <ruby-core@...>
Date: 2023-12-20T09:26:19+00:00
Subject: [ruby-core:115817] [Ruby master Feature#19422] Make `--enabled-shared` mandatory on macOS

Issue #19422 has been updated by misdoro (Mikhail Doronin).


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

----------------------------------------
Feature #19422: Make `--enabled-shared` mandatory on macOS
https://bugs.ruby-lang.org/issues/19422#change-105766

* Author: nobu (Nobuyoshi Nakada)
* Status: Open
* Priority: Normal
* Assignee: hsbt (Hiroshi SHIBATA)
----------------------------------------
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
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)'
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/