尝试安装rmagick gem时,我收到如下所示的错误.我使用RVM,Ruby 1.9.2-head和Rails 3.05在Snowleopard 10.6上.回答类似的问题建议安装ImageMagick,我成功地做了.其他建议安装"libmagick9-dev库",但是,我无法弄清楚如何做到这一点.
我是一名新开发人员,非常感谢您对现有解释或资源的任何帮助或指示.谢谢!
jjdevenuta(opal)$ gem install rmagick
Fetching: rmagick-2.13.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/Users/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head@rails3/bin:/Users/jjdevenuta/.rvm/gems/ruby-1.9.2-head@global/bin:/Users/jjdevenuta/.rvm/rubies/ruby-1.9.2-head/bin:/Users/jjdevenuta/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/X11/bin
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log …Run Code Online (Sandbox Code Playgroud) 我已经使用ImageMagick安装程序脚本https://github.com/maddox/magick-installer安装了ImageMagick .我在OSX Lion 10.7上,使用RVM,Ruby 1.9.3p125.
问题似乎是MagickWand.h这里是完整的日志
/Users/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/bin/gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
Package MagickCore was not …Run Code Online (Sandbox Code Playgroud) 我正面临着在山狮中安装rmagick的问题.我已经安装了Xcode 4.4和开发人员工具.仍然面临这个问题.
Installing rmagick (2.13.1) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking …Run Code Online (Sandbox Code Playgroud) 我发现我可以使用以下任何命令成功安装ruby:
$ rvm reinstall 1.9.3-p327
$ rvm reinstall 1.9.3-p327 --with-openssl-dir=/usr/local
$ rvm reinstall 1.9.3-p327 --with-openssl-dir=/afdlkjasd_not_a_dir
$ rvm reinstall 1.9.3-p327 --with-openssl-dirffadsf=/afdlkjasd_not_a_dir
Run Code Online (Sandbox Code Playgroud)
无论我使用哪种上述命令,我都可以输入:
$ rvm use 1.9.3-p327
Using /home/clay/rvm/gems/ruby-1.9.3-p327
$ which ruby
/home/clay/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
$ ruby -e "puts require('openssl')"
true
Run Code Online (Sandbox Code Playgroud)
无论我做什么,我似乎都有ssl支持.我猜rvm或者ruby构建过程并不介意无效的选项或值.--with-openssl-dir即使我正确地输入(明显地)它,我也不知道该选项是否得到尊重.
rvm是否将我的ruby与我想要的openssl lib(/ usr/local中的那个)链接起来?如何判断哪个openssl lib编译/链接了ruby?
我正在使用Linux Mint 13.
我正在使用载波,但我遇到了这个问题:假设项目交付后,您需要添加一个区域,其中需要以不同的大小显示系统中的图像。我不想为系统中已经存在的每个图像重新生成新的尺寸。我希望能够在需要视图时生成(并缓存它)。像这样:“ />。如果新的尺寸500x150已经存在,则返回缓存的URL,否则生成它并返回缓存的URL
我非常喜欢Carrierwave,但很遗憾,它没有开箱即用的即时调整大小功能。所有人都说添加此功能应该很简单,但是我什么也没发现。唯一接近的是此上传器https://gist.github.com/DAddYE/1541912 我必须对其进行修改才能使其正常工作,所以这里是我的版本
class ImageUploader < FileUploader
include CarrierWave::RMagick
#version :thumb do
# process :resize_to_fill => [100,100]
#end
#
#version :thumb_square do
# process :resize_to_fill => [100,100]
#end
#
#version :full do
# process :resize_to_fit => [550, 550]
#end
def re_size(string_size)
if self.file.nil?
return self
end
begun_at = Time.now
string_size.gsub!(/#/, '!')
uploader = Class.new(self.class)
uploader.versions.clear
uploader.version_names = [string_size]
img = uploader.new(model, mounted_as)
img.retrieve_from_store!(self.file.identifier)
cached = File.join(CarrierWave.root, img.url)
unless File.exist?(cached)
img.cache!(self)
img.send(:original_filename=, self.file.original_filename)
size = string_size.split(/x|!/).map(&:to_i)
resizer = case …Run Code Online (Sandbox Code Playgroud) ruby-on-rails on-the-fly ondemand image-resizing carrierwave
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Could not find gem 'rmagick v 2.13.1 (>= 0) x86-mingw32' in the gems available o
n this machine.
Run Code Online (Sandbox Code Playgroud)
嗨,我在运行bundle install时收到消息,下面是我的gemsfile
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'carrierwave'
gem 'rmagick v 2.13.1'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1' …Run Code Online (Sandbox Code Playgroud) rmagick ×4
rvm ×3
imagemagick ×2
ruby ×2
bundle ×1
carrierwave ×1
gem ×1
install ×1
on-the-fly ×1
ondemand ×1
openssl ×1
rubygems ×1