Install RPostgreSQL to connect to Postgres.app

I am trying to install RPostgreSQL

on a Mac running OSX 10.9.5 (Mavericks) and R 13.4.0 (Darwin). I probably don't have Postgres installation installed on my system as from terminal:

% which postgres
postgres not found

      

I use [Postgres.app][1]

I tried to install RPostgreSQL

from source

library(devtools)
install('~/Downloads/rpostgresql-read-only/RPostgreSQL')

      

but i am getting error

clang: error: unknown argument: '-Kthread'
clang: error: unknown argument: '-kthread'
make[1]: *** [fe-auth.o] Error 1
make: *** [libpq/libpq.5.dylib] Error 2
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/RPostgreSQL’
Error: Command failed (1)

      

which is not entirely clear. I google, but I couldn't find any relationship with RPostgreSQL

.

+3


source to share


2 answers


I was able to perform a hack install by removing the 2 -KThread flags from MakeFile.global.darwin. I can't tell you what the -KThread flag is and why it's needed, but it seems to work fine for Mavericks (10.9.5)

PTHREAD_CFLAGS = -Kthread -kthread -pthread -pthreads -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS



changed to

PTHREAD_CFLAGS = -pthread -pthreads -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS

0


source


There's possibly a more convenient approach described in this blog post with additional notes at the bottom of the PecanProject GitHub Replication Issues thread .

You may have to manually reference the file directory pg_config

to fix the problem 'libpq-fe.h' file not found

. In my case, the command was different from the one mentioned in the PecanProject issue thread:

sudo ln -s /usr/local/Cellar/postgresql/9.4.0/bin/pg_config /usr/local/bin/

      

Then I had to



sudo ln -s /usr/local/Cellar/postgresql /usr/local/opt/postgresql

      

to work around the error Library not loaded: /usr/local/opt/postgresql/lib/libpq.5.dylib

.

The last hat for Chris Chou for this last point.

0


source







All Articles