Problems with Gruff

I’ve been trying to use Geoffrey Grosenbach’s excellent Gruff package,
however, I’m unable to make it work on OS X Tiger 10.4.3 although ruby
and rails seem to be running fine. I got Typo running with MySQL on
FCGI on the Powerbook using Tony Arnold’s installer, and running
fixrbconfig, so I believe my install to be sound. I also installed
rmagick and Imagemagick through selfupdated darwinports. I’m a total
ruby, rails, and OS X n00b. So, forgive me if this isn’t the
appropriate venue for this email.

So, when I run this script (which works on RHEL4)

http://involution.com/browsershare.rb.txt

I get this error on OS X:

/usr/lib/ruby/gems/1.8/gems/gruff-0.0.5/lib/gruff/area.rb:8:
uninitialized constant Gruff (NameError)
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in require’

    from /usr/lib/ruby/gems/1.8/gems/gruff-0.0.5/lib/gruff.rb:4

    from

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in require’

    from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:175:in `activate'

    from

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:23:in `require’

    from browsershare.rb:9

On RHEL4, I get this perty graph:

http://involution.com/images/browsershare.png

I was thinking that maybe somehow gruff couldn’t find base, but that
appears to not be the case as I tried adding one of there:

begin

require ‘gruff/base’

rescue LoadError

puts “could not find gruff/base”

end

And I don’t see the puts message on the terminal, still the error.

I know this is probably some very stupid that’s happening, but since
I’m such a ruby n00b, I can’t figure it out.

Tony

hoyhoy wrote:

/usr/lib/ruby/gems/1.8/gems/gruff-0.0.5/lib/gruff/area.rb:8:
uninitialized constant Gruff (NameError)

That usually happens when your RMagick install is broken. I’m not sure,
but I think the RMagick package from darwinports does only work when you
also install ruby from darwinports. Better install the RMagick Gem (gem
install rmagick).

Interesting… I actually installed rmagick from gems, but ImageMagick
from Darwinports (and fink). The only thing that I haven’t tried yet
is installing ImageMagick from source as was done in the Ruby On OSX
FAQ. Thanks for the quick reply.

Tony
http://involution.com

[email protected] wrote:

Interesting… I actually installed rmagick from gems, but ImageMagick
from Darwinports (and fink). The only thing that I haven’t tried yet
is installing ImageMagick from source as was done in the Ruby On OSX
FAQ. Thanks for the quick reply.

Tony
http://involution.com

Did the RMagick examples run with no errors when you installed the
RMagick gem? If yes, then RMagick+ImageMagick are okay and your problem
is somewhere else. If not, then you’re going to have to fix something,
depending on what kind of errors RMagick displayed.

Here’s a quick test to see if ImageMagick is working just by itself.
Enter

convert Flower_Hat.jpg temp.gif

(Use whatever image you want as input.) Any error messages?

Yeah, I figured it out. ImageMagick was busted when installed from
darwinports by default. Then, I installed from source and didn’t have
my CFLAGS, CPPFLAGS, and LDFLAGS set correctly before I ran configure
(essentially pointing configure at the darwinports png, tiff, jpeg, and
ghostscript libraries). Yeeesh, ImageMagick is a beast to setup on OS
X, someone ought to dmg all of these files for 10.4.3 so as to not
foist the complexity of this install on the world at large…

[email protected] wrote:

Yeah, I figured it out. ImageMagick was busted when installed from
darwinports by default. Then, I installed from source and didn’t have
my CFLAGS, CPPFLAGS, and LDFLAGS set correctly before I ran configure
(essentially pointing configure at the darwinports png, tiff, jpeg, and
ghostscript libraries). Yeeesh, ImageMagick is a beast to setup on OS
X, someone ought to dmg all of these files for 10.4.3 so as to not
foist the complexity of this install on the world at large…

A fellow named Alex Y. says he’s got an easy way to install
ImageMagick and RMagick on OS X. I haven’t tried it but he says it’s
easy. Check it out: http://rmagick.rubyforge.org/install-faq.html#osx

Thanks for the pointer, here was the uneasy way:
CPPFLAGS="-I/opt/local/include " CFLAGS=$CPPFLAGS
LDFLAGS="-L/opt/local/lib" ./configure --prefix=/opt/local
–disable-static --with-modules --without-perl
–without-magick-plus-plus --with-quantum-depth=8
–with-gs-font-dir=/opt/local/share/ghostscript/fonts

Thanks for the pointer, here was the uneasy way:
CPPFLAGS="-I/opt/local/include " CFLAGS=$CPPFLAGS
LDFLAGS="-L/opt/local/lib" ./configure --prefix=/opt/local
–disable-static --with-modules --without-perl
–without-magick-plus-plus --with-quantum-depth=8
–with-gs-font-dir=/opt/local/share/ghostscript/fonts

I actually had to remove RMagick and ImageMagick, and re-build clean
with those options. It’s working now.