Обсуждение: Connecting R to PostgreSQL

Поиск
Список
Период
Сортировка

Connecting R to PostgreSQL

От
Adam Witney
Дата:
Hi,

I am not sure if the problem here relates to PostgreSQL or elsewhere, but I
am trying to connect the R statistical package to my PostgreSQL database
using the Rdbi.PgSQL driver.

The driver installs ok, however when I try to load it in R I get the
following error

> library(Rdbi.PgSQL)
Error in dyn.load(x, as.logical(local), as.logical(now)) :       unable to load shared library "/Users/adam/Projects/R
stuff/rlibs/Rdbi.PgSQL/libs/Rdbi.PgSQL.so": dlcompat: dyld: /sw/lib/R/bin/R.bin Undefined symbols:
_ERR_get_error
_ERR_reason_error_string
_SSL_CTX_new
_SSL_connect
_SSL_free
_SSL_library_init
_SSL_load_error_strings
_SSL_new
_SSL_read
_SSL_set_fd
_SSL_write
_SSLv23_method
Error in library(Rdbi.PgSQL) : .First.lib failed

Looking through the source code the driver includes <libpq-fe.h> which
subsequently includes openssl/ssl.h

I don't know if this is where the problem lies?

My system is Mac OSX 10.2

Any ideas or pointers to further information would be greatly appreciated.

Thanks

Adam


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



Re: Connecting R to PostgreSQL

От
Tom Lane
Дата:
Adam Witney <awitney@sghms.ac.uk> writes:
> The driver installs ok, however when I try to load it in R I get the
> following error

>> library(Rdbi.PgSQL)
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>         unable to load shared library "/Users/adam/Projects/R
> stuff/rlibs/Rdbi.PgSQL/libs/Rdbi.PgSQL.so":
>   dlcompat: dyld: /sw/lib/R/bin/R.bin Undefined symbols:
> _ERR_get_error
> _ERR_reason_error_string
> _SSL_CTX_new
> _SSL_connect
> _SSL_free
> _SSL_library_init

It looks like the dynamic loader is failing to find the SSL library
(libssl.so), which is required by your PG client library.  I don't know
enough about OSX to know how library searching is handled, but on other
Unixen you'd need to mess with ldconfig or LD_LIBRARY_PATH ... or
perhaps easier, put libssl.so into a more standard location than
wherever it is now.

Alternatively, you could rebuild PG omitting SSL support.
        regards, tom lane


Re: Connecting R to PostgreSQL

От
Steven O'Toole
Дата:
On Saturday, September 14, 2002, at 07:29 AM, Adam Witney wrote:

>   dlcompat: dyld: /sw/lib/R/bin/R.bin Undefined symbols:
> _ERR_get_error
> _ERR_reason_error_string
> _SSL_CTX_new

I don't know if this is helpful to you since I am a novice and don't 
know R.  But I am connecting to libpq on OSX and ran into similar 
errors.  I solved them (assuming you're using ProjectBuilder in 10.2) 
in the Target/Linker Settings area.  Under the field titled Other Mach 
-O Linker Flags I entered:
-lcrypto -lssl

I still get a warning about a duplicate definition of _crypto that I 
haven't figured out.  But the interface to PostgreSQL works great.



Re: Connecting R to PostgreSQL

От
Adam Witney
Дата:
On 14/9/02 7:30 pm, "Tom Lane" <tgl@sss.pgh.pa.us> wrote:

> Adam Witney <awitney@sghms.ac.uk> writes:
>> The driver installs ok, however when I try to load it in R I get the
>> following error
> 
>>> library(Rdbi.PgSQL)
>> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>>         unable to load shared library "/Users/adam/Projects/R
>> stuff/rlibs/Rdbi.PgSQL/libs/Rdbi.PgSQL.so":
>>   dlcompat: dyld: /sw/lib/R/bin/R.bin Undefined symbols:
>> _ERR_get_error
>> _ERR_reason_error_string
>> _SSL_CTX_new
>> _SSL_connect
>> _SSL_free
>> _SSL_library_init
> 
> It looks like the dynamic loader is failing to find the SSL library
> (libssl.so), which is required by your PG client library.  I don't know
> enough about OSX to know how library searching is handled, but on other
> Unixen you'd need to mess with ldconfig or LD_LIBRARY_PATH ... or
> perhaps easier, put libssl.so into a more standard location than
> wherever it is now.
> 
> Alternatively, you could rebuild PG omitting SSL support.

Hmm, I downloaded the non ssl version of postgresql from fink. Again fink
does all the compiling so I am not sure how it did it. Is there a way of
testing for sure if the ssl was or not compiled in?

Thanks

adam