ruby Libxml2 缺少 mac os x 10.10
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26878263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Libxml2 missing mac os x 10.10
提问by John Smith
Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/Kartik/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
缺少 libxml2。请找到 mkmf.log 以调查它是如何失败的。
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
回答by hlv
i fiddled around with this for quite a while and the following worked for me..
我摆弄了很长一段时间,以下对我有用..
1) install libxml2 with homebrew
1)用自制软件安装libxml2
brew install libxml2
2) install the gem via
2)通过安装gem
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.4.1 -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/
回答by Taylor Smith
For any who are still getting "libxml2 version 2.6.21 or later is required!" message, removing --use-system-libraries from hlv's step 2 above, worked for me.
对于仍然“需要 libxml2 版本 2.6.21 或更高版本!”的任何人。消息,从上面的 hlv 步骤 2 中删除 --use-system-libraries,对我有用。
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.4.1 -- --with-xml=/usr/local/Cellar/libxml2/2.9.2/
回答by freytag
I finally ended up with this version independent line:
我终于得到了这个版本独立的行:
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -n /usr/local/bin -- --with-xml=/usr/local/Cellar/libxml2/
回答by jakob.j
This worked for me (assuming Xcode is installed):
这对我有用(假设安装了 Xcode):
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.?platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 --use-system-libraries
Inspired by https://stackoverflow.com/a/28767045/1884907(credits to lx00st)
灵感来自https://stackoverflow.com/a/28767045/1884907(归功于 lx00st)
回答by conny
(For MacOX 10.12.x) Perhaps you want to brew install libxml2and also try linking into /usr/local/first: brew link --force libxml2, then try that gem install nokogiri -- --use-system-libraries.
(对于 MacOX 10.12.x)也许您想brew install libxml2并尝试先链接到/usr/local/: brew link --force libxml2,然后再尝试gem install nokogiri -- --use-system-libraries.
回答by lesyk
Using ports:
使用端口:
gem install nokogiri -- --use-system-libraries --with-xml=/opt/local/lib/libxml2.a
回答by alijandro
My solution, using ports:
我的解决方案,使用端口:
sudo ARCHFLAGS='-arch x86_64' gem install nokogiri -- --use-system-libraries
sudo ARCHFLAGS='-arch x86_64' gem install nokogiri -- --use-system-libraries
By default, it will compile for x86_64 and i386, architecture for i386 should disabled, because the dependencies libraries in port only provide x86_64 version by default.
默认情况下,它会为 x86_64 和 i386 编译,应该禁用 i386 的架构,因为端口中的依赖库默认只提供 x86_64 版本。
回答by Ramses
This is a bit of a rehash of all the other answers, but this worked for me:
这是对所有其他答案的重新整理,但这对我有用:
gem install nokogiri -v '1.6.6.2' -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.16 --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 --use-system-libraries

