Saj*_*jah 33 ruby-on-rails nokogiri osx-lion
sudo gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/sajeev86/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
checking for libxml/parser.h... 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.
Run Code Online (Sandbox Code Playgroud)
我无法安装Nokogiri.这对我来说已经有一段时间了.我也通过MacPorts和Homebrew安装了依赖项.
我有一种感觉,正确的目录没有彼此指向?但不知道如何解决.
Edu*_*rdo 43
在Mavericks中,NOKOGIRI_USE_SYSTEM_LIBRARIES=1在安装gem之前安装带有Homebrew的库并进行设置对我来说是个窍门.
总结:
如果以前安装过,请卸载gem:
$ gem uninstall nokogiri
使用Homebrew进行安装libxml2,libxslt并且libiconv:
$ brew install libxml2 libxslt libiconv
安装gem指定要链接的库的路径:
$ NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install nokogiri -- --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
Cra*_*tes 32
绝对没有其他答案在这里为我工作.
在最新版本的小牛队中,唯一能成功的方法如下:
$ brew install libxml2 libxslt libiconv
$ sudo gem install nokogiri -v '1.6.5' -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
Run Code Online (Sandbox Code Playgroud)
小智 16
狮子座上发生了同样的问题.花了几个小时阅读帖子,尝试自制软件,macports等.当我发现这篇文章并阅读.rvm/gems/ruby-1.8.7-p358/gems/nokogiri-1.4.4/ext/nokogiri/mkmf的内容时.记录,我看到:
find_header: checking for libxml/parser.h... -------------------- no
"/usr/bin/gcc-4.2 -E -I. -I/Users/me/.rvm/rubies/ruby-1.8.7-p358/lib/ruby/1.8/i686-darwin10.8.0 -I. -I-I-I/opt/local/include -I-I-I/usr/local/include -I-I-I/Users/me/.rvm/rubies/ruby-1.8.7-p358/include -I-I-I/usr/include -I-I-I/usr/include/libxml2 -I/opt/local/include/libxml2 -I/usr/local/include/libxml2 -I/Users/me/.rvm/rubies/ruby-1.8.7-p358/include/libxml2 -I-I/opt/local/include -I-I/usr/local/include -I-I/Users/me/.rvm/rubies/ruby-1.8.7-p358/include -I-I/usr/include -I-I/usr/include/libxml2 -I/opt/local/include -I/usr/local/include -I/Users/me/.rvm/rubies/ruby-1.8.7-p358/include -I/usr/include -I/usr/include/libxml2 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -g -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <libxml/parser.h>
/* end */
Run Code Online (Sandbox Code Playgroud)
但是,gcc-4.2不存在:
$ ls /usr/bin/gcc*
/usr/bin/gcc
Run Code Online (Sandbox Code Playgroud)
因此,我能够解决这个问题并通过将gcc-4.2作为gcc的符号链接来安装nokogiri.
sudo ln -s gcc gcc-4.2
Run Code Online (Sandbox Code Playgroud)
shi*_*ret 10
我为Mavrick遇到了同样的问题,解决方案是
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
然而,这不起作用,因为苹果下载页面没有公开可用的安装程序.因此,如果您想拥有Mavricks的命令行工具,您需要拥有一个付费帐户,那么只有您才能安装它.一旦你安装它,你将不会遇到这个Nokogiri问题.
检查错误消息中给出的URL(http://nokogiri.org/tutorials/installing_nokogiri.html)我认为问题是您使用的是什么版本的Homebrew?
brew -v
Run Code Online (Sandbox Code Playgroud)
我会更新到0.8+
brew update
brew upgrade
Run Code Online (Sandbox Code Playgroud)
然后再次尝试安装:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
Run Code Online (Sandbox Code Playgroud)
brew install libxml2 libxslt
gem install nokogiri -v '1.6.5' -- --use-system-libraries
Run Code Online (Sandbox Code Playgroud)
至于我,它有助于:
brew install libxml2 libxslt
Run Code Online (Sandbox Code Playgroud)
如果许可被拒绝 sudo chown -R $USER /Library/Caches/Homebrew/
sudo env ARCHFLAGS="-arch x86_64"
export NOKOGIRI_USE_SYSTEM_LIBRARIES=1
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 gem install nokogiri
Run Code Online (Sandbox Code Playgroud)
尝试添加--with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib到您的命令中,假设这是 MacPorts libxml2.
| 归档时间: |
|
| 查看次数: |
23528 次 |
| 最近记录: |