您的位置:首页 > 编程语言 > Ruby

ruby on rails openssl

2013-01-11 22:42 246 查看
ruby使用的是1.9.3-p362 自己编译安装的:configure && make && make install

Rails使用的是3.2.11

在创建新项目时报错:

$:rails new demo

         run  bundle install

Fetching gem metadata from https://rubygems.org/. Could not load OpenSSL.

You must recompile Ruby with OpenSSL support or change the sources in your

Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL

using RVM are available at rvm.io/packages/openssl.

修改demo/Gemfile第一行后重新创建项目,项目创建成功

source 'https://rubygems.org' --> source 'https://rubygems.org'

$:cd demo

$:rails server
`require’: cannot load such file — openssl (LoadError)”
处理办法:

先安装libssl-dev:

1
sudo
 
apt-get 
install
 
libssl-dev
然后编译出一个共享库来安装进去就可以了,方法如下:

进入ruby源码目录下,然后

1
cd
 
ext/openssl
之后编译出.so文件安装:

1
ruby
extconf.rb
2
make
3
sudo
 
make
 
install
不需要重新编译ruby,直接可用。重新创建demo项目,成功;启动服务器,成功。访问http 3000端口,成功。

参考:http://lunae.cc/solve-can-not-load-such-file-openssl-error
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ruby rails openssl