13

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...

Serban Tanasa
  • 3,592
  • 2
  • 23
  • 45
  • 1
    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/ – Serban Tanasa Oct 10 '14 at 15:52

2 Answers2

27

Followup info because I just had the same problem.
Installing yum install postgresql-devel resolves the error too.

Curlew
  • 1,022
  • 18
  • 39
  • 1
    worked for me on Mac: brew install postgresql -devel . It needs a space between "postgresql" and "-devel" – juan Isaza Feb 12 '15 at 00:09
9

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

Serban Tanasa
  • 3,592
  • 2
  • 23
  • 45
  • 1
    If the RPostgreSQL file still can't find the path, try adding symbolic link to location of installed package. For example `sudo ln -s /usr/pgsql-9.4/ /usr/local/pgsql` – NoelProf Feb 14 '17 at 01:03