29
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

rbenv installがopensslで失敗する

2020-03-26追記: Ruby 2.3の場合を追加。

環境: macOS Catalina

結論から先に:環境変数RUBY_CONFIGURE_OPTSを足す。

rbenv installがopensslで失敗する。Homebrewで最新のopensslが入っているが、それを見に行かないもよう。

$ rbenv install 2.6.5
Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...

BUILD FAILED (OS X 10.14.5 using ruby-build 20191205)

Inspect or clean up the working tree at /var/folders/d4/lpd3cnrd16l4z2ttkrnx168w0000gn/T/ruby-build.20191210115949.43308.JhVuyt
Results logged to /var/folders/d4/lpd3cnrd16l4z2ttkrnx168w0000gn/T/ruby-build.20191210115949.43308.log

Last 10 log lines:
      _s_server_main in s_server.o
  "_verify_stateless_cookie_callback", referenced from:
      _s_server_main in s_server.o
  "_wait_for_async", referenced from:
      _s_client_main in s_client.o
      _sv_body in s_server.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [apps/openssl] Error 1
make: *** [all] Error 2

.bash_profileを確認すると、次の環境変数があるが、それでも失敗。

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig:/usr/local/opt/readline/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig"

次の環境変数を足すと成功。

export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl@1.1"

参考: https://github.com/rbenv/ruby-build/issues/1353#issuecomment-537749304

Ruby 2.3 の場合

Ruby 2.3の場合、OpenSSLの1.1ではなく、1.0が必要なもよう。ただし、2.3.8、2.3.7では成功するが、2.3.6以前では失敗する。

$ brew install rbenv/tap/openssl@1.0
$ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl@1.0"
$ rbenv install 2.3.8

参考: https://github.com/rbenv/ruby-build/issues/1353#issuecomment-573414540

記録

  • 2.3.6 (2017-12-14) 失敗 OpenSSL 1.0
  • 2.3.7 (2018-03-28) 成功 OpenSSL 1.0
  • 2.3.8 (2018-10-17) 成功 OpenSSL 1.0
  • 2.4.2 (2017-09-14) 成功 OpenSSL 1.1
  • 2.4.7 (2019-08-28) 成功 OpenSSL 1.1
  • 2.4.8 (2019-10-01) 失敗 OpenSSL 1.1
  • 2.4.9 (2019-10-02) 成功 OpenSSL 1.1
  • 2.5.8 (2020-03-31) 成功 OpenSSL 1.1
  • 2.6.6 (2020-03-31) 成功 OpenSSL 1.1
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
29
Help us understand the problem. What are the problem?