1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

rbenvで2.0.0-p648のインストール時にビルドに失敗する

Last updated at Posted at 2021-12-21

現象

超久々にRubyを触っているんだが、
配備する環境に合わせて、Rubyの2.0.0-p648を利用しようとしたが、

$ brew install rbenv
$ rbenv install -L | grep p648
2.0.0-p648

ビルドでエラーになる。

$ rbenv install 2.0.0-p648
Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/mitsuaki1229/.rbenv/versions/2.0.0-p648

Downloading ruby-2.0.0-p648.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p648.tar.bz2
Installing ruby-2.0.0-p648...

WARNING: ruby-2.0.0-p648 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew

BUILD FAILED (macOS 11.6 using ruby-build 20211203)

Inspect or clean up the working tree at /var/folders/s3/r4ql7qd12b38x0jbvlnh92n40000gn/T/ruby-build.20211221103119.10821.PPrkEu
Results logged to /var/folders/s3/r4ql7qd12b38x0jbvlnh92n40000gn/T/ruby-build.20211221103119.10821.log

Last 10 log lines:
thread.c:4835:20: note: did you mean 'rb_frame_this_func'?
./include/ruby/intern.h:369:4: note: 'rb_frame_this_func' declared here
ID rb_frame_this_func(void);
   ^
1 warning and 1 error generated.
make: *** [thread.o] Error 1
make: *** Waiting for unfinished jobs....
12 warnings generated.
6 warnings generated.
12 warnings generated.

原因

Xcode12から、Cのビルド時に宣言無しで関数を利用すると、エラーを吐くようになったらしい。

Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)

解決

エラーを無視するようにフラグを設定する。

$ export optflags="-Wno-error=implicit-function-declaration"

再ビルド。

$ rbenv install 2.0.0-p648
Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/mitsuaki1229/.rbenv/versions/2.0.0-p648

Downloading ruby-2.0.0-p648.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p648.tar.bz2
Installing ruby-2.0.0-p648...

WARNING: ruby-2.0.0-p648 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew
Installed ruby-2.0.0-p648 to /Users/mitsuaki1229/.rbenv/versions/2.0.0-p648
1
0
1

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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?