Tutorial :Installing PL/Ruby for PostgreSQL 8.3



Question:

This is to enable the development of postgres functions with embedded ruby code, but I have been unable to build it.

As advised by http://www.robbyonrails.com/articles/2005/08/22/installing-untrusted-pl-ruby-for-postgresql

I am trying to build the needed plruby.so from the latest version (plruby-0.5.3.tar.gz) provided at ftp://moulon.inra.fr/pub/ruby/

I've sorted out where my local postgres set up is and adjusted the invocation to:

ruby extconf.rb --with-pgsql-include=/usr/postgresql-8.3.4/include/server --enable-shared --disable-conversion --with-pgsql-version=83  

I've tried quite number of variations on that, but it does not seem to be able to successfully make the 'conftest.c' file

It says this:

checking for catalog/pg_proc.h... yes  *** extconf.rb failed ***  Could not create Makefile due to some reason, probably lack of  necessary libraries and/or headers.  Check the mkmf.log file for more  details.  You may need configuration options.  

And here is what I end up with in my mkmf.log

have_header: checking for catalog/pg_proc.h... -------------------- yes  "gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -I/usr/postgresql-8.3.4/include/server   -g -O2  -fPIC  conftest.c -o conftest.i"  checked program was:  /* begin */  1: #include <catalog/pg_proc.h>  /* end */  

When I run the gcc line manually, it says there is no 'conftest.c' (and there is not, but it is supposed to be generated).

'uname -a' ... gives  Linux vdev1 2.6.18.8-xen #2 SMP Thu May 8 11:52:29 PDT 2008 x86_64 x86_64 x86_64 GNU/Linux  'ruby -v' ... gives  ruby 1.8.6 (2008-08-11 patchlevel 287) [x86_64-linux]  

Any help and/or advice would be appreciated.

-- Mike Berrow


Solution:1

OK, I managed to hand build this (bypassing the fragile extconf.rb and makefile) by googling for a logfile of a successful build, starting with the gcc lines I saw there, then fiddling with the gcc compile flags and paths until it worked.

In plruby.h change the SAFE_LEVEL to 0 as shown below

#ifndef SAFE_LEVEL  //#define SAFE_LEVEL 12  #define SAFE_LEVEL 0  





        
Previous
Next Post »