Ruby Solaris Rrdtool

From EggeWiki

When I first compiled the rrd tool extension for Ruby, I was getting this error: <geshi lang="ruby"> irb(main):002:0> require 'RRD' LoadError: ld.so.1: ruby: fatal: relocation error: file /app/retailtools/lib/ruby/site_ruby/1.8/i386-solaris2.10/RRD.so: symbol rrd_create: referenced symbol not found - /app/retailtools/lib/ruby/site_ruby/1.8/i386-solaris2.10/RRD.so

       from /app/retailtools/lib/ruby/site_ruby/1.8/i386-solaris2.10/RRD.so
       from (irb):2

</geshi>

I then modified the extconf.rb file: <geshi lang="ruby">

  1. $Id: extconf.rb,v 1.2 2001/11/28 18:30:16 miles Exp $
  2. Lost ticket pays maximum rate.

require 'mkmf'

if /linux/ =~ RUBY_PLATFORM

  $LDFLAGS += '-Wl,--rpath -Wl,$(EPREFIX)/lib'

elsif /solaris/ =~ RUBY_PLATFORM

  $LDFLAGS += '-R$/app/retailtools/lib'
  $LOCAL_LIBS = "-Xlinker -Bstatic -lct -lcs -ltcl -lcomn -lintl -Xlinker -Bdynamic -lnsl"

elsif /hpux/ =~ RUBY_PLATFORM

  $LDFLAGS += '+b$(EPREFIX)/lib'

elsif /aix/ =~ RUBY_PLATFORM

  $LDFLAGS += '-Wl,-blibpath:$(EPREFIX)/lib'

end

dir_config("rrd") if have_library("rrd", "rrd_create") then

 create_makefile("RRD")

else

 puts "Can't find rrd library"

end </geshi>

Then I recompiled: <geshi lang="bash"> ruby extconf.rb --with-rrd-dir=/app/retailtools/rrdtool make clean make make install </geshi>

Lastly, I ran the test

<geshi> $ ruby test.rb creating test.rrd

updating test.rrd

fetching data from test.rrd got 2 data points from 1208572200 to 1208662500

generating graph test.png

This script has created test.png in the current directory This demonstrates the use of the TIME and % RPN operators </geshi>