简体   繁体   English

无法在Mac OS X上安装nokogiri和webrat

[英]Failed to install nokogiri and webrat on Mac OS X

I was trying to install webrat on my Mac, but I've got the error, that the iconv.h is missing. 我试图在Mac上安装webrat,但出现错误,丢失了iconv.h。 Here is the log: 这是日志:

    Building native extensions.  This could take a while...
ERROR:  Error installing webrat:
 ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/include/libxml2,/usr/include,/usr/include/libxml2... no
iconv is missing.  try 'port install iconv' or 'yum install iconv'
*** 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/1.8/usr/bin/ruby
 --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


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.1/ext/nokogiri/gem_make.out

The weird thing is, that the iconv.h is already in the /opt/local/include/ directory. 奇怪的是,iconv.h已经在/ opt / local / include /目录中。

Can anyone recommend a solution? 谁能推荐解决方案?

thx, tux 礼服

Ok, I solved it on my own. 好的,我自己解决了。 After a couple of days on research and trying I figured out, that my installation of g++ and gcc was broken. 经过几天的研究并尝试了一下,发现我安装的g ++和gcc坏了。 I've installed an update of g++ through macports, and in the .profile file of my current user there was a value in the PATH var from macports. 我已经通过macports安装了g ++的更新,并且在当前用户的.profile文件中,macports的PATH变量中有一个值。 I removed it, and now it works. 我删除了它,现在它可以了。

The PATH var should look like this: PATH变量应如下所示:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

More help on Nokogiri website, using macports or homebrew for Mac OS X install: 在Mac OS X上使用macportshomebrew在Nokogiri网站上获得更多帮助:

http://nokogiri.org/tutorials/installing_nokogiri.html http://nokogiri.org/tutorials/installing_nokogiri.html

For iconv related problems, please refer to this issue on github: 对于与iconv相关的问题,请在github上参考此问题:

https://github.com/tenderlove/nokogiri/issues/381 https://github.com/tenderlove/nokogiri/issues/381

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

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