# Rrdtool gem

**URL:** <https://www.ruby-forum.com/t/rrdtool-gem/120088>\
**Category:** Ruby\
**Created:** [November 13, 2007, 5:30pm UTC](https://www.ruby-forum.com/t/rrdtool-gem/120088 "2007-11-13T17:30:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![haleythrapp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/48db29/32.png) [@haleythrapp](https://www.ruby-forum.com/u/haleythrapp)\
**Post date:** [November 13, 2007, 5:30pm UTC](https://www.ruby-forum.com/t/rrdtool-gem/120088/1 "2007-11-13T17:30:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![haleythrapp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/48db29/32.png) [@haleythrapp](https://www.ruby-forum.com/u/haleythrapp)\
**Post date:** [November 13, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/rrdtool-gem/120088/2 "2007-11-13T19:29:47Z")

</div>

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](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?

---

<div class="post-metadata">

**Author:** ![haleythrapp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/48db29/32.png) [@haleythrapp](https://www.ruby-forum.com/u/haleythrapp)\
**Post date:** [November 13, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/rrdtool-gem/120088/3 "2007-11-13T20:02:36Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![haleythrapp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/48db29/32.png) [@haleythrapp](https://www.ruby-forum.com/u/haleythrapp)\
**Post date:** [November 14, 2007, 4:17am UTC](https://www.ruby-forum.com/t/rrdtool-gem/120088/4 "2007-11-14T04:17:12Z")

</div>

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](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](http://bugs.gentoo.org/show_bug.cgi?id=180144)

and [97403 – ruby-rrd ebuild doesn't build against rrdtool-1.2.6, the latest stable](http://bugs.gentoo.org/show_bug.cgi?id=97403)

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