gpt4 book ai didi

ruby - 如何将 Nokogiri 安装为 Macruby gem?

转载 作者:数据小太阳 更新时间:2023-10-29 08:02:07 24 4
gpt4 key购买 nike

最新的 MacRuby 发行说明 (v0.6) 声明作者已设法让此版本与 SQLite 和 Nokogiri gem 一起使用。但是,当我运行 sudo macgem install nokogiri 时,出现以下错误:

ERROR:  Error installing nokogiri:

extconf 失败:

然后是一堆路径,后面跟着:

libxml2 is missing.  try 'port install libxml2' or 'yum install libxml2'
/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/lib/ruby/Gems/1.9.0/gems/nokogiri-1.4.1/ext/nokogiri/extconf.rb:1:in `<main>': libxml2 is missing. try 'port install libxml2' or 'yum install libxml2' (SystemExit)

有人知道如何让它工作吗?我的平台是 Mac OS X 10.6.3。 Nokogiri 通常(意味着在普通的旧 ruby​​ 1.8.7 上)安装没有问题。

进度

好的,所以我有:

  1. git clone http://github.com/tenderlove/nokogiri.git
  2. cd nokogiri/ext/nokogiri
  3. 然后我用 sudo port upgrade --enforce-variants libxml2 +universalsudo port upgrade --enforce-variants libxslt +universal 重建了 macports 库/li>
  4. 然后我成功执行了macruby extconf.rb
  5. 然后我继续制作

此时错误如下:

/usr/bin/gcc -I. -I/opt/local/include/libxml2 -I/opt/local/include/ -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/universal-darwin10.0 -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0/ruby/backward -I/Library/Frameworks/MacRuby.framework/Versions/0.6/usr/include/ruby-1.9.0 -I. -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETPARSERSTRUCTUREDERRORS -DHAVE_XMLRELAXNGSETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETVALIDSTRUCTUREDERRORS -DHAVE_XMLSCHEMASETPARSERSTRUCTUREDERRORS -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include  -fno-common -fexceptions -fno-common -pipe -O3 -g -Wall -Wno-parentheses  -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -arch i386 -arch x86_64 -o html_document.o -c html_document.c
In file included from ./html_document.h:4,
from html_document.c:1:
./nokogiri.h:35:16: error: st.h: No such file or directory
In file included from ./html_document.h:4,
from html_document.c:1:
./nokogiri.h:35:16: error: st.h: No such file or directory
lipo: can't open input file: /var/folders/wU/wUGgoG1JGeKBgwalWLPMAU+++TI/-Tmp-//ccSgAUv5.out (No such file or directory)
make: *** [html_document.o] Error 1

最佳答案

我认为你必须从源代码构建,因为只有 Nokogiri 的头部是 MacRuby 兼容的

关于ruby - 如何将 Nokogiri 安装为 Macruby gem?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2776195/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com