It works after I made the following modifications to extconf.rb:<br><i><br>dir_config("rrd","../../src","/opt/local/lib/")<br>have_library("rrd", "rrd_create", "rrd.h")</i><br>
<br>and then ran:<br><i>ARCHFLAGS="-arch x86_64" ruby extconf.rb –with-rrd-dir=/opt/local</i><br><br>-Sanjit<br><br><div class="gmail_quote">On Wed, Jun 23, 2010 at 11:31 AM, Sanjit Jhala <span dir="ltr"><<a href="mailto:sjhalaz@gmail.com">sjhalaz@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br><br>I am trying to run the Ruby bindings on a Mac OSX 10.6.3. I installed rrdtool 1.3.8 via macports. In addition I downloaded the source for rrdtool-1.3.8, edited the dir_config in bindings/ruby/extconf.rb to:<br>
dir_config("rrd","../../src","/opt/local/lib/"), and ran <br>
"ruby extconf.db; make; sudo make install". However when I run my ruby code I still get:<br><i><br>=> Booting Mongrel<br>=> Rails 2.3.7 application starting on <a href="http://0.0.0.0:3000" target="_blank">http://0.0.0.0:3000</a><br>
/Library/Ruby/Site/1.8/universal-darwin10.0/RRD.bundle: dlopen(/Library/Ruby/Site/1.8/universal-darwin10.0/RRD.bundle, 9): Symbol not found: _rrd_create (LoadError)<br> Referenced from: /Library/Ruby/Site/1.8/universal-darwin10.0/RRD.bundle<br>
Expected in: flat namespace<br> in /Library/Ruby/Site/1.8/universal-darwin10.0/RRD.bundle - /Library/Ruby/Site/1.8/universal-darwin10.0/RRD.bundle<br> from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'<br>
<br></i>When I run "ruby extconf.rb" I get:<br>checking for rrd_create() in -lrrd... no<br><br>which seems like a bad thing.<br><br>Heres some more info about my machine and rrdtool/ruby binding install procedure. <br>
<br><b>OS details:</b><i><br>
sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ uname -a<br>
Darwin Sanjit-Jhalas-MacBook-Pro.local 10.3.0 Darwin Kernel Version
10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386
i386<br>
</i><br><b>librrd exists under /opt/local/lib</b><i><b>:</b><br>sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ ls -ltrh /opt/local/lib/librrd*<br>-rwxr-xr-x 2 root admin 1.5K Jun 22 10:38 /opt/local/lib/<a href="http://librrd_th.la" target="_blank">librrd_th.la</a><br>
-rw-r--r-- 2 root admin 291K Jun 22 10:38 /opt/local/lib/librrd_th.a<br>-rwxr-xr-x 2 root admin 207K Jun 22 10:38 /opt/local/lib/librrd_th.4.dylib<br>-rwxr-xr-x 2 root admin 1.5K Jun 22 10:38 /opt/local/lib/<a href="http://librrd.la" target="_blank">librrd.la</a><br>
-rw-r--r-- 2 root admin 293K Jun 22 10:38 /opt/local/lib/librrd.a<br>-rwxr-xr-x 2 root admin 211K Jun 22 10:38 /opt/local/lib/librrd.4.dylib<br>lrwxr-xr-x 1 root admin 17B Jun 22 10:38 /opt/local/lib/librrd_th.dylib -> librrd_th.4.dylib<br>
lrwxr-xr-x 1 root admin 14B Jun 22 10:38 /opt/local/lib/librrd.dylib -> librrd.4.dylib<br><br></i><b>rrdtool is installed via Macports:</b><i><br>sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ port list rrdtool<br>
rrdtool @1.3.8 net/rrdtool<br><br></i><b>ruby binding install procedure:</b><i><br>sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ cat extconf.rb <br># $Id: extconf.rb,v 1.2 2001/11/28 18:30:16 miles Exp $<br>
# Lost ticket pays maximum rate.<br><br>require 'mkmf'<br><br>if /linux/ =~ RUBY_PLATFORM<br> $LDFLAGS += '-Wl,--rpath -Wl,$(EPREFIX)/lib'<br>elsif /solaris/ =~ RUBY_PLATFORM<br> $LDFLAGS += '-R$(EPREFIX)/lib'<br>
elsif /hpux/ =~ RUBY_PLATFORM<br> $LDFLAGS += '+b$(EPREFIX)/lib'<br>elsif /aix/ =~ RUBY_PLATFORM<br> $LDFLAGS += '-Wl,-blibpath:$(EPREFIX)/lib'<br>end<br><br>dir_config("rrd","../../src","/opt/local/lib/")<br>
have_library("rrd", "rrd_create")<br>create_makefile("RRD")<br>sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ ruby extconf.rb <br><b>checking for rrd_create() in -lrrd... no</b><br>
creating Makefile<br>sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ make<br>gcc -I. -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0 -I. -I../../src -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -c main.c<br>
main.c: In function ‘rb_rrd_infocall’:<br>main.c:153: warning: assignment makes pointer from integer without a cast<br>main.c: In function ‘rb_rrd_info’:<br>main.c:192: warning: passing argument 1 of ‘rb_rrd_infocall’ from incompatible pointer type<br>
main.c: In function ‘rb_rrd_updatev’:<br>main.c:199: warning: passing argument 1 of ‘rb_rrd_infocall’ from incompatible pointer type<br>main.c: In function ‘rb_rrd_graphv’:<br>main.c:206: warning: passing argument 1 of ‘rb_rrd_infocall’ from incompatible pointer type<br>
main.c: In function ‘string_arr_new’:<br>main.c:48: warning: format ‘%d’ expects type ‘int’, but argument 6 has type ‘long int’<br>main.c: In function ‘rb_rrd_infocall’:<br>main.c:153: warning: assignment makes pointer from integer without a cast<br>
main.c: In function ‘rb_rrd_info’:<br>main.c:192: warning: passing argument 1 of ‘rb_rrd_infocall’ from incompatible pointer type<br>main.c: In function ‘rb_rrd_updatev’:<br>main.c:199: warning: passing argument 1 of ‘rb_rrd_infocall’ from incompatible pointer type<br>
main.c: In function ‘rb_rrd_graphv’:<br>main.c:206: warning: passing argument 1 of ‘rb_rrd_infocall’ from incompatible pointer type<br>cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o RRD.bundle main.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L/opt/local/lib/ -L. -arch i386 -arch x86_64 -lruby -lpthread -ldl <br>
sanjit@Sanjit-Jhalas-MacBook-Pro:~/src/rrdtool/rrdtool-1.3.8/bindings/ruby]$ sudo make install<br>/usr/bin/install -c -m 0755 RRD.bundle /Library/Ruby/Site/1.8/universal-darwin10.0<br><br><br></i>I will try and install rrdtool directly from the source instead of macports to see if that makes a difference, but other than that any help will be much appreciated.<br>
<font color="#888888">
<br>-Sanjit<br>
</font></blockquote></div><br>