Home > Mobile >  Rails deployment on AWS server (EBS) | Issue with nokogiri-1.13.3-aarch64-linux wrt GLIBC_2.29
Rails deployment on AWS server (EBS) | Issue with nokogiri-1.13.3-aarch64-linux wrt GLIBC_2.29

Time:03-13

Have deployed my Rails application but now getting following error in /var/log/puma/puma.log file

Early termination of worker

ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:

  /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /var/app/current/vendor/bundle/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so) - /var/app/current/vendor/bundle/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/2.7/nokogiri.so

  If that's the case, then please install Nokogiri via the `ruby` platform gem:
      gem install nokogiri --platform=ruby
  or:
      bundle config set force_ruby_platform true

  Please visit https://nokogiri.org/tutorials/installing_nokogiri.html for more help.

[21228] ! Unable to start worker
[21228] /var/app/current/vendor/bundle/gems/nokogiri-1.13.3-aarch64-linux/lib/nokogiri/extension.rb:7:in `require_relative'

Also running the recommended gem install nokogiri --platform=ruby doesn't solve the issue.

Ruby 2.7 running on 64bit Amazon Linux 2/3.4.3

Any help is appreciated.

CodePudding user response:

Any help is appreciated.

The error message tells you exactly what's wrong:

  • you are trying to use pre-compiled nokogiri.so
  • that shared library was compiled on a GLIBC-2.29 (or newer) system and requires that version
  • you are running on a system with GLIBC-2.16 or earlier.

To fix this, you need to get nokogiri.so that is appropriate for your (old) target system. You can't just copy it from a newer system.

CodePudding user response:

The workaround I had success with was to use nokogiri 1.10.10. Prior to v1.11, nokogiri did not supply precompiled arch64 binaries, so that will force the instance to compile the gem natively.

In your Gemfile specify:

gem 'nokogiri', '1.10.10'

I previously tried setting BUNDLE_FORCE_RUBY_PLATFORM to true in the AWS EB instance configuration, but that did not seem to cause the gem to be natively compiled.

  • Related