Hi!
I'm on a shared host, and I asked them to install RMagick, which they have done. However, when I include RMagick (using RubyGems), the Magick class isn't created. See the following script:
require "rubygems"
require "RMagick"
print defined?(Magick) ? "Magick is defined\n" : "Magick isn't defined\n"
On my local PC that outputs "Magick is defined". On the shared host it outputs "Magick isn't defined"
As a result I tried installing RubyGems + RMagick myself in my home dir. However, I get the same problem: require'ing RMagick doesn't include the Magick class.
Any ideas?
Thanks,
Rob
Try "require_gem" to load a gem, i.e. "require_gem 'rmagick'" may work.
Good luck,
Francois
···
On Tuesday 21 June 2005 15:08, Robert Mannl wrote:
require "rubygems"
require "RMagick"
print defined?(Magick) ? "Magick is defined\n" : "Magick isn't defined\n"
Robert Mannl said:
Hi!
I'm on a shared host, and I asked them to install RMagick, which they
have done. However, when I include RMagick (using RubyGems), the Magick
class isn't created. See the following script:
require "rubygems"
require "RMagick"
print defined?(Magick) ? "Magick is defined\n" : "Magick isn't defined\n"
On my local PC that outputs "Magick is defined". On the shared host it
outputs "Magick isn't defined"
As a result I tried installing RubyGems + RMagick myself in my home dir.
However, I get the same problem: require'ing RMagick doesn't include the
Magick class.
Lets find out where RMagick is installed:
(1) type: 'gem env gempath', and make note of the directory (call it
GEMPATH).
(2) type: 'dir GEMPATH\gems', (substitute the directory found above for
GEMPATH). See if there is an RMagick directory there (it will probably
have a version number).
If its there, then it was downloaded and at least attempted to install.
(3) type: 'dir GEMPATH\specifications'. See if there is a RMagic
specification in that directory. If not, then RMagick wasn't successfully
installed. Perhaps it had a compile problem. Look for a gem_make.out
file in the RMagick directory found in step (2).
···
--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
Hi Francois!
No unfortunately that doesn't work either
require "rubygems"
require_gem "rmagick"
Magick.inspect #output: -:3: uninitialized constant Magick (NameError)
Rob
Hi Jim!
First off, thanks for the help =)
Yeah, there are the three dirs/files you said:
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1
/usr/lib/ruby/gems/1.8/specifications/rmagick-1.8.1.gemspec
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1/gem_make.out
I also checked the config.log (I read about that file somewhere on the web), to see how it was installed/compiled.
Here it is: http://rafb.net/paste/results/K8ipJ244.html
There are several "undefined references" there, e.g.:
"undefined reference to `ParseSizeGeometry'"
I don't know if that means anything.
Cheers,
Rob
Robert Mannl wrote:
Hi Jim!
First off, thanks for the help =)
Yeah, there are the three dirs/files you said:
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1
/usr/lib/ruby/gems/1.8/specifications/rmagick-1.8.1.gemspec
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1/gem_make.out
I also checked the config.log (I read about that file somewhere on the web), to see how it was installed/compiled.
Here it is: http://rafb.net/paste/results/K8ipJ244.html
There are several "undefined references" there, e.g.:
"undefined reference to `ParseSizeGeometry'"
I don't know if that means anything.
What version of ImageMagick do you have? Try the "convert -v" command.
Robert Mannl said:
Yeah, there are the three dirs/files you said:
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1
/usr/lib/ruby/gems/1.8/specifications/rmagick-1.8.1.gemspec
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1/gem_make.out
Interesting. All the pieces are there for RubyGems to find the RMagick
file. What does running 'gemwhich RMagick' at the command line report.
I suppose it is possible that the RMagick ruby file can't load the C
library (for some reason) and is aborting (silently??) without defining
the RMagick module.
Try this Ruby script. It tries to load your rmagick file without going
through RubyGems. If it works, then the problem is probably gem runtime
related. If it doesn't work, then the problem is probably installation
issues, either with the gem or with rmagic.
$: << '/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1/lib'
require 'RMagick'
I also checked the config.log (I read about that file somewhere on the
web), to see how it was installed/compiled.
Here it is: http://rafb.net/paste/results/K8ipJ244.html
There are several "undefined references" there, e.g.:
"undefined reference to `ParseSizeGeometry'"
I don't know if that means anything.
Ack ... I don't know enough about RMagick to interpret this file.
···
--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
Ok, so I tried it... download rmagick with 'gem install rmagick'. There's a
compilation error when compiling the C code:
rmimage.c:16:46: magick/xwindow.h: No such file or directory
<b>Without having a clue of what I'm doing or why</b> , I've edited the
file ... rmagick-1.8.3/ext/RMagick/rmimage.c, added
#undef HAVE_XIMPORTIMAGE
just after the #include "rmagick.h"
then back to the rmagick-1.8.3 directory, 'ruby install.rb setup' followed by
'ruby install.rb install' and it works... with the few included examples and
irb:
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require_gem "rmagick"
=> true
irb(main):003:0> Magick.inspect
=> "Magick"
Francois
···
On Tuesday 21 June 2005 18:33, Robert Mannl wrote:
Hi Francois!
No unfortunately that doesn't work either
require "rubygems"
require_gem "rmagick"
Magick.inspect #output: -:3: uninitialized constant Magick (NameError)
Rob
$: << '/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1/lib'
require 'RMagick'
I ran that code and got:
/usr/lib/ruby/gems/1.8/gems/rmagick-1.8.1/lib/RMagick.rb:11:in `require': no such file to load -- RMagick.so (LoadError)
So maybe that's the problem. I don't know if that's happening because:
- I'm not loading RMagick thru rubygems
or because
- loading RMagick.so fails silently when loading thru rubygems
Anyway, I'll report that to my host (Dreamhost). Hopefully they can fix it somehow. I'll keep you updated.
Thanks Jim, Tim & Francois!
Rob
Robert Mannl wrote:
What version of ImageMagick do you have? Try the "convert -v" command.
5.4.4
RMagick 1.8.2 requires ImageMagick 6.0.0 or later. No telling what's going wrong.