如何判断RVM安装的ruby实际上正在使用哪个openssl lib [英] How to tell which openssl lib is actually being used by an RVM-installed ruby

查看:102
本文介绍了如何判断RVM安装的ruby实际上正在使用哪个openssl lib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现我可以使用以下任何命令成功安装ruby:

I discovered that I can successfully install ruby with any of the following commands:

$ rvm reinstall 1.9.3-p327
$ rvm reinstall 1.9.3-p327 --with-openssl-dir=/usr/local
$ rvm reinstall 1.9.3-p327 --with-openssl-dir=/afdlkjasd_not_a_dir
$ rvm reinstall 1.9.3-p327 --with-openssl-dirffadsf=/afdlkjasd_not_a_dir

无论我使用了以上哪个命令,我都可以输入:

Regardless of which of the above commands I used, I can then type:

$ rvm use 1.9.3-p327
Using /home/clay/rvm/gems/ruby-1.9.3-p327
$ which ruby
/home/clay/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
$ ruby -e "puts require('openssl')"
true

无论我做什么,我似乎都拥有ssl支持.我猜rvm或ruby构建过程不介意无效的选项或值.我不知道--with-openssl-dir选项是否受到尊重,即使我正确地(显然)键入了它.

I appear to have ssl support regardless of what I do. I guess rvm or the ruby build process don't mind invalid options or values. I have no idea if the --with-openssl-dir option was respected even when I type it (apparently) correctly.

rvm是否将我的ruby链接到我想要的openssl lib(/usr/local中的那个)? 我怎么知道红宝石被编译/链接到哪个openssl库?

Is rvm linking my ruby with the openssl lib that I intended (the one in /usr/local)? How do I tell which openssl lib a ruby was compiled/linked with?

我正在使用Linux Mint 13.

I'm using Linux Mint 13.

推荐答案

Ruby有相当复杂的机制来检测库,每个扩展都有自己的代码.幸运的是,大多数扩展都支持pkg-config,因此可以强制定位*.pc文件:

Ruby has quite complicated mechanisms for detecting libraries, every extension has it's own code for that. Fortunately most of the extensions support pkg-config so it's possible to force location of *.pc files:

PKG_CONFIG_PATH=/path/to/openssl/lib/pkgconfig rvm reinstall 1.9.3
rvm use 1.9.3

然后在编译后即可在OSX上进行验证:

then after compilation you can verify on OSX:

find $MY_RUBY_HOME -name openssl.bundle | xargs otool -L

或在Linux上

find $MY_RUBY_HOME -name openssl.so | xargs ldd

对于--with-openssl-dir=...,它不完全由ruby支持,应为--with-opt-dir=... + --with-openssl,opt-dir支持从ruby 1.9.3-p327开始的多个用:分隔的路径

as for the --with-openssl-dir=... it is not fully supported by ruby, it should be --with-opt-dir=... + --with-openssl, opt-dir supports multiple paths separated with : starting from ruby 1.9.3-p327

这篇关于如何判断RVM安装的ruby实际上正在使用哪个openssl lib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