rubyinstaller2: Updating 'openssl' fails on Windows

I’m trying to update all the gems and the process fails on openssl gem step.

C:\>gem update openssl
Updating installed gems
Updating openssl
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions.  This could take a while...
ERROR:  Error installing openssl:
        ERROR: Failed to build gem native extension.

    current directory: C:/bin/ruby/lib/ruby/gems/2.4.0/gems/openssl-2.0.4/ext/openssl
C:/bin/ruby/bin/ruby.exe -r ./siteconf20170626-6764-ht24i.rb extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for -lgdi32... yes
checking for -lcrypt32... yes
checking for openssl/ssl.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/bin/ruby/bin/$(RUBY_BASE_NAME)
        --with-openssl-dir
        --without-openssl-dir
        --with-openssl-include
        --without-openssl-include=${openssl-dir}/include
        --with-openssl-lib
        --without-openssl-lib=${openssl-dir}/lib
        --with-kerberos-dir
        --without-kerberos-dir
        --with-kerberos-include
        --without-kerberos-include=${kerberos-dir}/include
        --with-kerberos-lib
        --without-kerberos-lib=${kerberos-dir}/lib
        --with-debug
        --without-debug
        --enable-debug
        --disable-debug
        --with-nsllib
        --without-nsllib
        --with-socketlib
        --without-socketlib
        --with-openssl-config
        --without-openssl-config
        --with-pkg-config
        --without-pkg-config
        --with-gdi32lib
        --without-gdi32lib
        --with-crypt32lib
        --without-crypt32lib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/bin/ruby/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/openssl-2.0.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/bin/ruby/lib/ruby/gems/2.4.0/gems/openssl-2.0.4 for inspection.
Results logged to C:/bin/ruby/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/openssl-2.0.4/gem_make.out
Gems updated: openssl

Steps to reproduce

gem update openssl

What’s the output from ridk version?

ruby:
  path: C:/bin/ruby
  version: 2.4.1
  platform: x64-mingw32
ruby_installer:
  package_version: 2.4.1-1
  git_commit: 6635d31
msys2:
  path: C:\bin\msys64
  title: MSYS2 64bit
  version: '20161025'
cc: x86_64-w64-mingw32-gcc (Rev3, Built by MSYS2 project) 6.3.0
sh: GNU bash, version 4.3.46(2)-release (x86_64-pc-msys)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (10 by maintainers)

Commits related to this issue

Most upvoted comments

The openssl DLLs are shipped with rubyinstaller and are always preferred to any other non system DLLs. Therefore the only way to activate the OpenSSL version 1.0.2l is to copy the files into rubies dll directory.

So to summarize, the installation procedure for the openssl gem should be as following:

ridk enable
pacman -S mingw-w64-x86_64-openssl
gem install openssl
cp c:/msys64/mingw64/bin/libeay32.dll c:/msys64/mingw64/bin/ssleay32.dll c:/Ruby24-x64/bin/ruby_builtin_dlls/
ruby -ropenssl -e "puts OpenSSL::OPENSSL_LIBRARY_VERSION"
# => OpenSSL 1.0.2l  25 May 2017

@bxqgit You can pick Linux or macOS. Whatever you prefer. Windows is often a bit more difficult, so that if you need to do rails development only, it’s often better to switch to another OS. Most things will work on Windows after some investigation, but instructions and stackoverflow articles often lack Windows specifics.

@larskanis Thanks. This helped me even now your instructions are for centuries:)

@bxqgit

Actually, you could upgrade 1.0.2k to l. These version numbers refer to the MinGW OpenSSL package. They can be checked using the two constants:

OpenSSL::OPENSSL_VERSION
OpenSSL::OPENSSL_LIBRARY_VERSION

v2.0.4 is the version of the Ruby OpenSSL default gem that you want to upgrade to. It is shown in the constant OpenSSL::VERSION.

ridk exec pacman -Qs mingw.+openssl runs and shows nothing

Shows that the OpenSSL MinGW package isn’t installed. Run

ridk exec pacman -S mingw-w64-x86_64-openssl

then try upgrading the gem.