岩本隆史の日記帳(アーカイブ)

はてなダイアリーのサービス終了をうけて移行したものです。更新はしません。

RVM上のRubyでOpenSSLを使うときは

RVM上のRuby1.9.1にThinをインストール後、ためしに「thin -v」したら、「thin.rb:6:in `require': no such file to load -- openssl (LoadError)」となった。

どうしようかといろいろ調べたら、「All about Ruby on Rails & Data recovery software」に答えが書いてあった。

$ rvm remove 1.9.1
$ rvm install 1.9.1 -C --with-openssl-dir=/usr/local

のようにすればOKということ。

実際にやってみた。

$ rvm remove 1.9.1
Removing /home/iwamot/.rvm/src/ruby-1.9.1-p378...
Removing /home/iwamot/.rvm/rubies/ruby-1.9.1-p378...
$ rvm install 1.9.1 -C --with-openssl-dir=/usr
Installing Ruby from source to: /home/iwamot/.rvm/rubies/ruby-1.9.1-p378
Downloading ruby-1.9.1-p378, this may take a while depending on your connection.              ..
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 8862k  100 8862k    0     0  1095k      0  0:00:08  0:00:08 --:--:-- 1831k
Extracting ruby-1.9.1-p378 ...
Configuring ruby-1.9.1-p378, this may take a while depending on your cpu(s)...
Compiling ruby-1.9.1-p378, this may take a while, depending on your cpu(s)...
Installing ruby-1.9.1-p378
Installation of ruby-1.9.1-p378 is complete.
Updating rubygems for /home/iwamot/.rvm/gems/ruby-1.9.1-p378
Installing gems for ruby-1.9.1-p378.
Installing rdoc to /home/iwamot/.rvm/gems/ruby-1.9.1-p378
Installing rake to /home/iwamot/.rvm/gems/ruby-1.9.1-p378
Installation of gems for ruby-1.9.1-p378 is complete.
$ rvm use 1.9.1
$ thin -v
thin 1.2.7 codename No Hup

問題なくThinのバージョンが表示された。

OpenSSLのほか、Readline、Iconv、Zlib、Autoconfを使うときの手順も、「All about Ruby on Rails & Data recovery software」からたどれる。