简体   繁体   English

在Mac OS X上安装Nokogiri gem时出错

[英]Error installing Nokogiri gem on Mac OS X

I was trying to install a connector for Rally and bugzilla on my Mac OSx. 我试图在我的Mac OSx上为Rallybugzilla安装连接器。 While running the install script, it tries to install the gems and it looks for the libxml2 which is already present on my machine. 在运行安装脚本时,它会尝试安装gem,并查找已在我的计算机上存在的libxml2

This happens when it tries to install nokogiri. 当它试图安装nokogiri时会发生这种情况。

This is the transcript: 这是成绩单:

Building native extensions with: '--use-system-libraries'
This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150121-48754-wgouyu.rb extconf.rb --use-system-libraries
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.4.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.4.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin13.4.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.4.0/libxslt/1.1.26)...
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... no
-----
`  libxml2 is missing.  please visit http://nokogiri.org/tutorials /installing_nokogiri.html for help with installing dependencies.`
-----
*** 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --with-iconv-dir
    --without-iconv-dir
    --with-iconv-include
    --without-iconv-include=${iconv-dir}/include
    --with-iconv-lib
    --without-iconv-lib=${iconv-dir}/lib
    --with-xml2-dir
    --without-xml2-dir
    --with-xml2-include
    --without-xml2-include=${xml2-dir}/include
    --with-xml2-lib
    --without-xml2-lib=${xml2-dir}/lib
    --with-xslt-dir
    --without-xslt-dir
    --with-xslt-include
    --without-xslt-include=${xslt-dir}/include
    --with-xslt-lib
    --without-xslt-lib=${xslt-dir}/lib
    --with-libxslt-config
    --without-libxslt-config
    --with-pkg-config
    --without-pkg-config
    --with-libxml-2.0-config
    --without-libxml-2.0-config
    --with-pkg-config
    --without-pkg-config
    --with-libiconv-config
    --without-libiconv-config
    --with-pkg-config
    --without-pkg-config
    --with-iconvlib
    --without-iconvlib
    --with-xml2lib
    --without-xml2lib

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/nokogiri-1.6.1/gem_make.out

I tried so many options like installing the command line tools by running the below command. 我通过运行以下命令尝试了很多选项,比如安装命令行工具。 xcode-select --install

Adding the symbolic links to gcc compliler 添加符号链接到gcc compliler

sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2

I have been struggling for the past two days. 过去两天我一直在苦苦挣扎。 Any help is highly apperciated. 任何帮助都是高度关注的。

If you are using brew use this in the terminal: 如果您正在使用brew,请在终端中使用:

brew unlink gcc-4.2      # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

If this didn't work please check " Installing Nokogiri on OSX 10.10 Yosemite " 如果这不起作用,请检查“ 在OSX 10.10 Yosemite上安装Nokogiri

Solved the issue with the command 用命令解决了这个问题

sudo ARCHFLAGS="-arch x86_64" gem install nokogiri -v '1.6.1'

thanks for the link pointed out by mohamed abd. 感谢mohamed abd指出的链接。

这对我有用:

sudo gem install nokogiri --no-rdoc --no-ri

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM