Compiling PL/R (R language module for PostgreSQL database)

JP Glutting jpglutting at
Mon Feb 14 06:54:04 PST 2011


I am trying to install the PL/R module for Postgres. It creates PL/R, a
procedural language for using R from within Postgres itself. (Note: this
module is called "plr", while Macports has a module called "plr" which
implements the Ruby procedural language for Postgres, but I don't have that
installed and I don't think there is any confusion).

The source code is downloaded from here:

I have both R and Postgres (plus Postgis) installed and updated.

So far, I have downloaded the source to /opt/local/src/, unzipped it, and
tried the "newer" version of the compilation options:

sudo USE_PGXS=1 make

It complains that it can'f find the Rversion.h or Rdevices.h header files
[full results at the end of message]. they exist, but they are not in the
directory where make is looking (/opt/local/lib/R/include) - they are
actually in a sub-directory (/opt/local/lib/R/include/x86_64).

Any tips on how to handle this situation? I am not very literate in
make/makefile jargon, but it seems pretty clear that the way macports
structures source code is throwing off the makefile configuration. I figure
this can be handled by either copying or simlinking the needed headers into
the include directory, but I am not sure if this will create problems later
with the compilation process. Is there some kind of tweak that makes this
work (gets make to search sub-directories, or something)? If not, what is
the cleanest way to work around this problem without making a big mess of
things? I would guess simlinks, but there may be a better way I don't

Thanks for any help,

Output from make:

/usr/bin/gcc-4.2 -pipe -O2 -arch x86_64 -Wall -Wmissing-prototypes
-Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-fno-strict-aliasing -fwrapv  -I"." -I"/opt/local/lib/R/include"
-I/opt/local/lib/R/include -I. -I. -I/opt/local/include/postgresql90/server
-I/opt/local/include/postgresql90/internal -I/opt/local/include
-I/opt/local/include/ossp -I/opt/local/include/libxml2  -I/opt/local/include
-DPKGLIBDIR=\"/opt/local/lib/postgresql90\" -DDLSUFFIX=\".so\"
-DR_HOME_DEFAULT=\"/opt/local/lib/R\"  -c -o plr.o plr.c
In file included from plr.h:83,
                 from plr.c:33:
/opt/local/lib/R/include/R.h:34:21: error: Rconfig.h: No such file or
In file included from plr.c:33:
plr.h:84:22: error: Rversion.h: No such file or directory
plr.h:104:22: error: Rdevices.h: No such file or directory
plr.c: In function ‘plr_cleanup’:
plr.c:285: warning: implicit declaration of function ‘Rf_KillAllDevices’
make: *** [plr.o] Error 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list