Installing RPostgreSQL on Red Hat Linux

1,725 views
Skip to first unread message

Marta Cretu

unread,
Mar 6, 2014, 2:52:57 AM3/6/14
to rpostgr...@googlegroups.com
I have 
        Linux version 2.6.32-279.22.1.el6.x86_64 (mock...@c6b10.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Wed Feb 6 03:10:46 UTC 2013

  LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-‌​4.0-amd64:printing-4.0-noarch

When I try in R to install.packages('RPostgreSQL'), 
it fails with unspecified errors:
     Warning message
     In install.packages("RPostgreSQL") :
     installation of package ‘RPostgreSQL’ had non-zero exit status
I'm beginner at linux, help me please, to solve this problem.

Sean O'Riordain

unread,
Mar 6, 2014, 3:06:11 AM3/6/14
to rpostgr...@googlegroups.com
Hi Marta,
I don't use Redhat... but I suspect that there was another more relevant error above the "Warning message"... there might be dependencies? try doing install.packages('RPostgreSQL', dep=TRUE)
Sometimes the dependency chain doesn't work properly so you might have to "manually" install these missing packages.

Good luck,
Seán
Trinity College, Dublin



On 6 March 2014 07:52, Marta Cretu <mart...@gmail.com> wrote:
I have 
        Linux version 2.6.32-279.22.1.el6.x86_64 (mock...@c6b10.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Wed Feb 6 03:10:46 UTC 2013

  LSB Version: :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

When I try in R to install.packages('RPostgreSQL'), 
it fails with unspecified errors:
     Warning message
     In install.packages("RPostgreSQL") :
     installation of package ‘RPostgreSQL’ had non-zero exit status
I'm beginner at linux, help me please, to solve this problem.

--
You received this message because you are subscribed to the Google Groups "RPostgreSQL Development and Discussion List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rpostgresql-d...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Marta Cretu

unread,
Mar 6, 2014, 3:15:44 AM3/6/14
to rpostgr...@googlegroups.com
Hi Sean,
unfortunately, it still doesn' t work. More information hier:

Sean O'Riordain

unread,
Mar 6, 2014, 3:22:15 AM3/6/14
to rpostgr...@googlegroups.com
Hi Marta,
Near the top of the screenshot it says

checking for "/libpq-fe.h"... no

To me this implies that it cannot find the header files for postgresql, so I'm guessing the postgresql-devel yum package is needed.

You might also need to install the postgresql libs, so on redhat it might be something like??? I am an ubuntu user myself and I haven't use Redhat since about 1998 :-)
yum install postgresql-libs

yum install postgresql-devel

Take care,
Seán



--

Marta Cretu

unread,
Mar 6, 2014, 3:26:56 AM3/6/14
to rpostgr...@googlegroups.com
Sean,
thank you a lot!!! It works! :)))

NISHIYAMA Tomoaki

unread,
Mar 6, 2014, 3:19:36 AM3/6/14
to rpostgr...@googlegroups.com, NISHIYAMA Tomoaki
Hi,

If you don't have the libraries and headers installed that doesn't work.
If you have the root privilege of the system, an easy way is

# yum install postgresql-devel postgresql-libs

General requirement is that
$ pg_config
on the command prompt shows proper information of library and header paths.

Best regards,
--
Tomoaki NISHIYAMA

Advanced Science Research Center,
Kanazawa University,
13-1 Takara-machi,
Kanazawa, 920-0934, Japan

Nelson Jaiva

unread,
Sep 10, 2015, 10:35:18 AM9/10/15
to RPostgreSQL Development and Discussion List, tomo...@staff.kanazawa-u.ac.jp
Dear Tomoaki and other,

I have a problem similar to Martas about one year ago (see copy of terminal output below). My situation is as follows:
I have installed R-3.2.2 and PostgreSQL-9.4.4 on Linux supercomputing cluster, where I do not have root user rights. Therefore I installed postgres in a directory, where I have writing permission:

mkdir postgresql
./configure --prefix=/home/hpc/pr48co/gu28luf2/postgresql
make
make install

Now, the header '/libpq-fe.h' is in ~/postgresql/include/, but cannot be found during the installation of RPostgreSQL. I tried to add the include directory to the search path:

export PATH=$PATH:~/postgresql/include

but that did not work either. It seems that somewhere a reference to libpq-fe.h is missing, but I do not know how do fix it. Maybe the reference should be in pg_config? If yes, how would it look like?

This is the linux distribution on the cluster:
Linux version 3.0.101-0.47.55-default (geeko@buildhost) (gcc version 4.3.4 [gcc-4_3-branch revision 152973] (SUSE Linux) ) #1 SMP Thu May 28 08:25:11 UTC 2015 (dc083ee)

Best,
Nelson Jaiva


APPENDIX: error when trying to install RPostgreSQL

