Skip to content

Commit

Permalink
fix: emit helpful error when native gem fails to load glibc
Browse files Browse the repository at this point in the history
Specifically, older systems may not meet our expectations for glibc,
and this commit attempts to help those poor souls find a path forward.

I manually tested this change using the OCI image at:

  registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/centos_6:0.0.72

Closes #2081
  • Loading branch information
flavorjones committed Dec 31, 2020
1 parent 50b23c1 commit d01d7d9
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/nokogiri.rb
Expand Up @@ -11,7 +11,24 @@
begin
RUBY_VERSION =~ /(\d+\.\d+)/
require "nokogiri/#{$1}/nokogiri"
rescue LoadError
rescue LoadError => e
if e.message =~ /GLIBC/
warn <<~EOM
ERROR: It looks like you're trying to use Nokogiri as a precompiled native gem on a system with glibc < 2.17:
#{e.message}
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.
EOM
raise e
end
require 'nokogiri/nokogiri'
end
require 'nokogiri/version'
Expand Down

0 comments on commit d01d7d9

Please sign in to comment.