rcconsult / rpostgresql

Automatically exported from code.google.com/p/rpostgresql
0 stars 0 forks source link

RPostgreSQL doesn't compile on Mac OS X with PostgreSQL 9.0 #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
See 
http://www.r-project.org/nosvn/R.check/r-release-macosx-ix86/RPostgreSQL-00insta
ll.html

But is seems easy enough to fix. See:
http://iangow.wordpress.com/2011/04/23/installing-rpostgresql-with-r-2-13-on-a-m
ac/

Regards,

-Ian

Original issue reported on code.google.com by iand...@gmail.com on 24 Apr 2011 at 4:16

GoogleCodeExporter commented 9 years ago
The preferred way to find the libraries and headers is using "pg_config".  If 
this command is found in your path then it should just work.  At the command 
line type, "pg_config".  You should see a lot of text like:

BINDIR = /Library/PostgreSQL/versions/9.0.1/bin
DOCDIR = /Library/PostgreSQL/versions/9.0.1/share/doc/postgresql
HTMLDIR = /Library/PostgreSQL/versions/9.0.1/share/doc/postgresql
INCLUDEDIR = /Library/PostgreSQL/versions/9.0.1/include
PKGINCLUDEDIR = /Library/PostgreSQL/versions/9.0.1/include/postgresql
INCLUDEDIR-SERVER = /Library/PostgreSQL/versions/9.0.1/include/postgresql/server
LIBDIR = /Library/PostgreSQL/versions/9.0.1/lib
PKGLIBDIR = /Library/PostgreSQL/versions/9.0.1/lib/postgresql
. . . . . 

etc. 

If "pg_config" is not found, then edit your path to include it, wherever 
pg_config is installed.  You should be able to find the file by typing "sudo 
find / -name pg_config -print" at the command line.  For example on my system 
it returns:

/Library/PostgresPlus/8.4SS/bin/pg_config
/Library/PostgreSQL/versions/9.0.1/bin/pg_config

Note that I have a link to the versioned bin directory at 
/Library/PostgreSQL/bin

To check your path type "env $PATH".

My system has the following:

env: 
/opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/u
sr/local/bin:/usr/X11/bin:/usr/X11R6/bin:/Library/PostgreSQL/bin: No such file 
or directory

If your path is missing, try editing ".profile" in your home directory.  Mine 
has the line:

"export PATH=$PATH:/Library/PostgreSQL/bin"

Where you patched the configure file is an old method to locate the files and 
is impossible to keep up to date with all the variations of install locations. 
In the long run, its really easier to get the path to "pg_config" correct.

Of course, these are just examples and may need to be adjusted to work on your 
system.

Original comment by ne...@neiltiffin.com on 24 Apr 2011 at 1:58

GoogleCodeExporter commented 9 years ago
Thanks. That's very helpful, even though I already have RPostgreSQL working on 
my computer based on my configure-file-edit kluge.

But I notice that the CRAN binary for Mac OS X is missing (it was there for R 
2.12, I think) because I guess (based on what you tell me ... I'm no expert) 
the path on the system on which it is compiled doesn't include pg_config. I 
suspect it's a real pain to keep up with all the moving parts on those systems.

Original comment by iand...@gmail.com on 24 Apr 2011 at 3:59

GoogleCodeExporter commented 9 years ago
CRAN is a different issue.  Marking this issue closed based on the work-around 
posted.

Original comment by ne...@neiltiffin.com on 24 Apr 2011 at 6:56

GoogleCodeExporter commented 9 years ago
For completeness, I believe one can also define the full path for pg_config in 
the environment variable $PG_CONFIG and it will also work.

Original comment by ne...@neiltiffin.com on 24 Apr 2011 at 7:30

GoogleCodeExporter commented 9 years ago
For the benefit of any future Mac users that stumble upon this, the solution 
proposed by Neil in Comment 4 above was easiest. I just added (check your path 
and adjust!):

export PATH=/Library/PostgreSQL/9.0/bin:$PATH

to ~/.profile (called "source ~/.profile") and then compiled from within R using

install.packages("~/Downloads/RPostgreSQL/", repos=NULL, type="source")

Original comment by iand...@gmail.com on 27 Apr 2011 at 3:55