Question

I am trying to get PL/R running on a linux server where I do not have root access. The installation itself works fine using the command below:

LD_INCLUDE_PATH="$HOME/pgsql/include" LD_LIBRARY_PATH="$HOME/pgsql/lib:$HOME/lib/R/lib" PGDATA="$HOME/usr/pgsql/data" PG_LIB_DIR="$HOME/pgsql/lib" R_HOME="$HOME/lib/R" USE_PGXS=1 make

When I try to add the plr extension to a database with CREATE EXTENSION plr; however, I get the following error:

ERROR: could not load library "~/lib/postgresql/plr.so": libR.so: cannot open shared object file: No such file or directory

I read on the bottom of the install documentation page that I should add the library path to the LD config file /etc/ld.so.conf, but I do not have root access and I can not change this file.

Is there a workaround for this?

thanks in advance

Was it helpful?

Solution

You need to set LD_LIBRARY_PATH="$HOME/pgsql/lib:$HOME/lib/R/lib" at run-time in the PostgreSQL server's environment. Since you appear to be running PostgreSQL out of your home directory under your own user ID that should be as easy as exporting the environment variable before running pg_ctl, eg:

LD_LIBRARY_PATH="$HOME/pgsql/lib:$HOME/lib/R/lib" pg_ctl -D the_datadir start

Alternately you could see if you can re-compile PL/R with rpath linking enabled, so plr.so has a path to libR.so embedded in it by the linker at compile time. Pass the -rpath option in LDFLAGS or pass -Wl,-rpath in CFLAGS. See -rpath in man ld and -Wl in man gcc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top