Rubygems: "uninitialized constant OpenURI::OpenSSL" when installing rdkafka gem using rubygems 3.2.1

Created on 16 Dec 2020  ·  3Comments  ·  Source: rubygems/rubygems

I'm having a problem:

My current problem is that I cannot install the rdkafka gem using rubygems 3.2.1. I get an error that seems related to resolving the ::OpenSSL module.

This issue is related to:

  • [ ] Network problems
  • [x] Installing a library
  • [ ] Publishing a library
  • [ ] The command line gem
  • [ ] Other


Installation output using rubygems 3.1.4

❯ docker run -ti --rm ruby:2.7.2@sha256:be3dfd137ddc3f97c0f5844d5e824c658e3907f3f5f9236d2c4d34390a76f9dc \
    sh -c 'gem update --system 3.1.4 ; gem install rdkafka:0.8.1'
Latest version already installed. Done.
Fetching rdkafka-0.8.1.gem
Fetching ffi-1.13.1.gem
Fetching mini_portile2-2.5.0.gem
Building native extensions. This could take a while...
Successfully installed ffi-1.13.1
Successfully installed mini_portile2-2.5.0
Building native extensions. This could take a while...
Successfully installed rdkafka-0.8.1
3 gems installed


Installation output using rubygems 3.2.1

❯ docker run -ti --rm ruby:2.7.2@sha256:be3dfd137ddc3f97c0f5844d5e824c658e3907f3f5f9236d2c4d34390a76f9dc \
    sh -c 'gem update --system 3.2.1 ; gem install rdkafka:0.8.1'
Updating rubygems-update
Fetching rubygems-update-3.2.1.gem
Successfully installed rubygems-update-3.2.1
Installing RubyGems 3.2.1
  Successfully built RubyGem
  Name: bundler
  Version: 2.2.1
  File: bundler-2.2.1.gem
Bundler 2.2.1 installed
RubyGems 3.2.1 installed
Regenerating binstubs
Regenerating plugins

[rubygems changelog removed, irrelevant for the reported issue]

------------------------------------------------------------------------------

RubyGems installed the following executables:
    /usr/local/bin/gem
    /usr/local/bin/bundle

RubyGems system software updated
Fetching ffi-1.13.1.gem
Fetching mini_portile2-2.5.0.gem
Fetching rdkafka-0.8.1.gem
Building native extensions. This could take a while...
Successfully installed ffi-1.13.1
Successfully installed mini_portile2-2.5.0
Building native extensions. This could take a while...
ERROR:  Error installing rdkafka:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/rdkafka-0.8.1/ext
/usr/local/bin/ruby -I/usr/local/lib/ruby/site_ruby/2.7.0/rubygems -rrubygems /usr/local/lib/ruby/gems/2.7.0/gems/rake-13.0.1/exe/rake RUBYARCHDIR\=/usr/local/bundle/extensions/x86_64-linux/2.7.0/rdkafka-0.8.1 RUBYLIBDIR\=/usr/local/bundle/extensions/x86_64-linux/2.7.0/rdkafka-0.8.1
rake aborted!
NameError: uninitialized constant OpenURI::OpenSSL
/usr/local/bundle/gems/rdkafka-0.8.1/ext/Rakefile:14:in `block in download_file_http'
/usr/local/bundle/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:543:in `with_tempfile'
/usr/local/bundle/gems/rdkafka-0.8.1/ext/Rakefile:12:in `download_file_http'
/usr/local/bundle/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:440:in `download_file'
/usr/local/bundle/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:54:in `block in download'
/usr/local/bundle/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:53:in `each'
/usr/local/bundle/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:53:in `download'
/usr/local/bundle/gems/mini_portile2-2.5.0/lib/mini_portile2/mini_portile.rb:150:in `cook'
/usr/local/bundle/gems/rdkafka-0.8.1/ext/Rakefile:37:in `block in <top (required)>'
Tasks: TOP => default
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/rdkafka-0.8.1 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/2.7.0/rdkafka-0.8.1/gem_make.out

The stacktrace mentions this line in the rdkafka gem, where I assume OpenURI.open_uri is being passed an https URL. OpenSSL is not explicitly mentioned in the rdkafka code, so that reference is probably made inside the C code of Ruby’s open-uri library.


I will abide by the code of conduct.

RubyGems bug report

All 3 comments

Thanks for reporting, #4165 should fix this!

Thank you David. I’ll be looking forward to the next release. 🙏🏼

Tomorrow!

Was this page helpful?
0 / 5 - 0 ratings