Building native gems on windows with bundler

I’m trying to bundle install a Gemfile which contains libxml-ruby. I
can build it via gem install libxml-ruby -v 1.1.3 --platform
x86-mswin32-60 but gem install libxl-ruby -v 1.1.3
throws the usual “ERROR: Failed to build gem native extension” as does
bundle install.
Is there a way to tell bundler to use the x86-mswin32-60 version of the
gem or am I missing something else completely. The only stack trace is
c:/Ruby19/bin/ruby.exe extconf.rb
extconf.rb:6: stack level too deep (SystemStackError)

I had installed the libxml libraries but maybe they were in the wrong
place or the PATH was wrong? Anyway, i’ve installed libxml-ruby 2.0.x as
you suggested and so far everything seems ok. Thanks for the reply.

Ian D. wrote in post #1032304:

I’m trying to bundle install a Gemfile which contains libxml-ruby. I
can build it via gem install libxml-ruby -v 1.1.3 --platform
x86-mswin32-60 but gem install libxl-ruby -v 1.1.3
throws the usual “ERROR: Failed to build gem native extension” as does
bundle install.
Is there a way to tell bundler to use the x86-mswin32-60 version of the
gem or am I missing something else completely. The only stack trace is
c:/Ruby19/bin/ruby.exe extconf.rb
extconf.rb:6: stack level too deep (SystemStackError)

libxml-ruby gem requires libxml2 and other support libraries.

That will be the reason why is failing to install.

Are you using Ruby provided by RubyInstaller?

Gem author of libxml-ruby has provided in it’s version 2.0 binaries for
mingw32 platform, which will not trigger the gem compilation process
using bundler.

Can you upgrade to libxml-ruby 2.0.x?


Luis L.

Ian D. wrote in post #1032351:

I had installed the libxml libraries but maybe they were in the wrong
place or the PATH was wrong? Anyway, i’ve installed libxml-ruby 2.0.x as
you suggested and so far everything seems ok. Thanks for the reply.

You will need libxml development headers and libraries, which is
complicated as the binaries and headers for Windows are not easy to
install and use.

Also, you need to use gem installation flags:

gem install libxml-ruby – --with-libxml-dir=…

But that depends on the gem to work (you can look at the extension
extconf.rb for the options)

Yet again, if you can use the latest version that already provides
binaries, then way better :slight_smile:

Cheers,

Luis L.