Unable to install RPostgres 1.2.0 on RHEL 7.7

The library compiles correctly but at the end, when the installation process tries to load it it fails to de so. This is what happens at the end of the compilation:

installing to /opt/R/3.6.1/lib64/R/library/00LOCK-RPostgres/00new/RPostgres/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RPostgres’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/opt/R/3.6.1/lib64/R/library/00LOCK-RPostgres/00new/RPostgres/libs/RPostgres.so':
  libpq.so.rh-postgresql12-5: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/opt/R/3.6.1/lib64/R/library/RPostgres’

The downloaded source packages are in
        ‘/tmp/RtmpfWHRa0/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("RPostgres") :
  installation of package ‘RPostgres’ had non-zero exit status

I fully documented my issue in the RPostgres Github page at https://github.com/r-dbi/RPostgres/issues/239

Do you have any idea on what happens?

You are missing this system dependency, I don't use RHEL but I suppose you can Google how to install it in your system.

Thanks for your answer @andresrcs. I searched for an actual file named libpq.so.rh-postgresql12-5 (seems obvious today, thanks to your answer) and found it (the third entry):

$ sudo find / -name libpq.so*
/usr/lib64/libpq.so.5
/usr/lib64/libpq.so.5.5
/opt/rh/rh-postgresql12/root/usr/lib64/libpq.so.rh-postgresql12-5
/opt/rh/rh-postgresql12/root/usr/lib64/libpq.so.rh-postgresql12-5.12
/opt/rh/rh-postgresql12/root/usr/lib64/libpq.so

Also, I checked if any of my environment variables had that path defined:

$ set | grep /usr/lib64
LIBPQ_DIR=/opt/rh/rh-postgresql12/root/usr/lib64/
PKG_CONFIG_PATH=/opt/rh/rh-postgresql12/root/usr/lib64/pkgconfig

Obviously, I did that when reading documentation about troubleshooting RPostgres. Then it struck me and I exported the LIBPQ_DIR value to the LD_LIBRARY_PATH environment variable and it worked!

Solution:

export LD_LIBRARY_PATH=$LIBPQ_DIR

Problem solved!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.