-
Notifications
You must be signed in to change notification settings - Fork 185
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
dlopen(myext.bundle, 0x0009): symbol not found in flat namespace (_some_symbol) (RuntimeError) on XCode 14.2 #3390
Comments
FWIW it seems CRuby still uses
And from https://github.com/ruby/ruby/pull/6193/files We could try to link extensions to |
From ruby/zlib#75 (comment), |
Another idea was maybe it's worth asking GitHub to provide XCode 14.3 on macos-12. |
From ruby/zlib#75
Affects: TruffleRuby >= 24.0
There is a bug in XCode 14.2 that even though TruffleRuby passes RTLD_LAZY to dlopen() and
-Wl,-undefined,dynamic_lookup
when linking,the new linker in XCode 14.2 ignores those and resolves symbols eagerly.
Which seems nothing less than a violation of the POSIX semantics of dlopen() with RTLD_LAZY and yet another breaking change for macOS's native toolchain.
And the macOS man page for dlopen doesn't even bother mentioning this issue.
This is thankfully fixed in XCode 14.3+, so it's really only an issue with XCode 14.2.
This caused similar issues in CRuby and CPython, links at ruby/zlib#75 (comment), notably https://bugs.ruby-lang.org/issues/18912 and https://bugs.ruby-lang.org/issues/19005.
Possible workarounds:
-no_fixup_chains
but this flag seems to not exist on older versions of XCode so it seems inconvenient. BTW getting the XCode version seems a bit messy.MACOSX_DEPLOYMENT_TARGET=11.0
this likely disables the fixup chains stuff and 11.0=Big Sur the currently minimum supported version. But it might disable using newer macOS stuff, so it seems not ideal to set that when installing extensions.-bundle_loader
which seems to be what CRuby did Link ext bundles with bundle loader option for newer ld64 of Ventura ruby/ruby#6193. But macOS linker warnings in macOS ventura python/cpython#97524 makes it sound like all symbols need to be resolved and that's not the case.have_func "foo"
and so prevents extensions to detect if a function is available. Maybe it could be worked around by using a different native lib forhave_func
but it sounds hacky.So my current plan instead is to rely on users using a non-broken version of XCode, i.e., not XCode 14.2.
It's not ideal because GitHub Actions
macos-latest
=macos-12
currently actually uses XCode 14.2 :/Either
macos-13
ormacos-11
works fine.The text was updated successfully, but these errors were encountered: