alexgutteridge/rsruby — pull request #15 by bluewomble (2012-10-29 12:04:08+00:00)
Title: Fix build on Ubuntu Quantal

I couldn't get the current release branch of rsruby to build on the latest Ubuntu with the standard ruby package - it gives the following error:

$ sudo gem install rsruby -- --with-R-dir=$R_HOME --with-R-include=/usr/share/R/include
Building native extensions. This could take a while...
ERROR: Error installing rsruby:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.9.1 extconf.rb --with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include
checking for main() in -lR... yes
checking for R.h... yes
creating Makefile

make
compiling robj.c
compiling rsruby.c
rsruby.c: In function ‘r_finalize’:
rsruby.c:104:3: warning: implicit declaration of function ‘Rf_KillAllDevices’ [-Wimplicit-function- declaration]
rsruby.c: In function ‘rs_shutdown’:
rsruby.c:121:3: warning: implicit declaration of function ‘Rf_endEmbeddedR’ [-Wimplicit-function- declaration]
compiling Converters.c
Converters.c: In function ‘ruby_to_R’:
Converters.c:107:7: error: format not a string literal and no format arguments [-Werror=format-security]
Converters.c: In function ‘to_ruby_vector’:
Converters.c:356:25: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
Converters.c:384:21: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
Converters.c:310:9: warning: unused variable ‘params’ [-Wunused-variable]
Converters.c: In function ‘to_ruby_hash’:
Converters.c:601:10: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
cc1: some warnings being treated as errors
make: *** [Converters.o] Error 1

Gem files will remain installed in /var/lib/gems/1.9.1/gems/rsruby-0.5.1.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/rsruby-0.5.1.1/ext/gem_make.out

I thin kthe issue is similar to the compilation errors reported in this issue in eventmachine:
https://github.com/eventmachine/eventmachine/issues/346

...and the fix is very similar - I've modified a couple of the rb_raise calls to include the format string "%s" explicitly.

Thanks,
Ash.