I've installed OpenSSL with rvm (rvm pkg install openssl) and then did rvm reinstall 1.9.3 --with-openssl-dir=$rvm_path/usr
When I try to run the thin webserver, I get the following error:
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/x86_64-linux/openssl.so:
undefined symbol: SSLv2_method -
/home/ubuntu/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/x86_64-linux/openssl.so
(LoadError)
This is running on Ubuntu 12.04, and I've read that Ubuntu 12 builds OpenSSL without SSLv2 support. Yet, here it's referencing RVM's package -- does RVM do the same? Is there any known workaround for this problem?
As you say, Ubuntu builds openssl without SSLv2 support: Ubuntu and undefined symbol for SSLv2_method
For people reading this, your options are (in increasing difficulty):
(1) install rvm version 1.14.7, where the openssl pkg includes openssl version 0.9.8, and includes SSLv2 support by default.
rvm implode # Completely destroy your rvm installation
curl -L https://get.rvm.io | bash -s -- --version 1.14.7
Install the required packages, recompile your ruby, and it should work!
(2) (This gives you more security): Compile your own openssl from source, configuring it to include SSLv2 support, then recompile your ruby with the --with-openssl-dir pointing at wherever you installed openssl to.
(3) Fix thin so that it no longer requires the SSLv2_method symbol, then submit a pull request on GitHub
Related
When I run
RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl#3/3.0.1 rbenv install 3.1.0
I get this output:
Downloading ruby-3.1.0.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.0.tar.gz
Installing ruby-3.1.0...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.6.2 using ruby-build 20211227-3-gcdc215e)
Inspect or clean up the working tree at /var/folders/ts/k_8jb10136s3zw9k2k08nz3c0000gn/T/ruby-build.20220113093111.65052.FVpqjp
Results logged to /var/folders/ts/k_8jb10136s3zw9k2k08nz3c0000gn/T/ruby-build.20220113093111.65052.log
Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/jeremy/.rbenv/versions/3.1.0
--enable-shared
--with-readline-dir=/usr/local/opt/readline
--with-openssl-dir=/usr/local/Cellar/openssl#3/3.0.1
CC=clang
LDFLAGS=-L/Users/jeremy/.rbenv/versions/3.1.0/lib
CPPFLAGS=-I/Users/jeremy/.rbenv/versions/3.1.0/include
I don't see any clues in the logs. I have tried lots of things like reinstalling rbenv and openssl, not specifying the configure opts, system updates, installing xcode, and more things from google. Maybe I am missing something.
Hi I also kept running into this on 'Mac OS X 10.15.7 using ruby-build' I had to set both of the following variables at the same time before the rbenv install 3.0.1 command:
OPENSSL_CFLAGS=-Wno-error=implicit-function-declaration RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 3.0.1
The first one tells the compiler to ignore where functions are implicitly declared rather than erroring out when this happens. And the second tells ruby which readline to use (in this case the one installed trough homebrew).
Ruby does not (yet) support OpenSSL 3.0. Implementing support for this newer version is tracked in https://github.com/ruby/openssl/issues/369
For now, you have to use Openssl 1.1 instead, which you can install with
brew install openssl#1.1
I am building Ruby 2.4 from source on OSX (not using a Ruby installer).
However, the resulting Ruby build does not include an openssl.bundle. I assume this is because the system Openssl version on my OSX system is too old (OpenSSL 0.9.8zh 14 Jan 2016).
I have an up to date OpenSSL (1.0.2) installed via homebrew, but for some reason the Ruby build process uses the old system version rather than the homebrew version.
I have tried brew link openssl AND brew link openssl --force but to no avail, every time I get the message:
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
I am unsure what to do at this point. Could someone inform me how I can build Ruby 2.4 from source on OSX to link against my up to date homebrew version of openssl so that I can have an openssl.bundle in the resulting Ruby?
Thanks!
A recent OpenSSL update on ArchLinux broke Ruby because the latter depends on SSLv3 being supported by the former. Ruby code that uses OpenSSL will reveal the problem when they terminate with an error like the below:
openssl.so: undefined symbol: SSLv3_method - .../openssl.so (LoadError)
I use multiple versions of Ruby with RVM and the problem aplies to all of them.
The OpenSSL version I have the problem with is 1.0.2h but I believe it was introduced with 1.0.2g. Version 1.0.2f works fine.
How can this be compatibility issue be overcome (without downgradng OpenSSL) ?
The problem is caused by the ArchLinux OpenSSL package being built without SSLv3 support, as of this commit. I believe that a similar thing has been done in other distros such as Ubuntu.
The solution in a RVM environment is to reinstall your Rubies which will rebuild them (you may also wish to update to the latest rvm):
$ rvm get head # optional, if you want to!
$ rvm reinstall all # or a specifc ruby version instead of 'all'
However, older rubies will still fail with a compile error like this:
Error running '__rvm_make -j1'
ossl_ssl.c:143:27: error: ‘SSLv3_client_method’ undeclared here (not in a function)
This has been discussed with the RVM team who have suggested installing this Ruby patch that allows older rubies to build:
$ curl https://github.com/ruby/ruby/commit/801e1fe46d83c856844ba18ae4751478c59af0d1.diff > openssl.patch
$ rvm install --patch ./openssl.patch 1.9.3-p194
I built ruby-1.9.3-p194, ruby-2.0.0-p247 and ruby-2.2.1 successfully with this patch.
Ruby keeps segfaulting when using the Koala gem to talk over HTTP:
/Users/pawel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault
I've tried the following:
Run which -a ruby which showed multiple Rubies via MacPorts. So I deleted those and running the same command again returns only /usr/bin/ruby
I've removed the MacPorts version of PostgreSQL and installed it with Homebrew instead (With MacPorts, it installs its own version of OpenSSL)
Running openssl version returns OpenSSL 1.0.0g 18 Jan 2012
I removed Ruby 1.9.3 from RVM and tried Luciano's method below which didn't work.
I've also tried reinstalling 1.9.3 from RVM and specifying --with-openssl-dir=/opt/local since which openssl returns /opt/local/bin/openssl
I've reinstalled RVM (It's now version 1.10.2 in /Users/pawel/.rvm/bin/rvm)
I've upgraded to Ruby 1.9.3-p125 and have also tried on 1.9.2
I've followed the instructions here: http://www.christopherirish.com/2011/09/02/ruby-1-9-2-segmentation-fault-and-openssl/ (which are my above steps, actually). I've also read Christopher's previous post here.
In my project directory when I run the following then I get the expected 0.:
ruby -rubygems -e" require 'eventmachine'; require 'openssl' "; echo $?
I've tried to sudo port -f deactivate openssl but then when I try to start a Rails server I get Library not loaded: /opt/local/lib/libssl.1.0.0.dylib
I need some more ideas on what else I can try, or things I've missed.
I'm also getting this same Segmentation Fault error, but I'm trying to list files on AWS-S3.
Edit:
This way worked for me:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.rvm/bin
rvm remove 1.9.3
rvm pkg install iconv
rvm pkg install openssl
rvm install ruby-1.9.3 --with-openssl-dir=~/.rvm/usr --with-iconv-dir=~/.rvm/usr
as #Simpleton said, I wrote a comment in the wrong place. Now I'm editing it with a response. ;-)
The problem seemed to be that Homebrew and MacPorts were conflicting, so I deleted MacPorts, removed all packages and the /opt/local/ directory. This caused some issue with the PG gem due to the PostgreSQL installation on Homebrew.
So I deleted the Postgres formula, then reinstalled it and ditto for the OpenSSL installation using Homebrew.
After that I imploded RVM and installed it and my Rubies again (not sure if this step was necessary) and finally it works.
I ran into this issue, too, but used a different solution. Here's the full stack trace of the error.
Here is the official bug report: http://bugs.ruby-lang.org/issues/6184 The responses below the stack trace were very helpful.
If you're using OS X's default openssl -> do like brew install
openssl and build with installed openssl, then try again.
If you're using openssl that installed by user -> build with OS X default ssl and try again.
This sounded similar to an issue for me recently when the readline library installed in MacPorts broke a ruby installation. Running the following script on the broken ruby installation showed it was loading the MacPorts openssl lib
require 'net/https'
puts `lsof -p #{$$} | grep ssl | awk '{print $9}'`
(the output)
/Users/john/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/x86_64-darwin11.2.0/openssl.bundle
/opt/local/lib/libssl.1.0.0.dylib
The solution was to temporarily move MacPorts out of /opt/local while installing ruby.
Quit all processes that are accessing MacPorts files. You can see which ones are running with sudo lsof | grep /opt/local.
sudo mv /opt/local /opt/localbak
Open a new terminal, then compile and install Ruby
sudo mv /opt/localbak /opt/local
After that, the ruby installation worked properly alongside MacPorts and did not load the libssl file from MacPorts.
I'm having issues requiring 'digest/sha1'.
~$ ./configure --prefix=$HOME/usr --program-suffix=19 --enable-shared
~$ make
~$ make install
~$ irb19
irb(main):001:0> require 'digest/sha1'
LoadError: dlopen(/Users/matan/usr/lib/ruby19/1.9.1/i386-darwin9.8.0/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish
Referenced from: /Users/matan/usr/lib/ruby19/1.9.1/i386-darwin9.8.0/digest/sha1.bundle
Expected in: flat namespace
- /Users/matan/usr/lib/ruby19/1.9.1/i386-darwin9.8.0/digest/sha1.bundle
from (irb):1:in `require'
from (irb):1
from /Users/matan/usr/bin/irb19:12:in `<main>'
irb(main):002:0>
I know some standard modules require fine, while others don't. If i'd say require 'yaml' or even require 'digest' then that works fine. I am using OS X 10.5.8, with Ruby 1.9.1-p378. The system-wide install of Ruby 1.8.6 works fine.
Just last week I uninstalled Ruby and re-installed it. When I first installed Ruby I installed it in a similar manner, from source prefixed at my local $HOME/usr directory. I tried removing each and every file make install installs, then re-installing, but that didn't help.
Do you have an idea what the issue is and how to resolve it?
This is probably related to OpenSSL (Ruby uses OpenSSL for MD5/SHA1, at least if available). You could fix this by compiling a newer version of OpenSSL and linking against it on your own (./configure ... --with-openssl-dir=path/to/openssl).
Unfortunately you cannot install openssl via homebrew. However, apparently, if you are using macports, there is a port available: sudo port install openssl.
But what I would recommend is to simply use RVM:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
rvm package install openssl
rvm install 1.9.1 -C --with-openssl-dir=$HOME/.rvm/usr
You can then switch between 1.8 and 1.9:
rvm use system
ruby --version # => 1.8
rvm use 1.9.1
ruby --version # => 1.9.1
I did the compiling on my own for a long time, even wrote my own little script managing updating. But RVM ist just so much better at handling this. If you are going to try RVM, just swing by the #rvm channel at freenode, people are always willing to help there.
As an aside, 1.9.1 has a lot of rough edges and I would rather recommend switching to the 1.9.2 branch (or at least switch to 1.9.2p0 as soon as released).
Konstantin