`
netfork
  • 浏览: 478971 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

no such file to load -- openssl (RuntimeError)终极解决

阅读更多
从昨天起,试着安装SUSE(SLES),并配置ROR环境,问题不断,今天更是遇到超郁闷的问题。
安装完了Ruby、GEM、Rails后,运行ruby script/server后,出现了个错。

引用
/usr/local/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:...:in `require_frameworks': no such file to load -- openssl (RuntimeError)


查了半天也没找出原因,发现SUSE中openssl已经安装了。找来找去,找到Ruby的源码文件夹中,有ext/openssl文件夹,然后再找到安装后的ruby文件夹下,发现根本就找不到openssl文件夹。
于是cd到ruby源码文件夹的ext/openssl文件下,执行“ruby exconf.rb”,出现了错误。
引用
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.


搜索了整个系统也没找到ssl.h,几次要放弃源码安装ruby了。
最后抱着试试看的心态,通过google在suse网站找到了下面的网址:
http://www.novell.com/products/linuxpackages/enterpriseserver/i386/openssl-devel.html
从这个网址上,找到了下面的网址:
http://www.openssl.org/

犹豫着去下载了:openssl-0.9.8k.tar.gz。
解压后,执行make && make install,漫长的等待。。。。
终于安好了。在安装后的文件下搜ssl.h,发现这个文件存在了,看到点希望了。

回到ruby源文件文件夹的/ext/openssl文件夹下,执行“ruby exconf.rb”,错误依然。
获取ssl.h所在的文件夹之后,执行以下命令:
引用
ruby extconf.rb --with-openssl-include=/usr/local/ssl/include/


出现了新的错误:
引用

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... yes
checking for OpenSSL_add_all_digests() in -lcrypto... no
checking for OpenSSL_add_all_digests() in -llibeay32... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.


非常有戏啊,再试一个命令:
引用
ruby extconf.rb --with-openssl-include=/usr/local/ssl/include/ --with-openssl-lib=/usr/local/ssl/lib


太神奇了,居然成功生成了Makefile,毫不犹豫,继续:
引用
make && make install


成功的安装了openssl到ruby的安装文件夹中。

最后,回到测试工程中,ruby script/server一下,哈哈,WEBrick成功启动,到FF下访问一下,完全OK了。

再试试lighttpd+fcgi,也是完全OK的,心情大好。


完。

分享到:
评论
3 楼 syutran 2011-07-25  
感谢。
我搞了一夜,才找到您这篇文档。真是好极了。
2 楼 qichunren 2010-05-18  
再次感谢你。
1 楼 orcl_zhang 2009-08-25  
哈哈,果然好用,一直没搞定,都想重装了。
照你的方法一次成功。
思路学习下!!

相关推荐

Global site tag (gtag.js) - Google Analytics