我知道这是一个在这里多次“解决”的问题,但我尝试了所有的解决方案,仍然无法实现。这是我的错误:Ruby 2.1和Nokogiri安装错误?
22-01-14 17:57:56> gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/josh/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb
Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0/configure.log' to see what happened.
*** 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=/Users/josh/.rvm/rubies/ruby-2.1.0/bin/ruby
/Users/josh/.rvm/gems/ruby-2.1.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:265:in `block in execute': Failed to complete configure task (RuntimeError)
from /Users/josh/.rvm/gems/ruby-2.1.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `chdir'
from /Users/josh/.rvm/gems/ruby-2.1.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:257:in `execute'
from /Users/josh/.rvm/gems/ruby-2.1.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:65:in `configure'
from /Users/josh/.rvm/gems/ruby-2.1.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:108:in `cook'
from extconf.rb:101:in `block in <main>'
from extconf.rb:119:in `call'
from extconf.rb:119:in `block in <main>'
from extconf.rb:109:in `tap'
from extconf.rb:109:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/josh/.rvm/gems/ruby-2.1.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /Users/josh/.rvm/gems/ruby-2.1.0/extensions/x86_64-darwin-12/2.1.0-static/nokogiri-1.6.1/gem_make.out
当我已经通过BREW安装的libxml2:
22-01-14 17:57:56> brew list
ab cmake freetype gettext jpeg libksba libvo-aacenc lzlib openjpeg proj speex xvid
apple-gcc42 elasticsearch freexl giflib json-c liblwgeom libvorbis memcached openssl qt sqlite xz
apr faac frei0r git lame libogg libvpx mongodb opus readline texi2html yasm
apr-util fdk-aac fribidi gpp libass libpng libxml2 mysql orc redis theora
autoconf ffmpeg gd graphviz libevent libspatialite libxslt node pcre rtmpdump ttfautohint
automake fontconfig gdal grep libgeotiff libtiff libyaml openconnect phantomjs schroedinger wkhtmltopdf
cloc fontforge geos imagemagick libgpg-error libtool little-cms2 opencore-amr pkg-config sdl x264
22-01-14 17:57:56> brew list libxml2
/usr/local/Cellar/libxml2/2.8.0/bin/xmllint
/usr/local/Cellar/libxml2/2.8.0/bin/xmlcatalog
/usr/local/Cellar/libxml2/2.8.0/bin/xml2-config
/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ (47 files)
/usr/local/Cellar/libxml2/2.8.0/lib/libxml2.2.dylib
/usr/local/Cellar/libxml2/2.8.0/lib/pkgconfig/libxml-2.0.pc
/usr/local/Cellar/libxml2/2.8.0/lib/ (3 other files)
/usr/local/Cellar/libxml2/2.8.0/share/aclocal/libxml.m4
/usr/local/Cellar/libxml2/2.8.0/share/doc/ (121 files)
/usr/local/Cellar/libxml2/2.8.0/share/gtk-doc/ (55 files)
/usr/local/Cellar/libxml2/2.8.0/share/man/ (4 files)
和RVM:
22-01-14 17:57:56> rvm list
rvm rubies
=* ruby-2.1.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
和GCC:
22-01-14 17:57:56> gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.2
Thread model: posix
我曾尝试一切在这个和其他线程: “Install Nokogiri 1.6.1 under Ruby 2.0.0p353 (rvm based installation) fails (OSX Mavericks)?”
另外我甚至没有在我的Gemfile中定义Nokogiri。
OK,我发现configure.log文件:
1 checking build system type... i386-apple-darwin13.0.2
2 checking host system type... i386-apple-darwin13.0.2
3 checking for a BSD-compatible install... /usr/bin/install -c
4 checking whether build environment is sane... yes
5 checking for a thread-safe mkdir -p... ./install-sh -c -d
6 checking for gawk... no
7 checking for mawk... no
8 checking for nawk... no
9 checking for awk... awk
10 checking whether make sets $(MAKE)... yes
11 checking for gcc... gcc-4.2.1
12 checking whether the C compiler works... no
13 configure: error: in `/Users/josh/.rvm/gems/ruby-2.1.0/gems/nokogiri-1.6.1/ext/nokogiri/tmp/ports/libxml2/2.8.0/libxml2-2.8.0':
14 configure: error: C compiler cannot create executables
15 See `config.log' for more details
而在我的config.log发现:
83 configure:3326: checking for C compiler version
84 configure:3335: gcc-4.2.1 --version >&5
85 configure: line 3337: gcc-4.2.1: command not found
86 configure:3346: $? = 127
87 configure:3335: gcc-4.2.1 -v >&5
88 configure: line 3337: gcc-4.2.1: command not found
89 configure:3346: $? = 127
90 configure:3335: gcc-4.2.1 -V >&5
91 configure: line 3337: gcc-4.2.1: command not found
92 configure:3346: $? = 127
93 configure:3335: gcc-4.2.1 -qversion >&5
94 configure: line 3337: gcc-4.2.1: command not found
95 configure:3346: $? = 127
96 configure:3366: checking whether the C compiler works
97 configure:3388: gcc-4.2.1 conftest.c >&5
98 configure: line 3390: gcc-4.2.1: command not found
又是什么告诉你? –
我无法在任何地方找到它。 sudo find/Users/josh/-name mkmf.log – jwilcox09
不确定是否有问题,但是你运行Mac OS Maverick?你有没有更新Xcode?打开并接受新的规则?并再试一次... –