如何在 OSX El Capitan 上安装 libxml-ruby gem 2.3.2?
How do I install libxml-ruby gem 2.3.2 on OSX El Capitan?
我正在尝试安装一个旧项目,该项目在 Ruby 1.8.7-p370
上运行并且依赖于旧版本的 libxml-ruby 2.3.2
gem Mac 运行 OS X El Capitan.
问题是,当尝试安装 gem 时,它不会构建本机扩展。这是 运行 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
我已经进行了一些谷歌搜索,但到目前为止还没有找到解决问题的有效方法。以下是我尝试过的一些方法。
一个建议是卸载 apple-gcc 可能有效,但这让我没有编译器来构建本机扩展。
Another post suggested 这与 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 版,您显然也可以手动应用以下补丁:https://github.com/xml4r/libxml-ruby/commit/1c4878f3fdcd0cdf2e0fd09a5e6147a6ed237cf0
我正在尝试安装一个旧项目,该项目在 Ruby 1.8.7-p370
上运行并且依赖于旧版本的 libxml-ruby 2.3.2
gem Mac 运行 OS X El Capitan.
问题是,当尝试安装 gem 时,它不会构建本机扩展。这是 运行 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
我已经进行了一些谷歌搜索,但到目前为止还没有找到解决问题的有效方法。以下是我尝试过的一些方法。
一个建议是卸载 apple-gcc 可能有效,但这让我没有编译器来构建本机扩展。
Another post suggested 这与 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 版,您显然也可以手动应用以下补丁:https://github.com/xml4r/libxml-ruby/commit/1c4878f3fdcd0cdf2e0fd09a5e6147a6ed237cf0