rrd-ffi
rrd-ffi copied to clipboard
Exception: FFI::NotFoundError when rrdtool was compiled without graphics support
rrdtool can be compiled without graphics support with the configure command "./configure --disable-rrdcgi --disable-rrd_graph". If this was the case, then the rrd-ffi gem will throw an exception on import because it can't attach the :rrd_graph method. The attached patch will make that method optional. Tested on FreeBSD 9.1 amd64 with rrdtool version 1.4.7
--- lib/rrd/wrapper.rb.orig 2013-09-23 09:58:04.142000098 -0600 +++ lib/rrd/wrapper.rb 2013-09-23 09:58:42.762000022 -0600 @@ -47,7 +47,11 @@ attach_function :rrd_create, [:int, :pointer], :int attach_function :rrd_dump, [:int, :pointer], :int attach_function :rrd_first, [:int, :pointer], :time_t
-
attach_function :rrd_graph, [:int, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
-
begin
-
attach_function :rrd_graph, [:int, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
-
rescue FFI::NotFoundError => e
-
warn "rrdtool was compiled without graphics support"
-
attach_function :rrd_info, [:int, :pointer], :pointer attach_function :rrd_last, [:int, :pointer], :time_tend