LoginSignup
1
2

More than 5 years have passed since last update.

rails new したときに openssl でつまずく

Posted at

新しいrubyのバージョンがでてビルドでつまずいて、結局元のバージョンのまま使ってたりしたんですが、ruby 2.6.0-preview2も出た事なのでそうも言ってられないという事で腰を入れて(という程でもないですが)調査しました。

railsのインストールまではなんとかできるのですが、rails newでopensslが読み込めないというエラーが出てしまいます。

/Users/ISD/.rvm/rubies/ruby-2.5.1/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- openssl (LoadError)

試しに gem install openssl してもうまくいきません。

いつもならググって対応策が見つからなくてよくわからんで過ごすんですが、ログを見て見るとどうやら1.0.1よりバージョンが低いと判断されている様です。
(実際は openssl 1.0.2o_2 がインストールされてます。)

checking for OpenSSL version is 1.0.1 or later... -------------------- no

"gcc -I/Users/ISD/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/x86_64-darwin17 -I/Users/ISD/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0/ruby/backward -I/Users/ISD/.rvm/rubies/ruby-2.5.1/include/ruby-2.5.0 -I. -I/usr/local/Cellar/openssl098/0.9.8zh/include  -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe    -c conftest.c"
conftest.c:6:20: error: 'conftest_const' declared as an array with a negative size
int conftest_const[(OPENSSL_VERSION_NUMBER >= 0x10001000L) ? 1 : -1];
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

ログをもう少し良く見て見るとopenssl098というのがあります。

どうもこのファイルがあるとバージョンが低いと判断される様です。

という事で削除すると gem install openssl が通って rails new でプロジェクトが作成できました。

だいぶ古いMacからずっとファイルを引きずってきているのでゴミの様に古いファイルが残っていたためのようでした。

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