Skip to content

unable to load package RPgSQL

3 messages · Laurent Faisnel, Dirk Eddelbuettel

#
Hi all,
I'm trying to install an add-on package for R called RPgSQL. Its role 
will be to link R with a PostgreSql database. I work on a Linux machine.
However, I'm quite a newbie as far as R's concerned, and I don't manage 
to install the package properly.
That's the steps I followed :

    * downloading the package (archive) 
    * R CMD INSTALL /path/to/package.tar.gz (as indicated in docs) - at
      that moment I had an error about unspecified directories for
      PostgreSql , so I used the option  --configure-args to specify
      where are the PostgreSql libraries and headers.
    * The installation then seemed to be a success : 

------------------------------------------------------------------------

R CMD INSTALL /home/faisnel/PostGresSql/RPgSQL_1.0-0.tar.gz 
--configure-args='--with-pgsql-libraries=/usr/local/pgsql/lib 
--with-pgsql-includes=/usr/local/pgsql/include'
* Installing *source* package 'RPgSQL' ...
creating cache ./config.cache
checking for crypt in -lcrypt... yes
checking how to run the C preprocessor... cc -E
checking for /usr/include/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /usr/include/pgsql/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /usr/include/postgresql/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /usr/local/include/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /usr/local/include/pgsql/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /usr/local/include/postgresql/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /opt/include/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /opt/include/pgsql/libpq-fe.h... no
checking how to run the C preprocessor... cc -E
checking for /opt/include/postgresql/libpq-fe.h... no
updating cache ./config.cache
creating ./config.status
creating src/Makevars
** libs
gcc -I/usr/lib/R/include -I/usr/local/pgsql/include  -D__NO_MATH_INLINES 
-mieee-fp  -fPIC  -O2 -march=i386 -mcpu=i686 -c RPgSQL.c -o RPgSQL.o
gcc -shared -L/usr/local/lib -o RPgSQL.so RPgSQL.o -lcrypt 
-L/usr/local/pgsql/lib -lpq
** R
** help
 >>> Building/Updating help pages for package 'RPgSQL'
     Formats: text html latex example
  db.result.get.value               text    html    latex   example
  db.write.table                    text    html    latex   example
  psql                              text    html    latex
  rpgsql.connections                text    html    latex
  rpgsql.execute.query              text    html    latex   example
  rpgsql.input                      text    html    latex   example
  rpgsql.list.contents              text    html    latex   example
  rpgsql.proxy                      text    html    latex   example
  rpgsql.result.attributes          text    html    latex
  rpgsql.type.conversions           text    html    latex   example
  rpgsql.utils                      text    html    latex
  sql.insert                        text    html    latex   example
  sql.select                        text    html    latex   example
  sql.update                        text    html    latex   example
* DONE (RPgSQL)

* DONE (INSTALL)
------------------------------------------------------------------------

However, when I try to load the package in R, it's a failure :

 > library(RPgSQL)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
        unable to load shared library 
"/usr/lib/R/library/RPgSQL/libs/RPgSQL.so":
  libpq.so.3: cannot open shared object file: No such file or directory
Error in library(RPgSQL) : .First.lib failed

Thank you in advance for any help.

Laurent
#
On Wed, Apr 16, 2003 at 02:46:56PM +0200, Laurent Faisnel wrote:
[...]
Not exactly as ...
... it told you about nine times that a header file is amiss.  I would call
it a bug in RPgSQL that it even progrsses as it will obviously fail later
at the point you noticed.

Bottom line: install the required postgresql header files package, and try
again.

Hth, Dirk
#
Dirk Eddelbuettel wrote:

            
Thank you for your fast help. I desperately tried to install the header 
files yesterday, but it seemed to me they were already there. The 
solution was given to me this morning. I had to set an environment 
variable to the correct value (LD_LIBRARY_PATH), and nothing to install.
I gave the path to the libraries, so that the computer could find 
libpq.so.3, and it worked at once.

Laurent