Mike Perham

On Ruby, software and the Internet

Using the RRDTool Ruby bindings with OSX

October 22nd, 2007 · 2 Comments

RRDTool is a nice metric storage and graphing library. We’re using its Ruby binding internally to integrate RRDTool into our product but I was having problems getting it running:

…………………dyld: NSLinkModule() error
dyld: Symbol not found: _rrd_graph
Referenced from: /usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0/RRD.bundle
Expected in: flat namespace

This error is due to the Ruby binding not being able to find the native RRD library, librrd. When you install rrdtool via Mac Ports, it installs everything in /opt/local, not /usr/local. What you need to do is update extconf.rb in rrdtool-1.2.x/bindings/ruby and change the following line so that the binding will look in the proper location for the Mac Ports install:

dir_config(“rrd”,”../../src”,”/opt/local/lib”)

Now run ruby extconf.rb ; make ; sudo make install to install the modified Ruby binding.

Tags: Ruby

2 responses so far ↓

  • 1 Geoff // Feb 27, 2008 at 7:09 am

    Thats not really required as you can run

    ruby extconf.rb –with-rrd-lib=/opt/local/lib

    and it should be able to find the library, of course the more generic option to override the “../../src” too would be

    ruby extconf.rb –with-rrd-dir=/opt/local

    found all this out while rather unsuccessfully trying to build RRDtool manually (non MacPorts) and then build the Ruby bindings.

  • 2 Doon // Apr 2, 2008 at 7:20 pm

    If you are trying to build the above on Leopard on an Intel mac, it appears that you need to use

    ARCHFLAGS=”-arch i386″ ruby extconf.rb –with-rrd-dir=/opt/local

    else it won’t locate the lib correctly. (was really annoying since I got the bindings install fine on my FreeBSD boxes, and my Powerbook)

Leave a Comment