Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install RPostgreSQL on RHEL 6.5 libpq-fe.h Error

I have RHEL 6.5 Server with an installation of R (3.1.1) & RStudioServer (0.98.1062)

I have postgresql-9.3 installed and handling a large database. In order to connect R to PostgreSQL, I have in the past used the RPostgreSQL (still do on my CentOS 7 Workstation). However, attempting to compile under RHEL 6.5 I get an error

In file included from RS-PQescape.c:7:
RS-PostgreSQL.h:23:26: error: libpq-fe.h: No such file or directory

The file is located on my system here:

/usr/pgsql-9.3/include/libpq-fe.h

Libpq is part of the Postgres installation, but RPostgreSQL cannot find it:

[root@server /]# yum list libpq*
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Installed Packages
libpqxx.x86_64     1:4.0.1-1.rhel6                                               @pgdg93
libpqxx-debuginfo.x86_64     1:4.0.1-1.rhel6                                     @pgdg93
libpqxx-devel.x86_64   1:4.0.1-1.rhel6                                           @pgdg93

Is there any way to tell RPostgreSQL where to look (symbolic links?) or some other workaround? This should be simple, but I've wasted several hours on this already...

like image 241
Serban Tanasa Avatar asked Oct 10 '14 15:10

Serban Tanasa


1 Answers

I ended up looking into the RPostgreSQL configure file in the tarball, searched for the file name the script couldn't find and decided it was easiest to create an environmental variable:

export PG_INCDIR=/usr/pgsql-9.3/include/

Worked like a charm after that.

If you have sudo rights, you could also try:

yum install postgresql-devel

like image 181
Serban Tanasa Avatar answered Sep 20 '22 18:09

Serban Tanasa