Ruby 3.3.0のインストールでBUILD FAILEDした時にやったこと
環境
インテルMac(Sonoma 14.2.1)
rbenv 1.2.0
結論
Command Line Tools for Xcodeが古かったことが原因。アップデートしたら成功した。
エラー
code: zsh
$ rbenv install 3.3.0
ruby-build: using openssl@3 from homebrew
==> Downloading ruby-3.3.0.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.0M 100 21.0M 0 0 37.4M 0 --:--:-- --:--:-- --:--:-- 37.3M
==> Installing ruby-3.3.0...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
-> ./configure "--prefix=$HOME/.rbenv/versions/3.3.0" --with-openssl-dir=/usr/local/opt/openssl@3 --enable-shared --with-readline-dir=/usr/local/opt/readline --with-libyaml-dir=/usr/local/opt/libyaml --with-gmp-dir=/usr/local/opt/gmp --with-ext=openssl,psych,+
-> make -j 8
BUILD FAILED (macOS 14.2.1 on x86_64 using ruby-build 20231225)
You can inspect the build directory at /var/folders/8m/4f2s32l52bj2svljhddrcxnh0000gn/T/ruby-build.20240128130457.54891.gUPE8G
See the full build log at /var/folders/8m/4f2s32l52bj2svljhddrcxnh0000gn/T/ruby-build.20240128130457.54891.log
ログ/var/folders/8m/4f2s32l52bj2svljhddrcxnh0000gn/T/ruby-build.20240128130457.54891.log
use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'とあるけど何が原因かわからない
code:zsh
...省略...
In file included from debug.c:27:
./vm_callinfo.h:179:9: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
rp(ci);
^
./internal.h:93:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING) ^
In file included from debug.c:27:
./vm_callinfo.h:221:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
if (debug) rp(ci);
^
./internal.h:93:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING) ^
2 errors generated.
compiling dir.c
compiling dln_find.c
make: *** Waiting for unfinished jobs....
In file included from compile.c:40:
./vm_callinfo.h:179:9: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
rp(ci);
^
./internal.h:93:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING) ^
In file included from compile.c:40:
./vm_callinfo.h:221:16: error: use of undeclared identifier 'RUBY_FUNCTION_NAME_STRING'
if (debug) rp(ci);
^
./internal.h:93:72: note: expanded from macro 'rp'
#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING) ^
2 errors generated.
external command failed with status 2
やったこと
$ brew list
openssl@3、readline、libyaml、gmpがインストール済みであることを確認
$ xcode-select --install
code:zsh
$ xcode-select --install
xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates
インストール済みだから、システム設定でソフトウェアアップデート実施するかsoftwareupdateコマンドでアップデートしてねとのこと
$ softwareupdate --listでアップデート対象を確認
code:zsh
$ softwareupdate --list
Software Update Tool
Finding available software
Software Update found the following new or updated software:
* Label: Command Line Tools for Xcode-15.1
Title: Command Line Tools for Xcode, Version: 15.1, Size: 709018KiB, Recommended: YES
Command Line Tools for Xcodeをアップデート
code:zsh
$ softwareupdate -i "Command Line Tools for Xcode-15.1"
Software Update Tool
Finding available software
Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode
Done with Command Line Tools for Xcode
Done.
再挑戦
code:zsh
$ rbenv install 3.3.0
ruby-build: using openssl@3 from homebrew
==> Downloading ruby-3.3.0.tar.gz...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 21.0M 100 21.0M 0 0 21.5M 0 --:--:-- --:--:-- --:--:-- 21.4M
==> Installing ruby-3.3.0...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
ruby-build: using gmp from homebrew
-> ./configure "--prefix=$HOME/.rbenv/versions/3.3.0" --with-openssl-dir=/usr/local/opt/openssl@3 --enable-shared --with-readline-dir=/usr/local/opt/readline --with-libyaml-dir=/usr/local/opt/libyaml --with-gmp-dir=/usr/local/opt/gmp --with-ext=openssl,psych,+
-> make -j 8
-> make install
==> Installed ruby-3.3.0 to /Users/user/.rbenv/versions/3.3.0
🎉