-
Notifications
You must be signed in to change notification settings - Fork 464
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
ERROR: Error installing libxml-ruby: ERROR: Failed to build gem native extension #315
Comments
I also ran into this issue when upgrading from 4.11.1 to 5.0.0. Looks like v5 depends on libxml3, while Nokogiri depends on libxml2. The way to fix it is by installing libxml2 onto your system (NOT as a gem... I tried this and failed). I added this (in my Dockerfile),
before installing the gems. But what you need will depend on what system you are running on. Here is where I found the answer and should also have the details on how to fix for other systems, https://stackoverflow.com/a/7811458/3789073 And also the guide for installing Nokogiri correctly for different systems... |
Also take a look at https://stackoverflow.com/questions/38129330/libxml-ruby-failed-to-build-gem-native-extension, which seems to have a reasonable solution similar to @mlund01's. |
I just helped a student of mine with this issue as well, and we found the following closed issues in libXML-ruby repo to be helpful (depending on your configuration): |
@DavidIValencia @mlund01 can this be closed? |
@ilanbiala really up to you. I honestly think that gems should work out of the box, especially if they conflict with super popular dependencies such as nokogiri. Yes, I can totally get this working on my own machine, but it's a much tougher sell to reconfigure production just so that I can use the most current version of the gem. As of now, I am using 4.xx of this gem so I feel confident about adding it to my production environment. Feel free to close the bug though if my feelings don't align with the goals of your team. |
@ilanbiala I think this should be further discussed as to how it should be dealt with. I think given the ubiquity of Nokogiri, you should either be very clear in the documentation about how to fix the issue, or if possible, use the same version of lib-xml. My thought is just to provide more clear documentation, because I'd rather not use an older version if I don't have to, and it was a pretty easy fix. |
I have the same problems installing this gem on windows, but I don't know what the "simple fix" is. Any ideas? |
How much trouble would it be to remove the |
twilio-ruby works with either libxml version 2 or 3. libxml2 is common enough in other gems that allowing it here will reduce gem conflicts
* Autogenerate TwiML classes * [Librarian] Regenerated @ 3c4f9f6ab80f12da0cc09d5153809cffad5eca23 * Add DeployedDevices * Release 5.1.2 * Client records the last response (#331) * Client records the last response * Twilio::Request class to wrap requests erronenous file * Adding lint back * rubocop failures * fixing test case * Faraday connetion error and 5XX tests for last_response and last_request * Additional verification * linting * explicit nil for last_response, handle situation were penultimate request succeeded but last failed * remove body * removed errorenous line * Allow libxml 2 or 3 [Fixes #315] (#330) twilio-ruby works with either libxml version 2 or 3. libxml2 is common enough in other gems that allowing it here will reduce gem conflicts * [Librarian] Regenerated @ 4b299c041980aa815254cd2ba767e17f2bf4465e * update changelog * Release 5.2.0 * Better spacing
For anyone on macOS that runs into this, I was able to fix it with:
|
For anyone who has suffered with this, I apologise. There is a fix on the horizon though, XML generation is moving to Nokogiri with this PR. Keep an eye on it, upgrade when the time comes and never worry about |
Fun fact: nokogiri includes a modified version of |
safe my time thanks a lot |
I solved this by running
|
|
Help me a lot ,thanks @Korayem I used this command before: and the following message response to me. It is as same as your solution. |
Hey everyone, The latest versions of |
libxml2 is present on macOS by default (and always has been) but the headers are in
but it should be looking like this
then everything would work. Running The following will work on macOS systems with Xcode installed:
|
To expand on @CodingMarkus's comment.
You won't need to gem install manually |
I've installed libxml2 with Homebrew so in my case this does the trick:
|
Error installing version 5.0.0. ruby version '2.3.1' using rvm
→ gem install libxml-ruby -v '3.0.0'
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
/Users/David/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20170721-35283-1f8lwpv.rb extconf.rb
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/David/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/David/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-15/2.3.0/libxml-ruby-3.0.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/David/.rvm/gems/ruby-2.3.1/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/David/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-15/2.3.0/libxml-ruby-3.0.0/gem_make.out
The text was updated successfully, but these errors were encountered: