2013-06-24 2 views
5

나는 이것이 간단하다는 것을 알고 있지만, 나는 알아 내지 못합니다. Ruby에서 스크립트를 실행해야하며 Nokogiri가 필요합니다. 나는 다른 언어로 된 경험이 있지만 루비에서는 그렇지 않다. 충분히Windows에서 Ruby 용 Nokogiri를 설치할 수 없습니다.

ERROR: Error installing nokogiri: 
     The 'nokogiri' native gem requires installed build tools. 

Please update your PATH to include build tools or download the DevKit 
from 'http://rubyinstaller.org/downloads' and follow the instructions 
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit' 

쉬운 :

Ruby 2.0.0-p195 (x64) is installed @C:\Programs\RubyLanguage

Ruby Development Kit (mingw64-64-4.7.2-20130224-1432) is installed @C:\Programs\RubyDevKit

은 내가이 오류가 gem install nokogiri를 실행하면 :

여기 내 시스템입니다. 그래서 나는 the link of above을 따라 갔고 3 단계를 수행했습니다. 그러나 4 단계에서는 "config.yml"을 생성합니다. 그래서 나는했다. 이제 파일은 일부 주석이있는 빈 목록입니다. 위의 오류로 인해 Nokogiri를 설치할 수 없으며 DevKit으로 아무데도 가지 않는 것 같습니다. 내가 말하는 것은 개발 키트 설치 단계가 나에게 충분하지 않다는 것입니다.

mkmf.log: package configuration for libxslt is not found 
package configuration for libxml-2.0 is not found 
package configuration for libiconv is not found 
find_header: checking for libxml/parser.h... -------------------- no 

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Programs/RubyLanguage/include/ruby-2.0.0/x64-mingw32 -IC:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/backward -IC:/Programs/RubyLanguage/include/ruby-2.0.0 -I. -IC:/Programs/RubyLanguage/include/libxml2 -IC:/Programs/RubyLanguage/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -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 -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -L. -LC:/Programs/RubyLanguage/lib -LC:/Programs/RubyLanguage/lib -L.  -lx64-msvcrt-ruby200 -lshell32 -lws2_32 -limagehlp -lshlwapi " 
In file included from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/defines.h:153:0, 
       from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h:70, 
       from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby.h:33, 
       from conftest.c:1: 
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/win32.h: In function 'rb_w32_pow': 
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/win32.h:776:16: warning: conversion to 'double' from 'long double' may alter its value [-Wconversion] 
In file included from C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby.h:33:0, 
       from conftest.c:1: 
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h: In function 'rb_float_value': 
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h:777:6: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion] 
C:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/ruby.h:777:6: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion] 
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 */ 

"x86_64-w64-mingw32-gcc -E -IC:/Programs/RubyLanguage/include/ruby-2.0.0/x64-mingw32 -IC:/Programs/RubyLanguage/include/ruby-2.0.0/ruby/backward -IC:/Programs/RubyLanguage/include/ruby-2.0.0 -I. -IC:/Programs/RubyLanguage/include/libxml2 -IC:/Programs/RubyLanguage/include -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -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 -DXP_WIN -DXP_WIN32 -DUSE_INCLUDED_VASPRINTF -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline conftest.c -o conftest.i" 
conftest.c:5:27: fatal error: libxml/parser.h: No such file or directory 
compilation terminated. 
checked program was: 
/* begin */ 
1: #include "ruby.h" 
2: 
3: #include <winsock2.h> 
4: #include <windows.h> 
5: #include <libxml/parser.h> 
/* end */ 

CMD는

로그 :


업데이트는 지금 (설치 JSON-1.8.0 1 보석에 대한 설치 문서를 DevKit 5 단계에 따라 작동) 노코 기리의 설치가 실패 말한다

Microsoft Windows [Version 6.1.7601] 
Copyright (c) 2009 Microsoft Corporation. All rights reserved. 

C:\Users\SEPEHR>gem install nokogiri 
Temporarily enhancing PATH to include DevKit... 
Building native extensions. This could take a while... 
ERROR: Error installing nokogiri: 
     ERROR: Failed to build gem native extension. 

    C:/Programs/RubyLanguage/bin/ruby.exe extconf.rb 
