试图在Ruby 2.1上安装Nokogiri,得到奇怪的错误

时间:2015-10-07 01:26:52

标签: ruby gem nokogiri

我使用Ruby 2.1 for Windows 8,64位。我尝试运行compile.log时在gem install nokogiri文件夹中出现此错误。

gcc  -O3 -Wall -c -o adler32.o adler32.c
gcc  -O3 -Wall -c -o compress.o compress.c
gcc  -O3 -Wall -c -o crc32.o crc32.c
gcc  -O3 -Wall -c -o deflate.o deflate.c
gcc  -O3 -Wall -c -o gzclose.o gzclose.c
gcc  -O3 -Wall -c -o gzlib.o gzlib.c
gcc  -O3 -Wall -c -o gzread.o gzread.c
gcc  -O3 -Wall -c -o gzwrite.o gzwrite.c
gcc  -O3 -Wall -c -o infback.o infback.c
gcc  -O3 -Wall -c -o inffast.o inffast.c
gcc  -O3 -Wall -c -o inflate.o inflate.c
gcc  -O3 -Wall -c -o inftrees.o inftrees.c
gcc  -O3 -Wall -c -o trees.o trees.c
gcc  -O3 -Wall -c -o uncompr.o uncompr.c
gcc  -O3 -Wall -c -o zutil.o zutil.c
ar rcs libz.a adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o 
windres --define GCC_WINDRES -o zlibrc.o win32/zlib1.rc
'c:\Users\Compy\Desktop\ruby' is not recognized as an internal or external command,
operable program or batch file.
c:\Users\Compy\Desktop\ruby dev\mingw\bin\windres.exe: preprocessing failed.
make: *** [zlibrc.o] Error 1

使用Ruby 1.9.3安装Nokogiri时,我从来没有遇到过这个错误。

这里发生了什么?

更新

我将c:\Users\Compy\Desktop\ruby dev\mingw\bin\windres.exe替换为c:\Users\Compy\Desktop\ruby-dev\mingw\bin\windres.exe。我在ruby dev点了一下。现在我收到了一个新错误。

这里是gem_make.out的内容:

