gda*_*vis 53 ruby gem homebrew nokogiri bundler
我最近升级到10.10优胜美地测试版,但是我在安装Nokogiri时遇到了麻烦.我正在使用RVM和Ruby 1.9.3.我也按照这里的步骤尝试按照Nokogiri主页上的说明进行操作.
我通过自制程序安装了libxml2(2.9.1)和libxslt(1.1.28),并尝试使用我的Xcode 5安装和Xcode 6 beta中的命令行工具.
gem install nokogiri -v '1.5.5'
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb
checking for libxml/parser.h... *** 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
--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=/Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/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-libiconv-config
--without-libiconv-config
/Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/grantdavis/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:114:in `<main>'
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何解决这些安装错误?
编辑6/10/14:尝试了几天在OSX 10.10上安装Nokogiri之后,我最终放弃了任务并在我的机器上恢复了10.9.需要更新多个库和包才能在10.10环境中工作.
act*_*ars 79
我设法在Yosemite(OS X 10.10预览版)下安装Nokogiri.
如果安装了brew,请跳过此步骤.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run Code Online (Sandbox Code Playgroud)
brew tap homebrew/dupes
brew install libxml2 libxslt
brew install libiconv
Run Code Online (Sandbox Code Playgroud)
安装后需要重启是很重要的.
链接:command_line_tools_for_osx_10_10_june_2014.dmg
重新启动后,您可以检查终端中的安装:
> xcode-select --install
-> xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Run Code Online (Sandbox Code Playgroud)
此错误表示您已正确安装命令行工具.
尝试在Gemfile中使用n之前的版本1.6.1,版本1.6.2.1目前存在"10.10预览"的问题.它只适用于我的rbenv Ruby 2.0.0p247,无法在2.1.1上安装.您可以尝试对现有的Ruby版本进行几次尝试.
gem install nokogiri -v '1.6.1' -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
Run Code Online (Sandbox Code Playgroud)
xra*_*age 63
优胜美地的libxml2 - 1.6.6.2:
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -- --use-system-libraries -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.2/lib --with-xslt-lib=/usr/local/lib --with-xslt-include=/usr/local/include
Run Code Online (Sandbox Code Playgroud)
Max*_*s S 22
对于Mac OS El Capitan:
gem install nokogiri -v '1.6.7.1' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2
Tom*_*man 18
这对我有用:
ARCHFLAGS="-arch x86_64" gem install nokogiri -v '1.6.0'
Run Code Online (Sandbox Code Playgroud)
我遇到了与MacPorts ruby2.1相同的问题:
can not gem install nokogiri on osx10.10 with macports ruby2.1
Run Code Online (Sandbox Code Playgroud)
安装开始,cpu在100%的单核上达到50%,然后CPU下降到接近零,但是iostat tps通过了墙.
这有助于:
# port install libiconv libxslt libxml2
# gem install nokogiri -- --use-system-libraries --with-iconv-dir=/opt/local --with-xml2-dir=/opt/local --with-xslt-dir=/opt/local
Run Code Online (Sandbox Code Playgroud)
小智 5
这最终对我有用:
sudo gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
Run Code Online (Sandbox Code Playgroud)
对于其他任何一个无法在El Capitan上工作的人来说,最终对我有用的是:
sudo gem install nokogiri -- --use-system-libraries --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-include=/usr/local/opt/libxml2/include/libxml2 --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config
Run Code Online (Sandbox Code Playgroud)
我没有安装macports,我的系统是一个奇怪的大杂烩.强制每个依赖项的特定安装是我可以让Nokogiri编译的唯一方法.超级烦人,但至少它的工作原理.
| 归档时间: |
|
| 查看次数: |
30733 次 |
| 最近记录: |