Undefined symbols for architecture arm64
thomasuster opened this issue · 6 comments
Repro steps:
rbenv install 3.2.2
Expected: Should install
Result:
(base) MacBook-Pro-2:~ thomasuster$ rbenv install 3.2.2
To follow progress, use 'tail -f /var/folders/9d/vrcyr_mj18z4fw0tgqqs__dc0000gn/T/ruby-build.20230919153117.40397.log' or pass --verbose
Downloading openssl-3.1.2.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539
Installing openssl-3.1.2...
Installed openssl-3.1.2 to /Users/thomasuster/.rbenv/versions/3.2.2
Downloading ruby-3.2.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.2.tar.gz
Installing ruby-3.2.2...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
BUILD FAILED (macOS 13.5.2 using ruby-build 20230919)
Inspect or clean up the working tree at /var/folders/9d/vrcyr_mj18z4fw0tgqqs__dc0000gn/T/ruby-build.20230919153117.40397.4Dhb9j
Results logged to /var/folders/9d/vrcyr_mj18z4fw0tgqqs__dc0000gn/T/ruby-build.20230919153117.40397.log
Last 10 log lines:
make[1]: Nothing to be done for `srcs'.
generating transdb.h
transdb.h updated
linking miniruby
Undefined symbols for architecture arm64:
"_coroutine_transfer", referenced from:
_fiber_setcontext in cont.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [miniruby] Error 1
Chip: Apple M1 Max
macOS: 13.5.2
Notes:
- This happens on any ruby version I try to install past 2.7.8.
- Repro'd on Ventura 13.5.1 & 13.5.2
- A couple of searched on this issue point to similar
- These similar looking from 2021 & 2022 recommend upgrading binutils. When I do this and add binutils to path I get other strange errors.
To follow progress, use 'tail -f /var/folders/9d/vrcyr_mj18z4fw0tgqqs__dc0000gn/T/ruby-build.20230919154130.35418.log' or pass --verbose
Downloading openssl-3.1.2.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539
Installing openssl-3.1.2...
BUILD FAILED (macOS 13.5.2 using ruby-build 20230919)
Inspect or clean up the working tree at /var/folders/9d/vrcyr_mj18z4fw0tgqqs__dc0000gn/T/ruby-build.20230919154130.35418.DmGplc
Results logged to /var/folders/9d/vrcyr_mj18z4fw0tgqqs__dc0000gn/T/ruby-build.20230919154130.35418.log
Last 10 log lines:
"_test_ptr", referenced from:
_test_x509_files in algorithmid_test-bin-algorithmid_test.o
_test_spki_aid in algorithmid_test-bin-algorithmid_test.o
"_test_true", referenced from:
_test_x509_files in algorithmid_test-bin-algorithmid_test.o
_test_spki_aid in algorithmid_test-bin-algorithmid_test.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [test/algorithmid_test] Error 1
make: *** [build_sw] Error 2
These types of installation failures are almost always due to one or more of these:
- a broken development setup
- installing things using both arm64 and Rosetta or
arch -x86_64
- missing or misconfigured or outdated tools
- setting Ruby compilation settings globally in your shell file
The best way to fix this is to start over with a clean slate. If you want to try small fixes first, you could go through your shell files (such as .zprofile, .zshrc, .zlogin) and remove anything that could affect Ruby installation. I would also run brew doctor
and see if it complains about anything.
If you don't have time to try to fix everything, and if you're willing to pay for a solution that will have you back up and running in 15 minutes, I built a paid product that can safely back up your dev setup, then clean it up in 1 minute. And then it will reinstall a proper and complete Ruby dev environment for you. I launched it about a year and a half ago, and I have over 1700 happy customers so far.
Check it out: https://www.rubyonmac.dev/
@thomasuster On top of what @monfresh already said, binutils
from Homebrew should not be necessary for compiling Ruby. If you had them linked to PATH for some reason, unlink them with brew unlink binutils
.
The compilation failure seems to be in the openssl compilation phase. It could be useful to install OpenSSL via Homebrew and link to that instead of having ruby-build compile openssl every time:
brew install openssl@3.0
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@3.0)" rbenv install 3.2.2
See https://github.com/rbenv/ruby-build/wiki
Finally, this issue belongs to the ruby-build repo and not to rbenv proper. Transferring
Hey, I don't know if it is related, but on macOS 14 I get this compile errors:
Details
rbenv: /Users/marvin/.rbenv/versions/3.2.2 already exists
continue with installation? (y/N) y
/var/folders/p_/k06bmy8s1jb7nqrdwy7r_9qc0000gn/T/ruby-build.20231005132707.91186.ZQa1eS ~/Developer
Downloading openssl-3.1.2.tar.gz...
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringByStandardizingPath]: unrecognized selector sent to instance 0x600001f400c0'
*** First throw call stack:
(
0 CoreFoundation 0x000000018c3708c0 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000018be69eb4 objc_exception_throw + 60
2 CoreFoundation 0x000000018c4223dc -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x000000018c2da9e4 ___forwarding___ + 1572
4 CoreFoundation 0x000000018c2da300 _CF_forwarding_prep_0 + 96
5 Foundation 0x000000018d3af4f0 -[NSProcessInfo arguments] + 188
6 CoreFoundation 0x000000018c3ebff8 __getDefaultArguments_block_invoke + 96
7 libdispatch.dylib 0x000000018c071910 _dispatch_client_callout + 20
8 libdispatch.dylib 0x000000018c07314c _dispatch_once_callout + 32
9 CoreFoundation 0x000000018c3eb994 _addBackstopValuesForIdentifierAndSource + 640
10 CoreFoundation 0x000000018c2a6254 __81-[_CFXPreferences(SourceAdditions) withNamedVolatileSourceForIdentifier:perform:]_block_invoke + 144
11 CoreFoundation 0x000000018c3eb63c -[_CFXPreferences withNamedVolatileSourceForIdentifier:perform:] + 272
12 CoreFoundation 0x000000018c2ac5c4 -[CFPrefsSearchListSource addNamedVolatileSourceForIdentifier:] + 136
13 CoreFoundation 0x000000018c42a8bc __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke.155 + 296
14 CoreFoundation 0x000000018c42a564 -[_CFXPreferences withSearchLists:] + 84
15 CoreFoundation 0x000000018c2a7b18 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 300
16 CoreFoundation 0x000000018c42a710 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 384
17 CoreFoundation 0x000000018c2a7440 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 156
18 CoreFoundation 0x000000018c2a7368 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 112
19 libintl.8.dylib 0x0000000103226574 _libintl_locale_name_default + 72
20 libintl.8.dylib 0x0000000103223f88 libintl_dcigettext + 1892
21 aria2c 0x0000000102ad62dc _GLOBAL__sub_I_UnknownOptionException.cc + 20
22 dyld 0x000000018bec15c8 ___ZZNK5dyld46Loader25findAndRunAllInitializersERNS_12Runti/opt/homebrew/bin/ruby-build: line 329: 91223 Abort trap: 6 aria2c --dry-run --no-conf=true ${ARIA2_OPTS} "$1" 1>&4 2>&1
meStateEENK3$_0clEv_block_invoke + 168
23 dyld 0x000000018bf06920 ___ZNK5dyld313MachOAnalyzer18forEachInitializerER11DiagnosticsRKNS0_15VMAddrConverterEU13block_pointerFvjEPKv_block_invoke.209 + 340
24 dyld 0x000000018bef9c60 ___ZNK5dyld39MachOFile14forEachSectionEU13block_pointerFvRKNS0_11SectionInfoEbRbE_block_invoke + 496
25 dyld 0x000000018bea12fc _ZNK5dyld39MachOFile18forEachLoadCommandER11DiagnosticsU13block_pointerFvPK12load_commandRbE + 300
26 dyld 0x000000018bef8c98 _ZNK5dyld39MachOFile14forEachSectionEU13block_pointerFvRKNS0_11SectionInfoEbRbE + 192
27 dyld 0x000000018bf06434 _ZNK5dyld313MachOAnalyzer18forEachInitializerER11DiagnosticsRKNS0_15VMAddrConverterEU13block_pointerFvjEPKv + 516
28 dyld 0x000000018bebd798 _ZNK5dyld46Loader25findAndRunAllInitializersERNS_12RuntimeStateE + 448
29 dyld -> https://www.openssl.org/source/openssl-3.1.2.tar.gz
0x000000018bec3b14 _ZNK5dyld416JustInTimeLoader15runInitializersERNS_12RuntimeStateE + 36
30 dyld 0x000000018bebdb4c _ZNK5dyld46Loader23runInitializersBottomUpERNS_12RuntimeStateERN5dyld35ArrayIPKS0_EE + 220
31 dyld 0x000000018bec1654 _ZZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateEENK3$_1clEv + 112
32 dyld 0x000000018bebdccc _ZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateE + 304
33 dyld 0x000000018bee2ad4 _ZN5dyld44APIs25runAllInitializersForMainEv + 464
34 dyld 0x000000018bea5f34 _ZN5dyld4L7prepareERNS_4APIsEPKN5dyld313MachOAnalyzerE + 3192
35 dyld 0x000000018bea4f44 start + 1948
)
libc++abi: terminating due to uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringByStandardizingPath]: unrecognized selector sent to instance 0x6000034d40c0'
*** First throw call stack:
(
0 CoreFoundation 0x000000018c3708c0 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x000000018be69eb4 objc_exception_throw + 60
2 CoreFoundation 0x000000018c4223dc -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x000000018c2da9e4 ___forwarding___ + 1572
4 CoreFoundation 0x000000018c2da300 _CF_forwarding_prep_0 + 96
5 Foundation 0x000000018d3af4f0 -[NSProcessInfo arguments] + 188
6 CoreFoundation 0x000000018c3ebff8 __getDefaultArguments_block_invoke + 96
7 libdispatch.dylib 0x000000018c071910 _dispatch_client_callout + 20
8 libdispatch.dylib 0x000000018c07314c _dispatch_once_callout + 32
9 CoreFoundation 0x000000018c3eb994 _addBackstopValuesForIdentifierAndSource + 640
10 CoreFoundation 0x000000018c2a6254 __81-[_CFXPreferences(SourceAdditions) withNamedVolatileSourceForIdentifier:perform:]_block_invoke + 144
11 CoreFoundation 0x000000018c3eb63c -[_CFXPreferences withNamedVolatileSourceForIdentifier:perform:] + 272
12 CoreFoundation 0x000000018c2ac5c4 -[CFPrefsSearchListSource addNamedVolatileSourceForIdentifier:] + 136
13 CoreFoundation 0x000000018c42a8bc __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke.155 + 296
14 CoreFoundation 0x000000018c42a564 -[_CFXPreferences withSearchLists:] + 84
15 CoreFoundation 0x000000018c2a7b18 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 300
16 CoreFoundation 0x000000018c42a710 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 384
17 CoreFoundation 0x000000018c2a7440 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 156
18 CoreFoundation 0x000000018c2a7368 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 112
19 libintl.8.dylib 0x0000000102df6574 _libintl_locale_name_default + 72
20 libintl.8.dylib 0x0000000102df3f88 libintl_dcigettext + 1892
21 aria2c 0x00000001026a62dc _GLOBAL__sub_I_UnknownOptionException.cc + 20
22 dyld 0x000000018bec15c8 ___ZZNK5dyld46Loader25findAndRunAllInitializersERNS_12RuntimeStateEENK3$_0clEv_block_invoke + 168
23 dyld 0x000000018bf06920 ___ZNK5dyld313MachOAnalyzer18forEachInitializerER11DiagnosticsRKNS0_15VMAddrConverterEU13block_pointerFvjEPKv_block_invoke.209 + 340
24 dyld 0x000000018bef9c60 ___ZNK5dyld39MachOFile14forEachSectionEU13block_pointerFvRKNS0_11SectionInfoEbRbE_block_invoke + 496
25 dyld 0x000000018bea12fc _ZNK5dyld39MachOFile18forEachLoadCommandER11DiagnosticsU13block_pointerFvPK12load_commandRbE + 300
26 dyld 0x000000018bef8c98 _ZNK5dyld39MachOFile14forEachSectionEU13block_pointerFvRKNS0_11SectionInfoEbRbE + 192
27 dyld 0x000000018bf06434 _ZNK5dyld313MachOAnalyzer18forEachInitializerER11DiagnosticsRKNS0_15VMAddrConverterEU13block_pointerFvjEPKv + 516
28 dyld 0x000000018bebd798 _ZNK5dyld46Loader25findAndRunAllInitializersERNS_12RuntimeStateE + 448
29 dyld 0x000000018bec3b14 _ZNK5dyld416JustInTimeLoader15runInitializersERNS_12RuntimeStateE + 36
30 dyld 0x000000018bebdb4c _ZNK5dyld46Loader23runInitializersBottomUpERNS_12RuntimeStateERN5dyld35ArrayIPKS0_EE + 220
31 dyld 0x000000018bec1654 _ZZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateEENK3$_1clEv + 112
32 dyld 0x000000018bebdccc _ZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateE + 304
33 dyld 0x000000018bee2ad4 _ZN5dyld44APIs25runAllInitializersForMainEv + 464
34 dyld 0x000000018bea5f34 _ZN5dyld4L7prepareERNS_4APIsEPKN5dyld313MachOAnalyzerE + 3192
35 dyld 0x000000018bea4f44 start + 1948
)
libc++abi: terminating due to uncaught exception of type NSException
/opt/homebrew/bin/ruby-build: line 333: 91224 Abort trap: 6 aria2c --allow-overwrite=true --no-conf=true -o "${out}" ${ARIA2_OPTS} "$1" 1>&4
error: failed to download openssl-3.1.2.tar.gz
BUILD FAILED (macOS 14.0 using ruby-build 20230919)
Nevermind, I didn't see that you use aria2, it is an upstream issue aria2/aria2#2083
@thomasuster If you managed to get further in Ruby compilation since your last report, please share. Since this isn't a bug with ruby-build, I will be inclined to close this issue soon.
I appreciate everyone responses, I wasn't able to fix this issue, but let's go ahead and close it.