c:/Ruby21-x64/bin/ruby.exe extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of zlib-1.2.8.

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install
************************************************************************
Downloading zlib-1.2.8.tar.gz 
Downloading zlib-1.2.8.tar.gz (  2%) 
Downloading zlib-1.2.8.tar.gz (  5%) 
Downloading zlib-1.2.8.tar.gz (  8%) 
Downloading zlib-1.2.8.tar.gz ( 10%) 
Downloading zlib-1.2.8.tar.gz ( 13%) 
Downloading zlib-1.2.8.tar.gz ( 15%) 
Downloading zlib-1.2.8.tar.gz ( 18%) 
Downloading zlib-1.2.8.tar.gz ( 21%) 
Downloading zlib-1.2.8.tar.gz ( 24%) 
Downloading zlib-1.2.8.tar.gz ( 27%) 
Downloading zlib-1.2.8.tar.gz ( 28%) 
Downloading zlib-1.2.8.tar.gz ( 31%) 
Downloading zlib-1.2.8.tar.gz ( 34%) 
Downloading zlib-1.2.8.tar.gz ( 35%) 
Downloading zlib-1.2.8.tar.gz ( 38%) 
Downloading zlib-1.2.8.tar.gz ( 41%) 
Downloading zlib-1.2.8.tar.gz ( 43%) 
Downloading zlib-1.2.8.tar.gz ( 46%) 
Downloading zlib-1.2.8.tar.gz ( 49%) 
Downloading zlib-1.2.8.tar.gz ( 51%) 
Downloading zlib-1.2.8.tar.gz ( 53%) 
Downloading zlib-1.2.8.tar.gz ( 56%) 
Downloading zlib-1.2.8.tar.gz ( 59%) 
Downloading zlib-1.2.8.tar.gz ( 60%) 
Downloading zlib-1.2.8.tar.gz ( 63%) 
Downloading zlib-1.2.8.tar.gz ( 66%) 
Downloading zlib-1.2.8.tar.gz ( 69%) 
Downloading zlib-1.2.8.tar.gz ( 70%) 
Downloading zlib-1.2.8.tar.gz ( 73%) 
Downloading zlib-1.2.8.tar.gz ( 76%) 
Downloading zlib-1.2.8.tar.gz ( 79%) 
Downloading zlib-1.2.8.tar.gz ( 80%) 
Downloading zlib-1.2.8.tar.gz ( 81%) 
Downloading zlib-1.2.8.tar.gz ( 82%) 
Downloading zlib-1.2.8.tar.gz ( 85%) 
Downloading zlib-1.2.8.tar.gz ( 88%) 
Downloading zlib-1.2.8.tar.gz ( 90%) 
Downloading zlib-1.2.8.tar.gz ( 93%) 
Downloading zlib-1.2.8.tar.gz ( 94%) 
Downloading zlib-1.2.8.tar.gz ( 95%) 
Downloading zlib-1.2.8.tar.gz ( 98%) 
Downloading zlib-1.2.8.tar.gz (100%) 
Extracting zlib-1.2.8.tar.gz into tmp/x86_64-w64-mingw32/ports/zlib/1.2.8... OK
Running 'compile' for zlib 1.2.8... OK
Running 'install' for zlib 1.2.8... OK
Activating zlib 1.2.8 (from c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2/ports/x86_64-w64-mingw32/zlib/1.2.8)...
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libiconv-1.14.

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install
************************************************************************
Downloading libiconv-1.14.tar.gz 
Downloading libiconv-1.14.tar.gz (  1%) 
Downloading libiconv-1.14.tar.gz (  2%) 
Downloading libiconv-1.14.tar.gz (  3%) 
Downloading libiconv-1.14.tar.gz (  4%) 
Downloading libiconv-1.14.tar.gz (  5%) 
Downloading libiconv-1.14.tar.gz (  6%) 
Downloading libiconv-1.14.tar.gz (  7%) 
Downloading libiconv-1.14.tar.gz (  8%) 
Downloading libiconv-1.14.tar.gz (  9%) 
Downloading libiconv-1.14.tar.gz ( 10%) 
Downloading libiconv-1.14.tar.gz ( 11%) 
Downloading libiconv-1.14.tar.gz ( 12%) 
Downloading libiconv-1.14.tar.gz ( 13%) 
Downloading libiconv-1.14.tar.gz ( 14%) 
Downloading libiconv-1.14.tar.gz ( 15%) 
Downloading libiconv-1.14.tar.gz ( 16%) 
Downloading libiconv-1.14.tar.gz ( 17%) 
Downloading libiconv-1.14.tar.gz ( 18%) 
Downloading libiconv-1.14.tar.gz ( 19%) 
Downloading libiconv-1.14.tar.gz ( 20%) 
Downloading libiconv-1.14.tar.gz ( 21%) 
Downloading libiconv-1.14.tar.gz ( 22%) 
Downloading libiconv-1.14.tar.gz ( 23%) 
Downloading libiconv-1.14.tar.gz ( 24%) 
Downloading libiconv-1.14.tar.gz ( 25%) 
Downloading libiconv-1.14.tar.gz ( 26%) 
Downloading libiconv-1.14.tar.gz ( 27%) 
Downloading libiconv-1.14.tar.gz ( 28%) 
Downloading libiconv-1.14.tar.gz ( 29%) 
Downloading libiconv-1.14.tar.gz ( 30%) 
Downloading libiconv-1.14.tar.gz ( 31%) 
Downloading libiconv-1.14.tar.gz ( 32%) 
Downloading libiconv-1.14.tar.gz ( 33%) 
Downloading libiconv-1.14.tar.gz ( 34%) 
Downloading libiconv-1.14.tar.gz ( 35%) 
Downloading libiconv-1.14.tar.gz ( 36%) 
Downloading libiconv-1.14.tar.gz ( 37%) 
Downloading libiconv-1.14.tar.gz ( 38%) 
Downloading libiconv-1.14.tar.gz ( 39%) 
Downloading libiconv-1.14.tar.gz ( 40%) 
Downloading libiconv-1.14.tar.gz ( 41%) 
Downloading libiconv-1.14.tar.gz ( 42%) 
Downloading libiconv-1.14.tar.gz ( 43%) 
Downloading libiconv-1.14.tar.gz ( 44%) 
Downloading libiconv-1.14.tar.gz ( 45%) 
Downloading libiconv-1.14.tar.gz ( 46%) 
Downloading libiconv-1.14.tar.gz ( 47%) 
Downloading libiconv-1.14.tar.gz ( 48%) 
Downloading libiconv-1.14.tar.gz ( 49%) 
Downloading libiconv-1.14.tar.gz ( 50%) 
Downloading libiconv-1.14.tar.gz ( 51%) 
Downloading libiconv-1.14.tar.gz ( 52%) 
Downloading libiconv-1.14.tar.gz ( 53%) 
Downloading libiconv-1.14.tar.gz ( 54%) 
Downloading libiconv-1.14.tar.gz ( 55%) 
Downloading libiconv-1.14.tar.gz ( 56%) 
Downloading libiconv-1.14.tar.gz ( 57%) 
Downloading libiconv-1.14.tar.gz ( 58%) 
Downloading libiconv-1.14.tar.gz ( 59%) 
Downloading libiconv-1.14.tar.gz ( 60%) 
Downloading libiconv-1.14.tar.gz ( 61%) 
Downloading libiconv-1.14.tar.gz ( 62%) 
Downloading libiconv-1.14.tar.gz ( 63%) 
Downloading libiconv-1.14.tar.gz ( 64%) 
Downloading libiconv-1.14.tar.gz ( 65%) 
Downloading libiconv-1.14.tar.gz ( 66%) 
Downloading libiconv-1.14.tar.gz ( 67%) 
Downloading libiconv-1.14.tar.gz ( 68%) 
Downloading libiconv-1.14.tar.gz ( 69%) 
Downloading libiconv-1.14.tar.gz ( 70%) 
Downloading libiconv-1.14.tar.gz ( 71%) 
Downloading libiconv-1.14.tar.gz ( 72%) 
Downloading libiconv-1.14.tar.gz ( 73%) 
Downloading libiconv-1.14.tar.gz ( 74%) 
Downloading libiconv-1.14.tar.gz ( 75%) 
Downloading libiconv-1.14.tar.gz ( 76%) 
Downloading libiconv-1.14.tar.gz ( 77%) 
Downloading libiconv-1.14.tar.gz ( 78%) 
Downloading libiconv-1.14.tar.gz ( 79%) 
Downloading libiconv-1.14.tar.gz ( 80%) 
Downloading libiconv-1.14.tar.gz ( 81%) 
Downloading libiconv-1.14.tar.gz ( 82%) 
Downloading libiconv-1.14.tar.gz ( 83%) 
Downloading libiconv-1.14.tar.gz ( 84%) 
Downloading libiconv-1.14.tar.gz ( 85%) 
Downloading libiconv-1.14.tar.gz ( 86%) 
Downloading libiconv-1.14.tar.gz ( 87%) 
Downloading libiconv-1.14.tar.gz ( 88%) 
Downloading libiconv-1.14.tar.gz ( 89%) 
Downloading libiconv-1.14.tar.gz ( 90%) 
Downloading libiconv-1.14.tar.gz ( 91%) 
Downloading libiconv-1.14.tar.gz ( 92%) 
Downloading libiconv-1.14.tar.gz ( 93%) 
Downloading libiconv-1.14.tar.gz ( 94%) 
Downloading libiconv-1.14.tar.gz ( 95%) 
Downloading libiconv-1.14.tar.gz ( 96%) 
Downloading libiconv-1.14.tar.gz ( 97%) 
Downloading libiconv-1.14.tar.gz ( 98%) 
Downloading libiconv-1.14.tar.gz ( 99%) 
Downloading libiconv-1.14.tar.gz (100%) 
Extracting libiconv-1.14.tar.gz into tmp/x86_64-w64-mingw32/ports/libiconv/1.14... OK
Running 'configure' for libiconv 1.14... ERROR, review 'c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-w64-mingw32/ports/libiconv/1.14/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=c:/Ruby21-x64/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete configure task (RuntimeError)
    from c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
    from c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
    from c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:66:in `configure'
    from c:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:109:in `cook'
    from extconf.rb:278:in `block in process_recipe'
    from extconf.rb:177:in `tap'
    from extconf.rb:177:in `process_recipe'
    from extconf.rb:443:in `<main>'

extconf failed, exit code 1

此处mkmf.log

"x86_64-w64-mingw32-gcc -o conftest.exe -Ic:/Ruby21-x64/include/ruby-2.1.0/x64-mingw32 -Ic:/Ruby21-x64/include/ruby-2.1.0/ruby/backward -Ic:/Ruby21-x64/include/ruby-2.1.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  conftest.c  -L. -Lc:/Ruby21-x64/lib -L.      -lx64-msvcrt-ruby210  -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi   "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

1 个答案:

答案 0 :(得分:1)

'c:\Users\Compy\Desktop\ruby' is not recognized as an internal or external command,
operable program or batch file.
c:\Users\Compy\Desktop\ruby dev\mingw\bin\windres.exe: preprocessing failed.

RubyInstaller(包括DevKit)无法正常使用文件夹名称中的空格。它甚至在设置过程中提到了这一点:

RubyInstaller Setup

根据Nokogiri installing instruction for Windows的疑难解答部分,可以通过将RubyGems(gem update --system)更新为至少2.4.5来修复其他错误。