RMagick and RubyGems

R

Robert Mannl

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
 
F

Francois GORET

require "rubygems"
require "RMagick"
print defined?(Magick) ? "Magick is defined\n" : "Magick isn't defined\n"

Try "require_gem" to load a gem, i.e. "require_gem 'rmagick'" may work.

Good luck,

Francois
 
R

Robert Mannl

Hi Francois!

No unfortunately that doesn't work either

require "rubygems"
require_gem "rmagick"
Magick.inspect #output: -:3: uninitialized constant Magick (NameError)




Rob
 
J

Jim Weirich

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).
 
R

Robert Mannl

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
 
T

Tim Hunter

Robert said:
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.
 
J

Jim Weirich

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.
 
F

Francois GORET

Hi Francois!

No unfortunately that doesn't work either

require "rubygems"
require_gem "rmagick"
Magick.inspect #output: -:3: uninitialized constant Magick (NameError)

Rob

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
 
R

Robert Mannl

$: << '/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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,174
Messages
2,570,940
Members
47,486
Latest member
websterztechnologies01

Latest Threads

Top