Nokogiri installation fails -libxml2 is missing
First, install the dependencies:
sudo apt-get install libxslt-dev libxml2-dev
If you still receive the error, you may be missing a compiler toolchain:
sudo apt-get install build-essential
You'll get the "libxml2 is missing" error if you're missing a build toolchain (at least I ran into this issue on Debian Lenny).
The Nokogiri build test-compiles a libxml2 header file to verify that it is present, however, it doesn't differentiate between "libxml2 is missing" and "a compiler to test libxml2 is missing".
How to solve libxml2 missing package error on gem install ovirt-engine-sdk on Windows?
I'm unfamiliar with ovirt-engine-sdk, and can't find any information on their github to imply they support windows (it's not guaranteed, especially for gems with native extensions). But we can definitely work around this particular error. To help show you how to deal with similar problems in the future, here's my process to troubleshoot this.
$ gem fetch ovirt-engine-sdk
$ gem unpack ovirt-engine-sdk-4.3.0.gem
$ cat ovirt-engine-sdk-4.3.0/ext/ovirtsdk4c/extconf.rb
The relevant portion is here (found by searching for the error message):
xml2_config = find_executable('xml2-config')
if xml2_config
# other stuff
elsif !pkg_config('libxml2')
raise 'The "libxml2" package isn\'t available.'
end
We can see it's checking for an executable named xml2-config
. According to the documentation for find_executable, it checks your path for that.
So, this means we need two things to fix this error:
- The xml2-config executable
- We need to add that to our path. It sounds like this is the step you're missing.
You can download from here -
Then add the entire bin folder to your path.
libxml2 missing for nokogiri gem on Windows 8 x64 with Ruby 1.9.3
@Steve - There is a new version of nokogiri (1.6.2) that supports x64 Ruby (this worked for me on Win7 x64 Ruby 200). At time of writing it's in pre-release, install using:
gem install nokogiri --prerelease
Issues installing libxml gem for ruby on windows
I was unsuccessful with installing libxml version 2.9.0 but 2.7.0 worked just fine. I should specify I'm running windows 7 and Ruby 2.0 32 bit. Here is what I had to do:
-I followed Wik's response here, grabbing all the missing libraries from them mingw64. Admittedly, I'm not sure if I needed all of them, but I sort of took a shotgun approach here.
Added the following to my system path:
Ruby200\lib\ruby\gems\2.0.0\gems\libxml-ruby-2.7.0-x86-mingw32\lib\libs
Executed the following in command line:
gem install libxml-ruby -v2.7.0 -- with-xml2-include:=C/Ruby200/include/libxml2 --with-iconv-include:=C:/Ruby200/include
After that, I the gem, at long last, installed and was actually usable.
Error installing Nokogiri gem
I fixed the problem by first using brew install libxml2 libxslt
. I then had to download the old xcode-select developer tools from late October found here https://developer.apple.com/downloads/index.action#
After that, running sudo gem install nokogiri
finally worked.
Related Topics
How to Reference a Method in Another Ruby Code File
Could Not Find Rake with Bundle Exec
Save Image with Mechanize and Nokogiri
Ruby 1.9.2 - Read and Parse a Remote CSV
Sidekiq Worker Not Getting Triggered
How Can One Set Property Values When Initializing an Object in Ruby
Write Array of Radix-2 Numeric Strings to Binary File in Ruby
Ruby: How to Check If a String Contains Multiple Items
Ftps (Tls/Ssl) from Ruby on Rails App
Ruby Scope of Data After _End_
How to Convert Activerecord Table Name to Model Class Name
How to Get a List of Gems That Are Installed That Have Native Extensions
Could Not Find Rake-10.0.4 in Any of the Sources (Bundler::Gemnotfound)
How to Share State Between Scenarios Using Cucumber