gu28luf2@lxa191:~> ~/r/R-3.2.2/bin/R CMD INSTALL $PKG
* installing to library ‘/home/hpc/pr48co/gu28luf2/r/R-3.2.2/library’
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for pg_config... no
configure: checking for PostgreSQL header files
configure: Checking include /usr/include.
configure: Checking include /usr/include/pgsql.
configure: Checking include /usr/include/postgresql.
configure: Checking include /usr/local/include.
configure: Checking include /usr/local/include/pgsql.
configure: Checking include /usr/local/include/postgresql.
configure: Checking include /usr/local/pgsql/include.
configure: Checking include /usr/local/postgresql/include.
configure: Checking include /opt/include.
configure: Checking include /opt/include/pgsql.
configure: Checking include /opt/include/postgresql.
configure: Checking include /opt/local/include.
configure: Checking include /opt/local/include/postgresql.
configure: Checking include /opt/local/include/postgresql84.
configure: Checking include /sw/opt/postgresql-8.4/include.
configure: Checking include /Library/PostgresPlus/8.4SS/include.
configure: Checking include /sw/include/postgresql.
configure: Checking lib /usr/lib.
configure: Checking lib /usr/lib/pgsql.
configure: Checking lib /usr/lib/postgresql.
configure: Checking lib /usr/local/lib.
configure: Checking lib /usr/local/lib/pgsql.
configure: Checking lib /usr/local/lib/postgresql.
configure: Checking lib /usr/local/pgsql/lib.
configure: Checking lib /usr/local/postgresql/lib.
configure: Checking lib /opt/lib.
configure: Checking lib /opt/lib/pgsql.
configure: Checking lib /opt/lib/postgresql.
configure: Checking lib /opt/local/lib.
configure: Checking lib /opt/local/lib/postgresql.
configure: Checking lib /opt/local/lib/postgresql84.
configure: Checking lib /sw/opt/postgresql-8.4/lib.
configure: Checking lib /Library/PostgresPlus/8.4SS/lib.
configure: Checking lib /sw/lib.

checking for "/libpq-fe.h"... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/home/hpc/pr48co/gu28luf2/r/R-3.2.2/include -DNDEBUG -I -I/usr/local/include    -fpic  -g -O2  -c RS-DBI.c -o RS-DBI.o
gcc -std=gnu99 -I/home/hpc/pr48co/gu28luf2/r/R-3.2.2/include -DNDEBUG -I -I/usr/local/include    -fpic  -g -O2  -c RS-PQescape.c -o RS-PQescape.o
In file included from RS-PQescape.c:7:
RS-PostgreSQL.h:23:26: error: libpq-fe.h: No such file or directory
RS-PQescape.c: In function ‘RS_PostgreSQL_escape’:
RS-PQescape.c:21: error: ‘PGconn’ undeclared (first use in this function)
RS-PQescape.c:21: error: (Each undeclared identifier is reported only once
RS-PQescape.c:21: error: for each function it appears in.)
RS-PQescape.c:21: error: ‘my_connection’ undeclared (first use in this function)
RS-PQescape.c:28: error: expected expression before ‘)’ token
RS-PQescape.c:32: warning: implicit declaration of function ‘PQescapeStringConn’
make: *** [RS-PQescape.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/home/hpc/pr48co/gu28luf2/r/R-3.2.2/library/RPostgreSQL’
gu28luf2@lxa191:~>

Joe Conway

unread,
Sep 10, 2015, 11:00:43 AM9/10/15
to rpostgr...@googlegroups.com, tomo...@staff.kanazawa-u.ac.jp
On 09/10/2015 07:35 AM, Nelson Jaiva wrote:
> mkdir postgresql
> ./configure --prefix=/home/hpc/pr48co/gu28luf2/postgresql
> make
> make install
>
> Now, the header '/libpq-fe.h' is in ~/postgresql/include/, but cannot be
> found during the installation of RPostgreSQL. I tried to add the include
> directory to the search path:
>
> export PATH=$PATH:~/postgresql/include

PATH is for executables, not includes. Looks like C_INCLUDE_PATH might
work -- see:

http://www.network-theory.co.uk/docs/gccintro/gccintro_23.html

You might need to set LD_LIBRARY_PATH too.

> but that did not work either. It seems that somewhere a reference to
> libpq-fe.h is missing, but I do not know how do fix it. Maybe the
> reference should be in pg_config? If yes, how would it look like?

pg_config can get those locations for you, e.g. something like:

export C_INCLUDE_PATH=$(pg_config --includedir):${C_INCLUDE_PATH}
export LD_LIBRARY_PATH=$(pg_config --libdir):${LD_LIBRARY_PATH}

HTH,

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

signature.asc

Nelson Jaiva

unread,
Sep 10, 2015, 11:20:34 AM9/10/15
to RPostgreSQL Development and Discussion List, tomo...@staff.kanazawa-u.ac.jp
Dear Joe,

excellent - that worked.

Thank's a lot your help and thank's also for the reference: That book is something I was looking for.
Nelson
Reply all
Reply to author
Forward
0 new messages