我目前正在尝试使用Rbenv安装Ruby 3.2.0,每次都遇到这个错误。
BUILD FAILED (Ubuntu 22.04 using ruby-build 20230202)
Inspect or clean up the working tree at /tmp/ruby-build.20230202161804.1244.1gO1Ch
Results logged to /tmp/ruby-build.20230202161804.1244.log
Last 10 log lines:
Fix the problems, then remove these directories and try again if you want.
make[1]: Leaving directory '/tmp/ruby-build.20230202161804.1244.1gO1Ch/ruby-3.2.0'
Generating RDoc documentation
/tmp/ruby-build.20230202161804.1244.1gO1Ch/ruby-3.2.0/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby. uh-oh! RDoc had a problem:
cannot load such file -- psych
run with --debug for full backtrace
make: *** [uncommon.mk:598: rdoc] Error 1
似乎这个宝石PSYCH是失踪,但当我运行gem install psych
我收到另一条留言。
Building native extensions. This could take a while...
ERROR: Error installing psych:
ERROR: Failed to build gem native extension.
current directory: /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/psych-5.0.2/ext/psych
/root/.rbenv/versions/3.1.3/bin/ruby -I /root/.rbenv/versions/3.1.3/lib/ruby/3.1.0 extconf.rb
checking for yaml.h... no
yaml.h not found
extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/root/.rbenv/versions/3.1.3/bin/$(RUBY_BASE_NAME)
--with-libyaml-source-dir
--without-libyaml-source-dir
--with-yaml-0.1-dir
--without-yaml-0.1-dir
--with-yaml-0.1-include
--without-yaml-0.1-include=${yaml-0.1-dir}/include
--with-yaml-0.1-lib
--without-yaml-0.1-lib=${yaml-0.1-dir}/lib
--with-yaml-0.1-config
--without-yaml-0.1-config
--with-pkg-config
--without-pkg-config
--with-libyaml-dir
--with-libyaml-include
--without-libyaml-include=${libyaml-dir}/include
--with-libyaml-lib
--without-libyaml-lib=${libyaml-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/psych-5.0.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/gems/psych-5.0.2 for inspection.
Results logged to /root/.rbenv/versions/3.1.3/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/psych-5.0.2/gem_make.out
任何帮助是超级赞赏!谢谢
1条答案
按热度按时间iyr7buue1#
我在Ubuntu 22.04上安装Ruby 3.2.2 with Rbenv时遇到了类似的错误:
在我的例子中,通过安装
libyaml-dev
,然后重新安装Ruby 3.2.2,我能够解决这个错误: