Closed5
ld: symbol(s) not found for architecture arm64の調査
M1 macでruby 3.0.3をbuildするとエラーが出るのでその調査を行う。次のメッセージがかなり怪しいのでなぜシンボルがないのか見ていく
ld: symbol(s) not found for architecture arm64
今起きていること
ruby buildに必要なopensslのinstallでコケている。
このときld
(リンク時に)でarm64
用のsymbol解決ができていないみたい。
~/lab/wantedly/wantedly / - ● … k-nasa/bumpup_apis - SIGHUP
:( % rbenv install 3.0.3
Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...
BUILD FAILED (macOS 11.6 using ruby-build 20211203)
Inspect or clean up the working tree at /var/folders/5r/00bxy2351234s9y9w1jpvxtm0000gn/T/ruby-build.20211215110942.27225.K37GmK
Results logged to /var/folders/5r/00bxy2351234s9y9w1jpvxtm0000gn/T/ruby-build.20211215110942.27225.log
Last 10 log lines:
_test_asyncio in asynciotest.o
_bio_s_mempacket_test in ssltestlib.o
_bio_s_always_retry in ssltestlib.o
_create_ssl_ctx_pair in ssltestlib.o
"_test_ulong_eq", referenced from:
_create_ssl_connection in ssltestlib.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/asynciotest] Error 1
make: *** [all] Error 2
解決法
ググったところbinutils
によって入れたranlib
やar
が悪さをしているみたい。
ref: https://naoyat.hatenablog.jp/entry/2012/01/31/033312
自分の環境でこれらのパスを見るとbinutils
経由でar, ranlib
が入ってそう。
:) % which ar
/opt/homebrew/opt/binutils/bin/ar
:) % which ranlib
/opt/homebrew/opt/binutils/bin/ranlib
取り敢えず消したら行けるのでは?ということで消してみる。
brew uninstall binutils
結果問題なく動いちゃった
~/lab/wantedly/wantedly / - ● … k-nasa/bumpup_apis
:) % rbenv install 3.0.3
Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...
Installed openssl-1.1.1l to /Users/asan/.rbenv/versions/3.0.3
Downloading ruby-3.0.3.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.gz
Installing ruby-3.0.3...
ruby-build: using readline from homebrew
Installed ruby-3.0.3 to /Users/asan/.rbenv/versions/3.0.3
なぜbinutilで入れた時に問題が起こるのか解っていないので調べていきたい。
Sonoma (14.1)でruby 3.2.2をインストールしようとした時に同じ現象に出会い、同様の処置でインストール出来ました。
スクラップ、ありがとうございました!
このスクラップは2023/01/28にクローズされました