Capitan上安装libxml

Capitan上安装libxml

本文介绍了如何在OSX El Capitan上安装libxml-ruby gem 2.3.2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装一个运行在 Ruby 1.8.7-p370 上的旧项目,并且依赖旧版本的 libxml -ruby 2.3.2 gem在运行OS X El Capitan的Mac上。



问题在于,当试图安装gem时,建立本地扩展。运行 gem install时出现完整错误libxml-ruby -v'2.3.2'

 构建原生扩展。这可能需要一段时间... 
错误:安装libxml-ruby时出错:
错误:无法构建gem本机扩展。

/Users/myusername/.rbenv/versions/1.8.7-p370/bin/ruby extconf.rb
在-lsocket中检查socket()... no
检查-lnsl中的gethostbyname()... no
检查atan()in -lm ... no
检查atan()in -lm ... yes
检查inflate()in -lz ... yes
检查iconv_open()in -liconv ... yes
检查xmlParseDoc()in -lxml2 ... yes
检查libxml / xmlversion.h ...是
创建extconf.h
创建Makefile

make
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c libxml.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_attr.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_attr_decl.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_attributes.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_cbg.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_document.c
无法理解kern.osversion`15.6.0'
ruby​​_xml_document.c:在函数'rxml_document_canonicalize'中:
ruby​​_xml_document.c :334:警告:从不兼容的指针类型
/usr/local/bin/gcc-4.2 -I中传递'xmlC14NDocDumpMemory'的参数4。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_dtd.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_encoding.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_error.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_html_parser.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_html_parser_context.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_html_parser_options.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_input_cbg.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_io.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_namespace.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_namespaces.c
无法理解kern.osversion`15.6.0'
/usr/local/bin/gcc-4.2 -I。 -一世。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -DRUBY_EXTCONF_H = \extconf.h\-I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / include -fno-common -O3 -Wno-error = shorten-64-to-32 -pipe -fno-common -I / usr / include / libxml2 -I。 -I / Users / myusername / .rbenv / versions / 1.8.7-p370 / lib / ruby​​ / 1.8 / i686-darwin15.6.0 -I。 -I / usr / local / include -c ruby​​_xml_node.c
无法理解kern.osversion`15.6.0'
ruby​​_xml_node.c:在函数'rxml_node_to_s'中:
ruby​​_xml_node.c :622:错误:解除指向不完整类型的指针
ruby​​_xml_node.c:624:错误:解除指向不完整类型的指针
make:*** [ruby_xml_node.o]错误1


Gem文件将保留安装在/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/libxml-ruby-2.3.2中进行检查。
记录到/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/libxml-ruby-2.3.2/ext/libxml/gem_make.out $ b的结果$ b

我做了一些Google搜索,但到目前为止还没有找到解决问题的方法。这里有一些我已经尝试过的东西。



一个建议是,卸载apple-gcc可能会起作用,但这让我没有编译器来构建本机扩展。 / p>

,这与 libxml-ruby 2.3.2 和OS X附带的更新版本的libxml之间的不兼容性有关。不起作用,因为MacOSX10.8 SDK似乎不再适用于Xcode。

  export SDKROOT = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform /Developer/SDKs/MacOSX10.8.sdk 

我可以采取哪些措施来解决此问题?感谢您的帮助!

解决方案

原来问题的确是由于ruby gem的不兼容版本和安装的libxml版本造成的。最后,我选择更新到一个稍微更新的gem版本,以便它正确地构建。



如果您确实需要2.3.2版,您显然也可以应用以下补丁手动:


I am trying to install an old project that runs on Ruby 1.8.7-p370 and has a dependency on an old version of the libxml-ruby 2.3.2 gem on a Mac running OS X El Capitan.

The problem is that when trying to install the gem it won't build the native extension. Here is the complete error upon running gem install libxml-ruby -v '2.3.2':

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

        /Users/myusername/.rbenv/versions/1.8.7-p370/bin/ruby extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... 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
creating extconf.h
creating Makefile

make
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c libxml.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_attr.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_attr_decl.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_attributes.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_cbg.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_document.c
couldn't understand kern.osversion `15.6.0'
ruby_xml_document.c: In function ‘rxml_document_canonicalize’:
ruby_xml_document.c:334: warning: passing argument 4 of ‘xmlC14NDocDumpMemory’ from incompatible pointer type
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_dtd.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_encoding.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_error.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_html_parser.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_html_parser_context.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_html_parser_options.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_input_cbg.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_io.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_namespace.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_namespaces.c
couldn't understand kern.osversion `15.6.0'
/usr/local/bin/gcc-4.2 -I. -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include -DRUBY_EXTCONF_H=\"extconf.h\" -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I/Users/myusername/.rbenv/versions/1.8.7-p370/include  -fno-common  -O3 -Wno-error=shorten-64-to-32  -pipe -fno-common  -I/usr/include/libxml2 -I. -I/Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/i686-darwin15.6.0 -I. -I/usr/local/include  -c ruby_xml_node.c
couldn't understand kern.osversion `15.6.0'
ruby_xml_node.c: In function ‘rxml_node_to_s’:
ruby_xml_node.c:622: error: dereferencing pointer to incomplete type
ruby_xml_node.c:624: error: dereferencing pointer to incomplete type
make: *** [ruby_xml_node.o] Error 1


Gem files will remain installed in /Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/libxml-ruby-2.3.2 for inspection.
Results logged to /Users/myusername/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/libxml-ruby-2.3.2/ext/libxml/gem_make.out

I have done some Googling but so far have not found a solution to the problem that works. Here are some of the things I have tried.

One suggestion was that uninstalling apple-gcc might work, but that leaves me without a compiler to build the native extension.

Another post suggested that this has to do with an incompatibility between libxml-ruby 2.3.2 and the more recent version of libxml that ships with OS X. However the following does not work since the MacOSX10.8 SDK does not seem to ship with Xcode anymore. Or am I missing something there?

export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

What steps can I take to remedy this problem? Thanks for your help!

解决方案

Turns out the problem was indeed caused by an incompatible version of the ruby gem and the installed libxml version. In the end I choose to update to a slightly newer version of the gem so that it builds correctly.

If you really need exactly version 2.3.2 you can apparently also apply the following patch manually: https://github.com/xml4r/libxml-ruby/commit/1c4878f3fdcd0cdf2e0fd09a5e6147a6ed237cf0

这篇关于如何在OSX El Capitan上安装libxml-ruby gem 2.3.2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:43