LoginSignup
0
0

EC2インストールにrbenv install -v 3.3.0を実行して失敗した

Posted at

問題

EC2インスタンスにrbenv install -v 3.3.0を実行して失敗した。

原因

fiddlepsychがコンパイルされていない。

エラー

*** Following extensions are not compiled:
fiddle:
	Could not be configured. It will not be installed.
	/home/ec2-user/tmp/ruby-build.20240629031939.85872.yDcKUz/ruby-3.3.0/ext/psych/tmp/ruby-build.20240629034052.97576.6eBHYO/ruby-3.3.0/ext/fiddle/extconf.rb:78: missing libffi. Please install libffi or use --with-libffi-source-dir with libffi source location.
	Check ext/fiddle/mkmf.log for more details.
psych:
	Could not be configured. It will not be installed.
	Check ext/psych/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
make[1]: *** [exts.mk:2422: note] Error 1
make[1]: Leaving directory '/home/ec2-user/tmp/ruby-build.20240629031939.85872.yDcKUz/ruby-3.3.0/ext/psych/tmp/ruby-build.20240629034052.97576.6eBHYO/ruby-3.3.0'
make: *** [uncommon.mk:398: build-ext] Error 2
external command failed with status 2

BUILD FAILED (Amazon Linux 2023 on x86_64 using ruby-build 20240612-2-g08aadf4)

試したこと

missing libffi. Please install libffi or use --with-libffi-source-dir with libffi source location.とあったのでlibffiをインストールしようとしたら、すでにあると言われた。

$ sudo yum -y install libffi
Last metadata expiration check: 2:06:48 ago on Sat Jun 29 01:44:21 2024.
Package libffi-3.4.4-1.amzn2023.0.1.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

psychのエラーはext/psych/mkmf.log for more details.とあったので確認しにいった。

ext/psych/mkmf.log
pkg_config: checking for pkg-config for yaml-0.1... -------------------- not found

LD_LIBRARY_PATH=.:../.. pkg-config --exists yaml-0.1
package configuration for yaml-0.1 is not found
conftest.c:3:10: fatal error: yaml.h: No such file or directory
    3 | #include <yaml.h>

Ruby 3.3.0のインストールエラー こちらの記事では、libyamlをインストールしたら解決したとあったのでインストールしようとすると、すでにあると言われた。

$ sudo yum install -y libyaml
Last metadata expiration check: 2:37:40 ago on Sat Jun 29 01:44:21 2024.
Package libyaml-0.2.5-5.amzn2023.0.2.x86_64 is already installed.
Dependencies resolved.
Nothing to do.

解決した方法

fiddleについては、libffiではなくlibffi-develパッケージをインストールする必要があった。

sudo yum install -y libffi-devel

psychについては、libyamlではなくlibyaml-develパッケージをインストールする必要があった。

sudo yum install -y libyaml-devel

参考記事

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0