I'm using ruby 2.1.10 on El Capitan and trying to install libxml-ruby -v '2.7.0'.
when I run gem install libxml-ruby -v '2.7.0
I get this
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
/Users/stuartpearman/.rvm/rubies/ruby-2.1.10/bin/ruby -r ./siteconf20160527-15602-1pq16mj.rb extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... yes
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for libxml/xmlversion.h... yes
checking for rb_io_bufwrite() in ruby/io.h... yes
creating extconf.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling libxml.c
compiling ruby_xml.c
ruby_xml.c:612:23: warning: assigning to 'const char *' from 'xmlChar *' (aka 'unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
xmlTreeIndentString = xmlStrdup((xmlChar *)StringValuePtr(string));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
compiling ruby_xml_attr.c
compiling ruby_xml_attr_decl.c
ruby_xml_attr_decl.c:57:53: warning: passing 'const xmlChar *' (aka 'const unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
return rxml_new_cstr((const char*) xattr->name, xattr->doc->encoding);
^~~~~~~~~~~~~~~~~~~~
./ruby_xml_encoding.h:11:51: note: passing argument to parameter 'xencoding' here
VALUE rxml_new_cstr(const char* xstr, const char* xencoding);
^
The full error is about 600 lines, but is more of the same.
I've scoured the internet for a solution and tried many different things, but had no luck. Any ideas?
The problem was that I did not have a few necessary utilities installed on my mac.
I fixed this by running a few brew installs:
brew install libxml2 libxslt
and
brew install coreutils
After installing coreutils
, a lot of issues I was having magically disappeared.
Also, when installing Nokogiri, I had to do something very close to this:
gem install nokogiri --use-system-libraries -- --with-ldflags
Though I can't remember the exact options I used