Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: emit helpful error when native gem fails to load glibc #2156

Merged
merged 1 commit into from
Dec 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion lib/nokogiri.rb
Original file line number Diff line number Diff line change
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