Ruby on rails libxml ruby无法生成本机扩展
我在El Capitan上使用ruby 2.1.10,并尝试安装libxml ruby-v“2.7.0” 当我运行Ruby on rails libxml ruby无法生成本机扩展,ruby-on-rails,ruby,osx-elcapitan,Ruby On Rails,Ruby,Osx Elcapitan,我在El Capitan上使用ruby 2.1.10,并尝试安装libxml ruby-v“2.7.0” 当我运行gem安装libxmlruby-v'2.7.0时,我得到了这个 Building native extensions. This could take a while... ERROR: Error installing libxml-ruby: ERROR: Failed to build gem native extension. /Users/stuart
gem安装libxmlruby-v'2.7.0时,我得到了这个
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);
^
完全错误大约为600行,但更多的是相同的
我在互联网上搜索了一个解决方案,尝试了许多不同的方法,但没有成功。有什么想法吗?安装最新版本的libxml-ruby,它马上就可以工作了
gem install libxml-ruby
我用sudo-apt-get-y libxml2-dev安装了libxml2-dev
然后gemi-libxml-ruby
工作了。问题是我的mac上没有安装一些必要的实用程序
我通过运行一些brew安装来修复此问题:
brew install libxml2 libxslt
及
在安装了coreutils
之后,我遇到的大量问题神奇地消失了
另外,在安装Nokogiri时,我必须做一些与此非常接近的事情:
gem install nokogiri --use-system-libraries -- --with-ldflags
虽然我记不起我使用的确切选项但最新版本不适合我。请安装libiconv、iconv和lsocket?此软件包丢失iconv安装失败,我可以安装libiconv,根据我所了解的,您不应该在mac上安装-lsocket
gem install nokogiri --use-system-libraries -- --with-ldflags