2013-03-09 3 views
0

윈도우에 있는데 rmagick-win32 RMagick-2.12.0-ImageMagick-6.5.6-8-Q8을 여기 (http://rubyforge.org/frs/?group_id=12&release_id=42049)에서 다운로드하여 설치했습니다. 내가Rmagick을 설치하려고 시도한 후에 레일즈 서버를 실행할 수 없습니다.

C:\Users\Me\Desktop\sample_app>rails s 
←[31mCould not find gem 'rmagick (>= 0) x86-mingw32' in any of the gem sources l 
isted in your Gemfile.←[0m 
←[33mRun `bundle install` to install missing gems.←[0m 

그래서 내가 설치하거나 번들 갱신 번들하려고이 오류 메시지가, 내가 레일의를 실행하려고하면

'보석 rmagick 설치'를 사용하여 설치 후, 나는이 (내가 꺼내 얻을 공간 절약을위한 보석의 전체 목록) :

C:\Users\Me\Desktop\sample_app>bundle update 

Fetching source index for https://rubygems.org/ 
Installing rmagick (2.13.2) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension 
. 

     C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb 
checking for Ruby version >= 1.8.5... yes 
checking for stdint.h... *** 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:/RailsInstaller/Ruby1.9.3/bin/ruby 
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler 
failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp' 

     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:931:in `block in 
have_header' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:790:in `block in 
checking_for' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 
levels) in postpone' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block in 
postpone' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `postpone 
' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:789:in `checking 
_for' 
     from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:930:in `have_hea 
der' 
     from extconf.rb:194:in `<main>' 


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9 
.1/gems/rmagick-2.13.2 for inspection. 
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2 
.13.2/ext/RMagick/gem_make.out 
An error occured while installing rmagick (2.13.2), and Bundler cannot continue. 

Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling. 

그런 다음 rmagick 2.13.2를 다운로드하여 동일한 폴더에 넣고 "gem install rmagick -v '2.13.2'를 실행했지만 오류가 발생했습니다. 다시 젬 기본 확장자를 빌드하지 못했습니다.

I 2.13.2를 설치하려고하는데 이것에 대한 정보를 찾을 수 없습니다. 누구든지 이것이 문제인지 그리고 이것이 어떻게 해결 될 수 있는지 알고 있습니까?

답변

0

Windows에서 Ruby가 네이티브 C 확장을 컴파일하려면 (일부 보석이 포함되어 있음) DevKit이 필요합니다.

1

Windows 용 RMagick은 까다 롭습니다. 나는 지난 2 년 동안 같은 문제를 해결하기 위해 Windows에있을 때 두 가지 해결책을 찾아 냈습니다.

이 Gemfile에 다음을 추가 간단한 솔루션. 또한 다른 플랫폼도 고려할 것입니다.

if RUBY_PLATFORM =~ /(win|w)32$/ 
    gem 'rmagick', '2.12.0', :path => 'vendor/gems/rmagick-2.12.0-x86-mswin32', :require => 'RMagick' 
else 
    gem 'rmagick', :require => 'RMagick' 
end 

그런 다음, 사용 vendors/gems/에 보석을 풀고 :

gem unpack rmagick-2.12.0-x86-mswin32.gem vendors/gems/ 

더 나은 솔루션

을 내가 Windows에서 RMagick 보석을 컴파일하는 것이 가능하다는 것을 발견했다. 이 솔루션을 수행하기 전에 DevKit을 설치해야합니다.

ImageMagick 디렉토리를 X:\으로 매핑하고 gem 명령에 매개 변수를 지정하여 RMagick을 빌드하는 데 필요한 파일을 찾을 수있는 위치를 지정했습니다. 구성 옵션이 경로의 공백을 처리하는 방법을 모르기 때문에 이러한 종류의 매핑이 필요합니다.

다음 명령을 사용하여 ImageMagick 디렉토리를 X:\으로 매핑하고 보석을 컴파일하고 설치할 수 있습니다.

subst X: "C:\Program Files (x86)\ImageMagick-6.7.6-Q16" 
gem install rmagick --platform=ruby -- --with-opt-lib="X:\lib" --with-opt-include="X:\include" 
subst X: /D 

6.7.6-Q16 이외의 버전이 설치되어 있거나 64 비트 Windows가 아닌 경우 경로를 편집해야합니다.

gem을이 솔루션과 함께 설치 한 후에는 Gemfile에 gem 'rmagick', :require => 'RMagick'으로 번들 할 수있게되었습니다.

관련 문제