checking for libxml/parser.h... no 
----- 
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokog 
iri.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. 

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:/Programs/RubyLanguage/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-pkg-config 
     --without-pkg-config 
     --with-libiconv-config 
     --without-libiconv-config 
     --with-pkg-config 
     --without-pkg-config 


Gem files will remain installed in C:/Programs/RubyLanguage/lib/ruby/gems/2.0.0/ 
gems/nokogiri-1.6.0 for inspection. 
Results logged to C:/Programs/RubyLanguage/lib/ruby/gems/2.0.0/gems/nokogiri-1.6 
.0/ext/nokogiri/gem_make.out 
+0

Windows에서 Nokogiri와 함께 작동하도록 DevKit이 절대적으로 필요합니다 (다른 컴파일 도구가 설치되어있는 경우는 예외입니다). 지침은 [여기] (https://github.com/oneclick/rubyinstaller/wiki/Development-Kit)에서 찾을 수 있습니다. DevKit 설치로 정확히 당신을 위해 일하지 않는 것은 무엇입니까? – PinnyM

+0

나는 창문에 루비 1.9.3, 2.0을 사용하는 것이 현시점에서 제안 할만한 제안이라고 권장한다. – pguardiario

답변

13

업데이트를 설치 버전 1.6.2로, 노코 기리를 지금 이 64 비트 버전의 Ruby 2.0.0을 지원합니다.

: 당신은 여전히 ​​어떤 이유로 또는 설치 및 DevKit 사용하여 보석을 구축하는 방법을 이해하려는 경우 86 버전을 설치해야하는 경우 여기

답이다 (이것은 libxml이 = 2.6.21이>가 필요합니다)


Nokogiri는 아직 의 64 비트 버전의 Ruby 2.0.0을 지원하지 않습니다.follow the status here에 대해 읽을 수 있습니다.

그러나 Nokogiri xxx 버전의 루비 2.0.0을 지원합니다. 2.0.0 x86 설치에서 보석을 설치할 수 있어야합니다.

손쉽게 설치할 수 있습니다. RailsInstaller보다는 다른 것을 유지해야하기 때문에 선호합니다.방법은 다음과 같습니다.

  1. 필요한 버전의 파일을 다운로드하여 압축을 해제하십시오. 2.0.0의 x86 버전은 download the correct version of DevKit이어야합니다.

  2. 은 경로 수정 : 당신이 C:\rubies\ruby-2-0-0-x86에 루비 2.0.0의 86 버전을 설치하고 당신이 필요합니다 C:\rubies\DevKit-xxxx-x86에 관련된 DevKit 가정 : 경로가 올바른 루비, 보석 및 DevKit의 DIRS에 디렉토리를 포함해야합니다

    C : \ rubies \ ruby-2-0-0-x86 \ bin C : \ ruby ​​\ ruby-2-0-0-x86 \ lib \ ruby ​​\ gems \ 2.0.0 C : \ rubies \ DevKit-xxxx-x86 \ bin

  3. 오른쪽 루비에 DevKit을 설치하십시오. 일단 루비를 설치하면 올바른 정보를 ruby -v 입력 한 다음 ruby dk.rb init 실행 - Devkit은 올바른 루비 버전에 & '주사'를 설정 얻을 것입니다. (NB는 항상 생산 내가 원하는 루비 설치에 대한 올바른 경로에 배치 된 config.yml 파일을 편집해야합니다. 걱정하지 마십시오 당신이 할 필요합니다.) 내가 아니었다

0

넵 ... 1.9.3으로 다운 그레이드했습니다. 도움을 얻으려면 Tnx. (DevKit 설치에 따라 DevKit 설치 (자동으로 찾을 수없는 ex.RubyLang 또는
설정에 이름을 설치 변경하지 마십시오)

    • 설치 루비 1.9.3 : 여기 요약을 넣어 단계)

    • 는 노코 기리에게

  • 0

    Windows 7에서 Ruby 2.0 용 x64 Nokogiri를 설치할 수 있지만 binary gem이 작동하는 것 같습니다.