deanpullen
deanpullen

Reputation: 128

Ruby bundler installs puma gem but puma cannot then find it's extensions

I'm trying to install and run puma.

My gemfile has the local extracted gems (the server has no internet access and bundler is install via gem install):

gem 'rack', '=2.0.3', :path => "/opt/app-root/src/gems/rack-2.0.3"
gem 'puma', '=3.11.0', :path => "/opt/app-root/src/gems/puma-3.11.0"

I run bundle like so:

bundle install --local --path ./bundle --deployment

Which produces:

Using bundler 1.16.1
Using puma 3.11.0 from source at `/opt/app-root/src/gems/puma-3.11.0`
Using rack 2.0.3 from source at `/opt/app-root/src/gems/rack-2.0.3`
Bundle complete! 2 Gemfile dependencies, 3 gems now installed.
Bundled gems are installed into `./bundle` 

Then running:

bundle exec "puma --config puma.cfg"

Produces the problem with the missing ext:

/opt/app-root/src/gems/puma-3.11.0/lib/puma/server.rb:15:in `require': cannot load such file -- puma/puma_http11 (LoadError)
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/server.rb:15:in `<top (required)>'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/runner.rb:1:in `require'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/runner.rb:1:in `<top (required)>'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/cluster.rb:1:in `require'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/cluster.rb:1:in `<top (required)>'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/launcher.rb:4:in `require'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/launcher.rb:4:in `<top (required)>'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/cli.rb:5:in `require'
    from /opt/app-root/src/gems/puma-3.11.0/lib/puma/cli.rb:5:in `<top (required)>'
    from /opt/app-root/src/gems/puma-3.11.0/bin/puma:6:in `require'
    from /opt/app-root/src/gems/puma-3.11.0/bin/puma:6:in `<top (required)>'
    from /opt/app-root/src/ruby/vendor/bundle/ruby/2.4.0/bin/puma:22:in `load'
    from /opt/app-root/src/ruby/vendor/bundle/ruby/2.4.0/bin/puma:22:in `<main>'

I can find very little information about this issue, except this post https://github.com/bundler/bundler/issues/5398 which may or may not be a similar issue - but I don't know how to resolve it (re-running bundler install doesn't help me!)

By the way, the ext is present in the extracted gem as you'd expect:

opt/app-root/src/gems/puma-3.11.0/ext/puma_http11

Upvotes: 0

Views: 1241

Answers (1)

Joe
Joe

Reputation: 42666

The puma11 stuff in ext is a compiled library; the result of that compilation as puma_http11.bundle then gets copied to the lib/puma directory, as part of the installation process. Do you have this .bundle file?

I'm guessing you have a problem or missing steps in your local extraction process to build or copy the native code portions of Gems (including this one) - the Rakefile in the puma repository on Github includes steps to build the native pieces using ragel.

Upvotes: 0

Related Questions