I am using RMagick in my app and am having problems in deployment. The deployment machine (Fedora Core 5) can''t find RMagick unless I change the "require" syntax from that used on the dev machine (OS X). And the dev machine doesn''t like the syntax that works on the deployment server! To wit: [OS X] $ script/console Loading development environment.>> require_gem ''rmagick''=> true>> Magick=> Magick $ script/console>> require ''rmagick''=> false>> Magick=> Magick $ script/console Loading development environment. Application strings file ''config/app_strings.dat'' does not exist.>> require ''RMagick''[DELETED: Many error of the type: /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb:32: warning: already initialized constant PercentGeometry] NameError: undefined method `assoc'' for class `Magick::ImageList'' [Fedora Core 5] # script/console>> require_gem ''rmagick''=> true>> MagickNameError: uninitialized constant Magick from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in `const_missing'' from /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in `const_missing'' from (irb):2 # script/console>> require ''rmagick''MissingSourceFile: no such file to load -- rmagick # script/console>> require ''RMagick''=> true>> Magick=> Magick The gem and the library are installed on both machines (maybe not entirely correctly, it appears, but they compiled and installed). To summarize what''s happening: 1. require_gem returns true on both machines but on FC5 the library isn''t really loading: Magick isn''t initialized. 2. On OS X, "require ''rmagick''" works fine, but FC5 can''t find the library when I spell it in all lowercase. 3. On FC5, "require ''RMagick''" works fine, but on OS X using the capitalized letters load a broken version of the library. I''ve have recompiled and reinstalled till the cows come home. Can anyone give me some guidance on how to set things up so that one of these three load commands works consistently on both platforms? Thanks! /afb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Block wrote:> [OS X] > ... >>> require ''RMagick'' > [DELETED: Many error of the type: > /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb:32: warning: already > initialized constant PercentGeometry]Try deleting the non-gem site_ruby installation of RMagick on OSX. And then use: require_gem ''rmagick'' require ''RMagick'' -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Reginald James wrote:> Try deleting the non-gem site_ruby installation of RMagick on OSX. > > And then use: > > require_gem ''rmagick'' > require ''RMagick''I find I don''t need to require_gem ''rmagick'' on OSX...it''s somehow being loaded when the Rails environment loads:>> require_gem "rmagick"=> false And removing: - /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb - /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.7.3/RMagick.bundle Doesn''t make the following work, unfortunately:>> require ''RMagick''[DELETED: Many error of the type: /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb:32: warning: already initialized constant PercentGeometry] NameError: undefined method `assoc'' for class `Magick::ImageList'' My best guess is that there is actually something wrong with the gem build on FC5. I''ve tried every combination of recompilation so I''m sort of stuck. ImageMagick command line apps work fine and as far as I can tell all the libraries are there and the library paths are set in /etc/ld.so.conf. Thanks for your suggestions! /afb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Block wrote:> My best guess is that there is actually something wrong with the gem > build on FC5. I''ve tried every combination of recompilation so I''m sort > of stuck. ImageMagick command line apps work fine and as far as I can > tell all the libraries are there and the library paths are set in > /etc/ld.so.conf.The gem build works fine for me on FC6, but I do need to use the double-barreled require require_gem ''rmagick'' require ''RMagick'' which is not what the docs say you need to do. Perhaps update to the latest ImageMagick and ImageMagick-devel packages, or build ImageMagick from source. -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> require_gem ''rmagick'' > require ''RMagick'' > > which is not what the docs say you need to do.And that *does* work on my FC5 machine. But a capitalized require ''RMagick'' makes the Mac barf and it isn''t worth hassling with anymore. I worked around it by catching any LoadError on the lowercase require and then loading the capitalized one if necessary. Not nice, but I''ve wasted enough time on this. Re: your last three suggestions, done, done, and done. Really it all installs and compiles beautifully. I''m starting to think the Mac is the odd one out but I guess we''ll never know. :) Thanks again for your help. /afb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Block wrote:>> require_gem ''rmagick'' >> require ''RMagick'' >> >> which is not what the docs say you need to do. > > And that *does* work on my FC5 machine. But a capitalized require > ''RMagick'' makes the Mac barf and it isn''t worth hassling with anymore. I > worked around it by catching any LoadError on the lowercase require and > then loading the capitalized one if necessary. Not nice, but I''ve wasted > enough time on this. > > Re: your last three suggestions, done, done, and done. Really it all > installs and compiles beautifully. I''m starting to think the Mac is the > odd one out but I guess we''ll never know. :) > > Thanks again for your help. > > /afbAll these replies and nobody has mentioned that "require_gem" doesn''t do what you think it does and isn''t necessary anyway? "require_gem" does not replace "require" for gems. It is used only to specify a specific version of a gem, which must then be required anyway. In the current beta version (0.9.0.8) of RubyGems you get a warning message when you use "require_gem". The name of the library is "RMagick" and that is what you must specify in the require statement. This is what all the RMagick examples and the RMagick doc use: require "RMagick" Since OS X is case-insensitive "rmagick" works as well but Linux is case-sensitive so you must use "RMagick". Since you''ve installed RMagick as a gem you must have RubyGems loaded before requiring RMagick. If you haven''t already loaded RubyGems you''ll need that, too. require "rubygems" require "RMagick" But RoR always loads RubyGems so you shouldn''t need to do that. A simple require "RMagick" is all you need. If that doesn''t work then RMagick is not installed properly. You already know this but I''ll say it anyway since so many people are confused about it: When require fails it raises an exception. When it returns false it means that whatever you required has already been loaded. There are many good tutorials about installing RMagick on OS X on the web. Google will turn them up quickly. Mine is at http://rmagick.rubyforge.org/install-osx.html. If you continue to have problems try reproducing them in a stand-alone script, outside of your Rails app. Often this reveals diagnostics that help resolve the problem. You can always report problems with RMagick by emailing rmagick AT rubyforge DOT org or post to RMagick''s Help forum on RubyForge. Good luck! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
The trick is that HFS+ filesystem of Mac OS X is case-insensitive by default. So "RMagick" and "rmagick" is the same on osx. But it's not the case in other case-sensitive filesystems. I had the completely the same issue deploying my RoR app to Debian. So be careful with names in require. Gbor On 12/27/06, Tim Hunter <rails-mailing-list@andreas-s.net> wrote:> > Adam Block wrote: > >> require_gem 'rmagick' > >> require 'RMagick'--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gbor Sebestyn wrote:> The trick is that HFS+ filesystem of Mac OS X is case-insensitive...Interesting. But then why oh why does this happen: $ script/console>> require ''rmagick''=> false>> Magick=> Magick $ script/console>> require ''RMagick''[DELETED: Many error of the type: /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb:32: warning: already initialized constant PercentGeometry] NameError: undefined method `assoc'' for class `Magick::ImageList'' Obviously the two different case versions are loading different RMagicks, yeah? Thanks! /afb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Adam Block wrote:> Gbor Sebestyn wrote: >> The trick is that HFS+ filesystem of Mac OS X is case-insensitive... > > Interesting. But then why oh why does this happen: > > $ script/console >>> require ''rmagick'' > => false >>> Magick > => Magick > > $ script/console >>> require ''RMagick'' > [DELETED: Many error of the type: > /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb:32: warning: already > initialized constant PercentGeometry] > NameError: undefined method `assoc'' for class `Magick::ImageList'' > > Obviously the two different case versions are loading different > RMagicks, yeah? > > Thanks! > > /afbIn the first case, "rmagick" has already been required using the lowercase name, so require knows that it''s already been loaded and returns false. However, require doesn''t know that "rmagick" and "RMagick" are the same thing, so it loads "RMagick" again. The messages you see are the result of loading RMagick.rb twice. There''s no evidence here that you''ve loaded two different versions of RMagick. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 27, 2006, at 7:12 PM, Adam Block wrote:> Gábor Sebestyén wrote: >> The trick is that HFS+ filesystem of Mac OS X is case-insensitive... > > Interesting. But then why oh why does this happen: > > $ script/console >>> require ''rmagick'' > => false >>> Magick > => Magick > > $ script/console >>> require ''RMagick'' > [DELETED: Many error of the type: > /usr/local/lib/ruby/site_ruby/1.8/RMagick.rb:32: warning: already > initialized constant PercentGeometry] > NameError: undefined method `assoc'' for class `Magick::ImageList'' > > Obviously the two different case versions are loading different > RMagicks, yeah? > > Thanks! > > /afbOr the simple way that require tracks the already-loaded files makes the names ''rmagick'' and ''RMagick'' different (since Ruby Strings are case-sensitive regardless of the file system). See the footnote on p. 124 of the pickaxe (Programming Ruby, 2nd ed.) for more including the bit "Some consider this a bug, and this behavior may well change in later releases." -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rob Biedenharn wrote:> "Some consider this a bug, and this behavior may well change in > later releases."Yes, I remember that footnote. :) But it does reraise a question that I thought of a few nights ago: Is there a way to determine the full paths of the loaded libraries, or is $: all I get? Thanks, /afb -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 27, 2006, at 5:05 PM, Adam Block wrote:> > Rob Biedenharn wrote: > >> "Some consider this a bug, and this behavior may well change in >> later releases." > > Yes, I remember that footnote. :) But it does reraise a question > that I thought of a few nights ago: Is there a way to determine the > full paths of the loaded libraries, or is $: all I get? > > Thanks, > > /afbp $LOADED_FEATURES cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez-NLltGlunAUd/unjJdyJNww@public.gmane.org -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---