Rrdtool gem

I am trying to use RRDtool through ruby. I have installed rrdtool and
it appears to be working(I can run the sample scripts). I downloaded
the RubyRRDtool gem and tried to install it. The install appears to
work without errors. I then tried running the example scripts for the
rrdtool gem and just requiring the gem in irb. I get the same error for
both, shown below (1). I then tried building the gem using the
instructions in the README. I did a ‘ruby extconf.rb’, ‘make’, and
‘make install’. Make produces the warnings below (2), but no errors.
The install also seems to succeed, but I get the same issue as the
straight gem install. From my investigation so far, it appears that
there are a number of rrd commands that are not defined in RRDtool.so.
Is it possible the gem build is not linking against rrd correctly, and
if so, how might I fix this? I have attached the Makefile that is
produced from the extconf.rb.

(1)
irb(main):001:0> require “RRDtool”
LoadError:
/usr/lib/ruby/gems/1.8/gems/RubyRRDtool-0.6.0/test/RRDtool.so: undefined
symbol: rrd_resize -
/usr/lib/ruby/gems/1.8/gems/RubyRRDtool-0.6.0/test/RRDtool.so
from
/usr/lib/ruby/gems/1.8/gems/RubyRRDtool-0.6.0/test/RRDtool.so
from
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require’
from (irb):1

(2)
i386-redhat-linux-gcc -I. -I. -I/usr/lib/ruby/1.8/i386-linux -I. -fPIC
-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386
-mtune=generic -fasynchronous-unwind-tables -Wall -fPIC -c
rubyrrdtool.c
rubyrrdtool.c: In function \u2018rrdtool_create\u2019:
rubyrrdtool.c:317: warning: passing argument 5 of
\u2018rrd_create_r\u2019 from incompatible pointer type
rubyrrdtool.c: In function \u2018rrdtool_update\u2019:
rubyrrdtool.c:590: warning: passing argument 4 of
\u2018rrd_update_r\u2019 from incompatible pointer type
i386-redhat-linux-gcc -shared -L"/usr/lib" -o RRDtool.so rubyrrdtool.o
-lruby -lart_lgpl_2 -lfreetype -lpng -lz -lpthread -ldl -lcrypt -lm
-lc

Haley T. wrote:

there are a number of rrd commands that are not defined in RRDtool.so.
/usr/lib/ruby/gems/1.8/gems/RubyRRDtool-0.6.0/test/RRDtool.so: undefined
(2)
\u2018rrd_update_r\u2019 from incompatible pointer type
i386-redhat-linux-gcc -shared -L"/usr/lib" -o RRDtool.so rubyrrdtool.o
-lruby -lart_lgpl_2 -lfreetype -lpng -lz -lpthread -ldl -lcrypt -lm
-lc

Attachments:
http://www.ruby-forum.com/attachment/965/Makefile

The “-lrrd” seems to be missing from your Makefile (and hence from the
link step above).

Mine looks like this:

LIBS = -lrrd -lart_lgpl_2 -lfreetype -lpng -lz -lpthread -ldl -lcrypt
-lm -lc

Can you show your mkmf.log?

Joel VanderWerf wrote:

Haley T. wrote:

there are a number of rrd commands that are not defined in RRDtool.so.
/usr/lib/ruby/gems/1.8/gems/RubyRRDtool-0.6.0/test/RRDtool.so: undefined
(2)
\u2018rrd_update_r\u2019 from incompatible pointer type
i386-redhat-linux-gcc -shared -L"/usr/lib" -o RRDtool.so rubyrrdtool.o
-lruby -lart_lgpl_2 -lfreetype -lpng -lz -lpthread -ldl -lcrypt -lm
-lc

Attachments:
http://www.ruby-forum.com/attachment/965/Makefile

The “-lrrd” seems to be missing from your Makefile (and hence from the
link step above).

Mine looks like this:

LIBS = -lrrd -lart_lgpl_2 -lfreetype -lpng -lz -lpthread -ldl -lcrypt
-lm -lc

Can you show your mkmf.log?

Thanks, it was the -lrrd that was missing. I had to move the .so files
so that they could be found correctly, but it appears to be working now.

Haley

Haley T. wrote:

there are a number of rrd commands that are not defined in RRDtool.so.
/usr/lib/ruby/gems/1.8/gems/RubyRRDtool-0.6.0/test/RRDtool.so: undefined
(2)
\u2018rrd_update_r\u2019 from incompatible pointer type
i386-redhat-linux-gcc -shared -L"/usr/lib" -o RRDtool.so rubyrrdtool.o
-lruby -lart_lgpl_2 -lfreetype -lpng -lz -lpthread -ldl -lcrypt -lm
-lc

Attachments:
http://www.ruby-forum.com/attachment/965/Makefile

I think the most recent version of RRDTool source comes bundled with a
working Ruby binding, which you need to enable when you configure
RRDTool. I ran into some conflicts between RRDTool and the Ruby binding
package in Gentoo, and they went away when I compiled RRDTool with the
Ruby bindings bundled with it.

See 180144 – confusion over RRDtool Ruby bindings; possible need for a blocker between rrdtool and ruby-rrd

and 97403 – ruby-rrd ebuild doesn't build against rrdtool-1.2.6, the latest stable

If you’re not building RRDTool from source, you’ll probably need to go
hassle your distro’s bug tracker (unless you’re using Gentoo, in which
case it just works.)