4

I am trying to install R-Package RPostgreSQL, but getting the following error,

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so':
  /usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so: undefined symbol: PQpass
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/lib64/R/library/RPostgreSQL’

I have libpq and postgresql-dev installed. All the library files are in the directory

/usr/lib64/pgsql/ and all header files are in the directory

/usr/include/pgsql/

Postgre Version - 9.3.4 R Version - 3.0.2 Operating System - CentOS-6.4

I am missing some small thing, but unable to find out why this is happening.

What am I doing wrong? How to correct this?

Braiam
  • 1
  • 11
  • 47
  • 78
Manoj G
  • 1,776
  • 2
  • 24
  • 29
  • I'd say the `libpq.so` being found is different to the one that `RPostgreSQL.so` was originally linked to. `ldd /usr/lib64/R/library/RPostgreSQL/libs/RPostgreSQL.so` please. – Craig Ringer May 23 '14 at 09:56

2 Answers2

7

Looks like the pgsql libraries are no longer installed in their previous locations. I linked both:

ln -s /usr/pgsql-9.3/lib /usr/lib/pgsql

ln -s /usr/pgsql-9.3/include /usr/include/pgsql

This worked for me :)

chopper
  • 6,649
  • 7
  • 36
  • 53
warner121
  • 171
  • 1
  • 5
5

The package RPostgreSQL checks for PostgreSQL libraries only in the following directory paths,

    /usr/lib 
/usr/lib/pgsql 
/usr/lib/postgresql 
/usr/local/lib 
/usr/local/lib/pgsql 
/usr/local/lib/postgresql 
/usr/local/pgsql/lib 
/usr/local/postgresql/lib 
/opt/lib 
/opt/lib/pgsql 
/opt/lib/postgresql 
/opt/local/lib 
/opt/local/lib/postgresql 
/opt/local/lib/postgresql84 
/sw/opt/postgresql-8.4/lib 
/Library/PostgresPlus/8.4SS/lib 
/sw/lib

It does not check for the directories either in LD_LIBRARY_PATH or in /etc/ld.so.conf.

So RPostgreSQL installation will be successful only if the PostgreSQL libraries exist in any of the above directories.

When I copied the libraries from /usr/lib64/pgsql to /usr/lib/pgsql and tried installing the package. It worked. :)

Manoj G
  • 1,776
  • 2
  • 24
  • 29
  • Your answer helped me get it installed. But inspecting the configure file in package, it turns out that it first checks `pg_config --libdir`. All I needed to do was make sure `pg_config` was visible in `PATH`. – user1071847 Mar 10 '16 at 23:14
  • @user1071847 Could you explain how to make pg_config visible in PATH? – Andy Jun 14 '17 at 22:57
  • @Andy: (This is for Linux.) In my `.bash_profile` file, I edited `PATH` to be `PATH=$HOME/bin:$HOME/usr/bin:$HOME/usr/local/pgsql/bin:$PATH`. You'd have to replace `$HOME/usr/local/pgsql/bin` by whatever the path to `pg_config` is in your case, and of course all the other path components other than the last are for my setup only. – user1071847 Jun 16 '17 at 12:06