0

I'm trying to get set up with a somewhat outdated Rails app so I can try and update it a little but I can't seem to get bundle install working. It keeps telling me:

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

The entire error is:

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

/home/camillavk/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20150122-7039-3vyx6p.rb extconf.rb                                                                      
extconf.rb:17:in `<main>': Use RbConfig instead of obsolete and deprecated Config.                                                                                       
extconf.rb:17:in `<main>': Use RbConfig instead of obsolete and deprecated Config.                                                                                       
checking for socket() in -lsocket... no                                                                                                                                  
checking for gethostbyname() in -lnsl... yes                                                                                                                             
checking for atan() in -lm... yes                                                                                                                                        
checking for inflate() in -lz... yes                                                                                                                                     
checking for iconv_open() in -liconv... no                                                                                                                               
checking for libiconv_open() in -liconv... no                                                                                                                            
checking for libiconv_open() in -llibiconv... no                                                                                                                         
checking for iconv_open() in -llibiconv... no                                                                                                                            
checking for iconv_open() in -lc... yes                                                                                                                                  
checking for xmlParseDoc() in -lxml2... yes                                                                                                                              
checking for libxml/xmlversion.h... no                                                                                                                                   
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... yes                                                          
creating extconf.h                                                                                                                                                       
creating Makefile                                                                                                                                                        

make "DESTDIR=" clean                                                                                                                                                    

make "DESTDIR="                                                                                                                                                          
compiling ruby_xml_html_parser_options.c                                                                                                                                 
compiling ruby_xml_cbg.c                                                                                                                                                 
compiling ruby_xml_html_parser.c
compiling ruby_xml_relaxng.c
compiling ruby_xml_schema.c
compiling ruby_xml_xpath_expression.c
compiling ruby_xml_parser.c
compiling ruby_xml_io.c
compiling ruby_xml_error.c
compiling ruby_xml_html_parser_context.c
ruby_xml_html_parser_context.c: In function ‘rxml_html_parser_context_options_set’:
ruby_xml_html_parser_context.c:307:7: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
   int result;
       ^
compiling ruby_xml_node.c
ruby_xml_node.c: In function ‘rxml_node_to_s’:
ruby_xml_node.c:585:54: error: dereferencing pointer to incomplete type
     result = rxml_new_cstr((const char*) output->conv->content, xencoding);
                                                      ^
ruby_xml_node.c:587:56: error: dereferencing pointer to incomplete type
     result = rxml_new_cstr((const char*) output->buffer->content, xencoding);
                                                        ^
make: *** [ruby_xml_node.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/camillavk/.rvm/gems/ruby-2.1.5/gems/libxml-ruby-2.2.2 for inspection.
Results logged to /home/camillavk/.rvm/gems/ruby-2.1.5/extensions/x86_64-linux/2.1.0/libxml-ruby-2.2.2/gem_make.out
An error occurred while installing libxml-ruby (2.2.2), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '2.2.2'` succeeds before bundling.

When I try and install libxml-ruby it says;

gem install libxml-ruby                                                                                                      *[master][ruby-2.1.5] 
Building native extensions.  This could take a while...
Successfully installed libxml-ruby-2.8.0
1 gem installed

but the same error occurs again when I use bundle install...

When I try

gem install libxml-ruby -v '2.2.2'

I get this error:

Building native extensions.  This could take a while...
ERROR:  Error installing libxml-ruby:
        ERROR: Failed to build gem native extension.

    /home/camillavk/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20150122-7254-1rcd0x0.rb extconf.rb
extconf.rb:17:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
extconf.rb:17:in `<main>': Use RbConfig instead of obsolete and deprecated Config.
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... yes
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... no
checking for libiconv_open() in -liconv... no
checking for libiconv_open() in -llibiconv... no
checking for iconv_open() in -llibiconv... no
checking for iconv_open() in -lc... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... no
checking for libxml/xmlversion.h in /opt/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... yes
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling ruby_xml_html_parser_options.c
compiling ruby_xml_cbg.c
compiling ruby_xml_html_parser.c
compiling ruby_xml_relaxng.c
compiling ruby_xml_schema.c
compiling ruby_xml_xpath_expression.c
compiling ruby_xml_parser.c
compiling ruby_xml_io.c
compiling ruby_xml_error.c
compiling ruby_xml_html_parser_context.c
ruby_xml_html_parser_context.c: In function ‘rxml_html_parser_context_options_set’:
ruby_xml_html_parser_context.c:307:7: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
   int result;
       ^
compiling ruby_xml_node.c
ruby_xml_node.c: In function ‘rxml_node_to_s’:
ruby_xml_node.c:585:54: error: dereferencing pointer to incomplete type
     result = rxml_new_cstr((const char*) output->conv->content, xencoding);
                                                      ^
ruby_xml_node.c:587:56: error: dereferencing pointer to incomplete type
     result = rxml_new_cstr((const char*) output->buffer->content, xencoding);
                                                        ^
make: *** [ruby_xml_node.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/camillavk/.rvm/gems/ruby-2.1.5/gems/libxml-ruby-2.2.2 for inspection.
Results logged to /home/camillavk/.rvm/gems/ruby-2.1.5/extensions/x86_64-linux/2.1.0/libxml-ruby-2.2.2/gem_make.out

I'm running this on linux -> does anyone have any idea how I can get around this or fix it?

Thanks

camillavk
  • 521
  • 5
  • 20
  • This looks a lot like libxml-ruby [issue #49](https://github.com/xml4r/libxml-ruby/issues/49). The version of libxml2 on your system is probably too recent to work with the version of libxml-ruby you are trying to install. – Phil Ross Jan 22 '15 at 15:03
  • I agree that it looks like the version of libxml2 on my system is too recent to work with the version I'm trying to install but I don't know how to force my system to use the older version...I tried the stuff in the link you sent but that hasn't changed anything... – camillavk Jan 22 '15 at 15:17
  • 1
    Can you upgrade your Rails project to libxml-ruby 2.4.0 (the version that fixes this issue)? It doesn't look like there are any breaking [changes](https://github.com/xml4r/libxml-ruby/blob/master/HISTORY) between 2.2.2 and 2.4.0. – Phil Ross Jan 22 '15 at 15:24
  • Thank you @PhilRoss, this fixed the issue – Umid Jun 19 '17 at 10:53

0 Answers0