Ruby 3.3.0のインストールがasdfで失敗する
概要
asdf マネージャーを使用して Mac に Ruby 3.3.0 バージョンをインストールしようとすると失敗します。 精神: 設定できませんでした。インストールされません。ビルドに失敗しました (ruby-build 20240119 を使用した arm64 上の macOS 14.2.1)
エラー:
==> Installing ruby-3.3.0...
ruby-build: using gmp from homebrew
-> ./configure "--prefix=$HOME/.asdf/installs/ruby/3.3.0" --with-openssl-dir=/opt/homebrew/opt/openssl@3 --enable-shared --with-gmp-dir=/opt/homebrew/opt/gmp --with-ext=openssl,psych,+
-> make -j 10
*** Following extensions are not compiled:
psych:
Could not be configured. It will not be installed.
Check /var/folders/9d/t29qflyd5jx0c7pn5mdpn2040000gn/T/ruby-build.20240120105143.11952.M2QG45/ruby-3.3.0/ext/psych/mkmf.log for more details.
BUILD FAILED (macOS 14.2.1 on arm64 using ruby-build 20240119)
使っています
asdf version
v0.14.0-ccdd47d
brew -v
Homebrew 4.2.4
マック Darwin カーネル バージョン 23.2.0: 2023 年 11 月 15 日水 21:53:18 PST。ルート:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
詳細:
~$: cat /var/folders/9d/t29qflyd5jx0c7pn5mdpn2040000gn/T/ruby-build.20240120105143.11952.M2QG45/ruby-3.3.0/ext/psych/mkmf.log
~$:
pkg_config: checking for pkg-config for yaml-0.1... -------------------- not found
package configuration for yaml-0.1 is not found
--------------------
find_header: checking for yaml.h... -------------------- no
DYLD_LIBRARY_PATH=.:../.. "clang -o conftest -I../../.ext/include/arm64-darwin23 -I../.././include -I../.././ext/psych -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -fno-common -pipe conftest.c -L. -L../.. -L. -fstack-protector-strong -L/opt/homebrew/opt/gmp/lib -arch arm64 -lruby.3.3-static -framework CoreFoundation -ldl -lobjc -lpthread -lpthread "
ld: warning: ignoring duplicate libraries: '-lpthread'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
DYLD_LIBRARY_PATH=.:../.. "clang -I../../.ext/include/arm64-darwin23 -I../.././include -I../.././ext/psych -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -fno-common -pipe -arch arm64 -c conftest.c"
conftest.c:3:10: fatal error: 'yaml.h' file not found
#include <yaml.h>
^~~~~~~~
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <yaml.h>
/* end */
--------------------
解決策
このエラーは、yaml.h が見つからないことを示しています。 libyamlはインストールされていますか?このリンクからこれを試すことができます: https://github.com/rbenv/ruby-build/Discussions/2012
brew reinstall libyaml
gem install psych -- --with-libyaml-dir=$(brew --prefix libyaml)
export RUBY_CONFIGURE_OPTS=--with-libyaml-dir=$(brew --prefix libyaml)
asdf install ruby 3.3.0