Skip to content
This issue has been moved to a discussionGo to the discussion

Cannot install Ruby versions < 2.4 because of openssl@1.1 dependency #1353

Closed
@brandonfriess-stripe

Description

@brandonfriess-stripe

It seems the most recent change to ruby-build 20191002 homebrew formula to require openssl@1.1 breaks the install of Ruby versions that are < 2.4 (those require openssl 1.0.2q)

So, for macOS users who install ruby-build via homebrew, they will get openssl@1.1 installed as well.

If they then try to run rbenv install 2.1.10 for instance, it will fail with:

Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/username/.rbenv/versions/2.1.10
  --with-openssl-dir=/usr/local/opt/openssl@1.1
  --with-readline-dir=/usr/local/opt/readline
  CC=clang
  CFLAGS= -O3 -Wno-error=shorten-64-to-32 
  LDFLAGS=-L/Users/username/.rbenv/versions/2.1.10/lib 
  CPPFLAGS=-I/Users/username/.rbenv/versions/2.1.10/include 

Yeah, I know older versions are EOL but they still get used in some environments.

Seems like changing https://github.com/rbenv/ruby-build/blob/master/bin/ruby-build#L1023 to only check for openssl and not `openssl@1.1 could potentially fix this?

Activity

hsbt

hsbt commented on Oct 3, 2019

@hsbt
Member

I understand this issue too. But I didn't know the maintenance policy of ruby-build formula on homebrew.

I suggest you use git clone instead of brew install ruby-build

gfguthrie

gfguthrie commented on Oct 3, 2019

@gfguthrie
Contributor

Since I helped move the 1.1 change along:

The workaround for EOL Ruby versions (or any that won't build with 1.1) where you still want to use Homebrew is as follows:
brew install openssl
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.3.8
Latest solution/workaround (March 2020): #1353 (comment)

(FWIW, the Homebrew formula was updated to use 1.1 at the end of August, the recent change was just to start looking for that version)

brandonfriess-stripe

brandonfriess-stripe commented on Oct 3, 2019

@brandonfriess-stripe
Author

Thanks! That will work and I am sure will be helpful for others who may land on this thread.

aardvarkk

aardvarkk commented on Oct 4, 2019

@aardvarkk

I ran into this bug when trying to install Ruby 2.3.8 using the ASDF version manager. I was getting the following error when running:

asdf install ruby 2.3.8:

ERROR: Ruby install aborted due to missing extensions

Following the example above, I changed the command to the following and the installation worked correctly:

RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" asdf install ruby 2.3.8

wekb

wekb commented on Nov 8, 2019

@wekb

Since I helped move the 1.1 change along:

The workaround for EOL Ruby versions (or any that won't build with 1.1) where you still want to use Homebrew is as follows:

brew install openssl
RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.3.8

(FWIW, the Homebrew formula was updated to use 1.1 at the end of August, the recent change was just to start looking for that version)

This is very helpful, but frankly this should not have been a breaking change. Adding logic, or at least some kind of user feedback, would have been trivial in this case.

hraban

hraban commented on Nov 8, 2019

@hraban

Thanks for the explanation and solution.

Even just a link to this issue would be a great help to anyone using rbenv to install a <2.4.0 on mac. Many people will be running into this problem, not all of them confident enough to google the right error message (rbenv is usually part of a "run this to setup the repo" list in project READMEs).

gfguthrie

gfguthrie commented on Nov 8, 2019

@gfguthrie
Contributor

I've taken option 2 from my comment on the original PR and made a new PR (#1375) to stop looking for Homebrew openssl entirely so that the discussion can focus there about whether that's the approach ruby-build wants to move towards or not.

hardvain

hardvain commented on Jan 6, 2020

@hardvain

Hello, I still seem to have this error. I am trying to instal ruby 2.3.7. My mac has openssl version 1.1.d 10 Sep 2019. I am getting the following error when trying to install ruby even after passing the above suggested method of including open-ssl-dir. The last few lines of the error is:

openssl_missing.c:39:18: error: expected ';' after top level declarator
EVP_MD_CTX_create(void)
                 ^
                 ;
2 warnings and 5 errors generated.
make[2]: *** [openssl_missing.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default pathname libraries
compiling objspace.c
compiling objspace_dump.c
linking shared-object json/ext/parser.bundle
linking shared-object json/ext/generator.bundle
linking shared-object pathname.bundle
linking shared-object objspace.bundle
linking shared-object bigdecimal.bundle
linking shared-object nkf.bundle
linking shared-object date_core.bundle
make: *** [build-ext] Error 2

Am I missing anything? The command I am trying to run is RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.3.7

gfguthrie

gfguthrie commented on Jan 6, 2020

@gfguthrie
Contributor

@hardvain you probably don't need to pass the option at all. 2.3.7 I don't think will work with 1.1, and from the error it looks like you don't have anything in /usr/local/opt/openssl. If you don't pass in anything, ruby-build (assuming you have the current version) will just install the openssl that is needed for 2.3.7.

56 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mislav@hsbt@burnettk@ravicious@ryanwi

        Issue actions

          Cannot install Ruby versions < 2.4 because of openssl@1.1 dependency · Issue #1353 · rbenv/ruby-build