
저는 Windows 8을 사용하고 있으며 프로젝트에 Ruby 2.1.2를 설치해야 합니다. 나는 팔로우했다이 지침. 에 소스 압축을 풀고 에서 C:\Ruby2.1.2\src\
실행한 후 대상 폴더로 실행했습니다 . Ruby 2.1.2를 설치했을 때 다음과 같은 오류가 많이 발생했습니다.nmake
C:\Ruby2.1.2\build\
nmake install
C:\Ruby2.1.2\bin\
configuring zlib
Failed to configure zlib. It will not be installed.
이는 dbm, fiddle, gdbm, openssl, pty, readline, syslog, tk, tk/tkutil 및 zlib에서 발생했습니다. 그러나 nmake test
모든 테스트가 통과되었습니다.
이미 Ruby 2.0.0과 1.9.3이 있지만 다른 프로젝트에는 2.0.0이 필요합니다. 나는 사용하고있다pik 0.3.0.pre종속성을 관리하기 위해 2.0.0 및 1.9.3에서 작동하는 것 같습니다.
그러나 Ruby 2.1.2로 전환하면 gem install
다음과 같은 결과가 나타납니다.
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
좀 더 조사한 후 C:\Ruby2.1.2\src\ruby-2.1.2\ext\zlib로 이동하여 실행해 보았습니다. ruby extconf.rb
이에 대해 얻은 오류는 다음과 같습니다.
checking for deflateReset() in z.lib... *** 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
--srcdir=.
--curdir
--ruby=C:/Ruby2.1.2/bin/usr/bin/ruby
--with-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-zlib
--without-zlib
C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:742:in `try_func'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:973:in `block in have_library'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from C:/Ruby2.1.2/bin/usr/lib/ruby/2.1.0/mkmf.rb:968:in `have_library'
from extconf.rb:13:in `block in <main>'
from extconf.rb:13:in `each'
from extconf.rb:13:in `find'
from extconf.rb:13:in `<main>'
개발툴을 설치해야 할 것 같습니다. 하지만그만큼 오직 출처 나는 찾았다개발 도구를 설치하는 방법에 대해 아직 Ruby 2.1.2가 없는 RubyInstaller로 안내했습니다.
또한 zlib를 별도로 설치하고 실행해 보았지만 ruby extconf.rb --with-zlib-dir="C:\Program Files (x86)\GnuWin32"
두 번째 오류가 다시 발생했습니다.
내가 시도한 또 다른 방법은 running 이었지만 gem install zlib -- --with-zlib-dir="C:\Program Files (x86)\GnuWin32"
이로 인해 다시 첫 번째 오류가 발생했습니다.
Rubygems를 작동시키려면 개발 도구를 어떻게 설치해야 합니까?
답변1
Eva, 문제를 해결할 수 있었나요?
나는 (Windows 8.1을 사용하여) 당신과 똑같은 일을 하고 있으며 마침내 zlib를 설치했습니다.
1) 다음에서 zlib128-dll.zip을 다운로드했습니다.http://zlib.net그리고 디렉토리(예: c:\zlib)에 내용의 압축을 풉니다.
2) 그런 다음 이 게시물의 몇 가지 힌트를 따르십시오(https://www.ruby-forum.com/topic/4421852), 저는 c:\ruby-build\usr 디렉터리에서 다음 디렉터리를 만들었습니다.
zlib
zlib\include
zlib\lib
3) 그런 다음 C:\zlib 디렉터리의 일부 파일을 c:\ruby-build\usr 디렉터리로 복사했습니다.
*.h files (both) from C:\zlib\include to c:\ruby-build\usr\zlib\include
zdll.lib from C:\zlib\lib to c:\ruby-build\usr\zlib\lib.
zlib1.dll *AS* zlib.dll from C:\zlib to both c:\ruby-build\usr\zlib\lib and c:\ruby-build\usr\bin
(not sure which one or both are necessary).
4) 그런 다음 VS 2012 기본 도구 명령 창에서 C:\ruby-2.1.2\ext\zlib로 이동하여 다음을 실행했습니다.
\ruby-build\usr\bin\ruby extconf.rb --with-zlib-dir=c:/ruby-build/usr/zlib
5) 그런 다음 nmake, nmake install 및 voila, I zlib가 마침내 설치되었습니다.
내 단계에 대해 궁금한 점이 있으면 알려주세요.
답변2
Ruby에는 여러 라이브러리가 포함되어 있습니다.표준 라이브러리(stdlib)는 Zlib, OpenSSL, FFI와 같은 외부 라이브러리에 의존합니다.
Ruby를 빌드하려면 Ruby에서 해당 라이브러리를 사용할 수 있도록 해야 합니다. 그래야 Ruby에서 컴파일할 수 있습니다.
RubyInstaller에서는 종속성을 패키지로 빌드하고 Ruby 컴파일 중에 이를 사용하여 이 문제를 해결했습니다.
귀하의 경우에는 Visual Studio를 사용하고 있는 것으로 보입니다. 이는 RubyInstaller에서 제공하는 바이너리 패키지의 런타임 종속성이 다르기 때문에 사용할 수 없음을 의미합니다.
Visual Studio 사용이 실제로 요구 사항이 아닌 경우 RubyInstaller 레시피를 사용하여 Ruby 2.1.x의 로컬 패키지를 생성할 수 있습니다.
cd rubyinstaller
rake ruby21 DKVER=mingw64-32-4.7.2 LOCAL=C:\path\to\ruby\source
이는 RubyInstaller 레시피에 mingw64
컴파일러(GCC) 32비트 버전 4.7.2를 사용하고 다음에서 가리키는 로컬 소스 체크아웃을 사용하도록 지시합니다.LOCAL
이 모든 내용은 RubyInstaller에서 다룹니다.읽어보기
추가 도움이 필요하면 RubyInstaller에 문의하세요.구글 그룹