Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread
Message: 97263
BY: William Nelson (nelsonwd)
DATE: 2011-12-17 00:00
SUBJECT: rvg.rb:100: [BUG] Segmentation fault

 

I'm a little new to ruby but ..
I'm developing on a Mac, I installed everything and completed the RVG tutorial then I made a prototype for a rails application. Everything worked great until I tried to move it to rails 3.0.9 on the same machine. A stub of the program is:

require 'rvg/rvg'
include Magick

class BlastGraphic

def draw_hit(blast_hit)
RVG::dpi = 72
rvg = RVG.new(8.0.in, 0.5.in).viewbox(0,0, 800, 50) do |canvas|
canvas.text(225, 25) do |title|
title.tspan("Color key for alignment scores").styles(:font_size=>20,
:font_family=>'verdana', :fill=>'black')
end
end
rvg.draw.write("blastLegend.gif")
end
end

It throws the segmentation fault at rvg.draw.write("blastLegend.gif").

In rails console and irb I get:
ruby-1.9.2-p290 :004 > Magick::Long_version
=> "This is RMagick 2.13.1 ($Date: 2009/12/20 02:33:33 $) Copyright (C) 2009 by Timothy P. Hunter\nBuilt with ImageMagick 6.7.3-1 2011-10-28 Q16 http://www.imagemagick.org\nBuilt for ruby 1.9.2\nWeb page: http://rmagick.rubyforge.org\nEmail: rmagick@rubyforge.org\n";

In irb I have to require 'rvg/rvg' or 'RMagick' to get Magick::Long_version to work but in rails console I don't have to run anything to get Magick::Long_version to work. In fact if I
require 'rvg/rvg' or 'RMagick' in the rails console it says:
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/rmagick-2.13.1/lib/RMagick.rb:44: warning: already initialized constant PercentGeometry
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/rmagick-2.13.1/lib/RMagick.rb:45: warning: already initialized constant AspectGeometry
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/rmagick-2.13.1/lib/RMagick.rb:46: warning: already initialized constant LessGeometry
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/rmagick-2.13.1/lib/RMagick.rb:47: warning: already initialized constant GreaterGeometry
.
.
.

In my rails app Gemfile I added the line: gem 'rmagick', '2.13.1'

I'd be grateful if anybody has an idea.
Thanks,
Bill



Thread View

Thread Author Date
rvg.rb:100: [BUG] Segmentation faultWilliam Nelson2011-12-17 00:00

Post a followup to this message