ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "stanhu (Stan Hu) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "stanhu (Stan Hu)" <noreply@ruby-lang.org>
Subject: [ruby-core:111729] [Ruby master Bug#19005] Ruby interpreter compiled XCode 14 cannot build some native gems on macOS
Date: Sat, 07 Jan 2023 18:28:00 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-101132.20230107182800.13608@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19005.20220915230724.13608@ruby-lang.org

Issue #19005 has been updated by stanhu (Stan Hu).


A possible fix is to squelch this warning via `-no_fixup_chains`:

```diff
diff --git a/configure.ac b/configure.ac
index a2a0c1e387..d653a13bb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3104,7 +3104,7 @@ AS_IF([test "$rb_cv_dlopen" = yes], [
         AC_SUBST(ADDITIONAL_DLDFLAGS, "")
 	for flag in \
 	  "-multiply_defined suppress" \
-	  "-undefined dynamic_lookup" \
+	  "-no_fixup_chains -undefined dynamic_lookup" \
 	  ; do
             test "x${linker_flag}" = x || flag="${linker_flag}`echo ${flag} | tr ' ' ,`"
             RUBY_TRY_LDFLAGS([$flag], [], [flag=])
```

I should note that bazel dropped `-undefined dynamic_lookup` entirely in https://github.com/bazelbuild/bazel/issues/16413, but that will break some gems that are not ready for this.


----------------------------------------
Bug #19005: Ruby interpreter compiled XCode 14 cannot build some native gems on macOS
https://bugs.ruby-lang.org/issues/19005#change-101132

* Author: stanhu (Stan Hu)
* Status: Discussion
* Priority: Normal
* ruby -v: ruby 2.7.6p219 (2022-04-12 revision 44c8bfa984) [arm64-darwin21]
* Backport: 2.7: DONE, 3.0: DONE, 3.1: DONE
----------------------------------------
This seems related to https://bugs.ruby-lang.org/issues/18912 and https://bugs.ruby-lang.org/issues/18981 .

Steps to reproduce:

1. Upgrade to XCode 14.
2. Compile a new Ruby interpreter. I used the version provided in https://github.com/ruby/ruby/pull/6297 with `./configure --prefix=/tmp/ruby --with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline) --enable-shared`.
3. Confirm that `-Wl,-undefined,dynamic_lookup` is no longer available:

```
irb(main):001:0> RbConfig::CONFIG['DLDFLAGS']
=> "-Wl,-multiply_defined,suppress"
```

4. Ran `gem install pg_query` (`gem install ffi-yajl` will also fail).

Error:

```
linking shared-object pg_query/pg_query.bundle
Undefined symbols for architecture arm64:
  "Init_pg_query", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _Init_pg_query)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

I can workaround the problem by doing:

```
gem install pg_query -- --with-ldflags="-Wl,-undefined,dynamic_lookup"
```







-- 
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/

  parent reply	other threads:[~2023-01-07 18:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15 23:07 [ruby-core:109905] [Ruby master Bug#19005] Ruby interpreter compiled XCode 14 cannot build some native gems on macOS stanhu (Stan Hu)
2022-09-16  0:15 ` [ruby-core:109906] " stanhu (Stan Hu)
2022-09-16  1:18 ` [ruby-core:109907] " stanhu (Stan Hu)
2022-09-16  1:39 ` [ruby-core:109908] " stanhu (Stan Hu)
2022-09-16  3:05 ` [ruby-core:109909] " nobu (Nobuyoshi Nakada)
2022-09-16  4:14 ` [ruby-core:109910] " stanhu (Stan Hu)
2022-09-16  4:15 ` [ruby-core:109911] " stanhu (Stan Hu)
2022-09-16  5:19 ` [ruby-core:109912] " stanhu (Stan Hu)
2022-09-16  5:59 ` [ruby-core:109913] " hsbt (Hiroshi SHIBATA)
2022-09-16  6:06 ` [ruby-core:109914] " hsbt (Hiroshi SHIBATA)
2022-09-16 13:19 ` [ruby-core:109919] " stanhu (Stan Hu)
2022-09-17  4:30 ` [ruby-core:109931] " stanhu (Stan Hu)
2022-09-26  9:02 ` [ruby-core:110083] " hsbt (Hiroshi SHIBATA)
2022-10-01  9:12 ` [ruby-core:110159] " nagachika (Tomoyuki Chikanaga)
2022-10-12  9:16 ` [ruby-core:110271] " hsbt (Hiroshi SHIBATA)
2022-11-03 17:46 ` [ruby-core:110590] " Eregon (Benoit Daloze)
2022-11-03 21:43 ` [ruby-core:110598] " kou (Kouhei Sutou)
2022-11-03 21:47 ` [ruby-core:110599] " kou (Kouhei Sutou)
2022-11-03 22:03 ` [ruby-core:110600] " stanhu (Stan Hu)
2022-11-04  3:17 ` [ruby-core:110601] " kou (Kouhei Sutou)
2022-12-24 16:47 ` [ruby-core:111419] " naruse (Yui NARUSE) via ruby-core
2023-01-07  8:19 ` [ruby-core:111713] " stanhu (Stan Hu) via ruby-core
2023-01-07  8:40 ` [ruby-core:111714] " stanhu (Stan Hu) via ruby-core
2023-01-07 18:28 ` stanhu (Stan Hu) via ruby-core [this message]
2023-01-07 18:55 ` [ruby-core:111730] " stanhu (Stan Hu) via ruby-core
2023-01-08  7:50 ` [ruby-core:111732] " nobu (Nobuyoshi Nakada) via ruby-core
2023-01-10  9:20 ` [ruby-core:111769] " stanhu (Stan Hu) via ruby-core
2023-08-23  4:49 ` [ruby-core:114460] " stanhu (Stan Hu) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-101132.20230107182800.13608@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    --cc=ruby-core@ml.ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).