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

1
  • 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/ Oct 10, 2014 at 15:52

2 Answers 2

27

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

1
  • 1
    worked for me on Mac: brew install postgresql -devel . It needs a space between "postgresql" and "-devel"
    – juan Isaza
    Feb 12, 2015 at 0: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

1
  • 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, 2017 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.