Libxml2 missing mac os x 10.10

2019-01-16 10:02发布

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.

*** 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.

标签: ruby libxml2
7条回答
我想做一个坏孩纸
2楼-- · 2019-01-16 10:47

i fiddled around with this for quite a while and the following worked for me..

1) install libxml2 with homebrew

brew install libxml2

2) install the gem via

sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.4.1 -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/
查看更多
男人必须洒脱
3楼-- · 2019-01-16 10:55

This worked for me (assuming Xcode is installed):

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)

查看更多
疯言疯语
4楼-- · 2019-01-16 10:58

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/
查看更多
姐就是有狂的资本
5楼-- · 2019-01-16 10:59

Using ports:

gem install nokogiri -- --use-system-libraries --with-xml=/opt/local/lib/libxml2.a
查看更多
三岁会撩人
6楼-- · 2019-01-16 11:00

(For MacOX 10.12.x) Perhaps you want to brew install libxml2 and also try linking into /usr/local/ first: brew link --force libxml2, then try that gem install nokogiri -- --use-system-libraries.

查看更多
劳资没心,怎么记你
7楼-- · 2019-01-16 11:01

My solution, using ports:

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.

查看更多
登录 后发表回答