5

After having hours of trouble trying to install the twill-ruby gem in both a regular script and rails app I've come to the pros.

The error I'm getting is "In Gemfile: twilio-ruby was resolved to 5.2.0, which depends on libxml-ruby "

I tried installing the libxml gem into my gem file and that fails as well with the error "Gem::Ext::BuildError: ERROR: Failed to build gem native extension." and then at the bottom it says "An error occurred while installing libxml-ruby (3.0.0), and Bundler cannot continue. Make sure that gem install libxml-ruby -v '3.0.0' succeeds before bundling."

the rails version I'm using is 4.2.4 and my OS is MACOS Sierra. The entire output when i try to bundle install with the twilio gem is below. Ive read a few articles on Stack but nothing has helped so far :

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/jameshart/.rvm/gems/ruby-2.3.0/gems/libxml-ruby-3.0.0/ext/libxml
/Users/jameshart/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20170829-79771-thonjl.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/jameshart/.rvm/rubies/ruby-2.3.0/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.

    Install the library or try one of the following options to extconf.rb:

      --with-xml2-config=/path/to/xml2-config
      --with-xml2-dir=/path/to/libxml2
      --with-xml2-lib=/path/to/libxml2/lib
      --with-xml2-include=/path/to/libxml2/include


To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/jameshart/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/libxml-ruby-3.0.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/jameshart/.rvm/gems/ruby-2.3.0/gems/libxml-ruby-3.0.0 for inspection.
Results logged to /Users/jameshart/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/libxml-ruby-3.0.0/gem_make.out

An error occurred while installing libxml-ruby (3.0.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '3.0.0'` succeeds before bundling.

In Gemfile:
  twilio-ruby was resolved to 5.2.0, which depends on
    libxml-ruby
Cœur
  • 37,241
  • 25
  • 195
  • 267
James H
  • 562
  • 2
  • 7
  • 20
  • I have MacOs Sierra and haven't installed the Twilio gem before. I did `gem list` and could see that I had `libxml-ruby (2.6.0)` installed. I ran `sudo gem install twilio-ruby` and it installed the Twilio 5.2.0 gem ok. I don't have a `.rvm` directory in my home folder. I wonder if you can somehow try removing that version and get back to the "native" one? Sorry this isn't much help! – Andy Aug 29 '17 at 21:09
  • I wound up installing version 4.11 and everything worked out easy. Thanks. You're the man – James H Aug 29 '17 at 21:51
  • Possible duplicate of [libxml-ruby: Failed to build gem native extension](https://stackoverflow.com/questions/38129330/libxml-ruby-failed-to-build-gem-native-extension) – philnash Aug 30 '17 at 09:40

1 Answers1

1

I found a solution! (Running on Debian 9)

sudo apt-get install -y libxml2-dev

gem install libxml-ruby -v '3.0.0' 

bundle install

Seems like a problem with libxml-ruby trying to use libxml2

Jorge Ga
  • 21
  • 1
  • 4