質問

I'm trying to install PL/R on Mountain Lion 10.8.2, I've installed R 2.15.3 from r-project and PostgreSQL 9.1 from KyngChaos. I've got PL/R 8.3.0.14 from http://www.joeconway.com/plr/. I've put the expanded folder in /usr/local/pgsql/share/contrib and cd'd into that folder.

The environment variables $R_HOME and $CUSTOM_COPT are set as instructed at http://www.joeconway.com/web/guest/pl/r/-/wiki/Main/Installation_Mac by writing them into .bash_profile, and also added /library/frameworks/r.framework/resources/bin to my path by writing to the same file.

XCode 4.6 and the Command Line Tools are installed. There are multiple copies of standard C header files, including stdio.h, for example there is /usr/include/stdio.h.

Next step seems to be:

DiMac:plr duncan$ make    
Makefile:40: ../../src/Makefile.global: No such file or directory
Makefile:41: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'.  Stop.

That didn't work, and then I try:

DiMac:plr duncan$ make USE_PGXS=1
gcc -Os -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -D_FILE_OFFSET_BITS=64 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -arch x86_64  -I"." -I"-I/library/frameworks/r.framework/resources/include" -I/library/frameworks/r.framework/resources/include -I. -I. -I/usr/local/pgsql-9.1/include/server -I/usr/local/pgsql-9.1/include/internal -I/usr/include/libxml2 -DPKGLIBDIR=\"/usr/local/pgsql-9.1/lib\" -DDLSUFFIX=\".so\" -DR_HOME_DEFAULT=\"/library/frameworks/r.framework/resources\"  -c -o plr.o plr.c
In file included from /usr/local/pgsql-9.1/include/server/postgres.h:47,
                 from plr.h:38,
                 from plr.c:33:
/usr/local/pgsql-9.1/include/server/c.h:67:19: error: stdio.h: No such file or directory
/usr/local/pgsql-9.1/include/server/c.h:68:20: error: stdlib.h: No such file or directory
...

and then pages more of errors.

It seems to me that make is looking in the wrong place for the standard header files and can't find them.From my reading around it seems that the flag -isysroot is telling gcc to look for header files by prepending the normal search path(s) with the /developer.../macosx10.6.sdk path and this path does not exist on my machine, which I believe is standard with the current version of Xcode.

So, the question:

Is this flag set somehow by the Makefile within /plr, or is it set somewhere else? Either way, how do I change it to get make to find the header files that it needs? If changing it is, indeed, the correct thing to do?

役に立ちましたか?

解決

I've managed to bodge a solution to my own question. Maybe someone can help with tidying it up?

make USE_PGXS=1 formats a series of flags and then calls gcc with the flags it's calculated. So, I copied and pasted the line gcc... above and then changed the path after -isysroot to be one where the standard header files are found. Then the command runs properly, and compiles the file it's been told to.

I had to do this several times, once for each file to be compiled, until a full set exists, and then repeat the exercise using make install instead.

After many runs at this, I ended up with the shared object I needed in the right location, and then resumed following the instructions from Joe Conway's wiki.

It works great now. It would be great to know how to stop/change the -isysroot setting permanently.

他のヒント

I use MacPorts's postgresql92 +python +perl variant (after earlier compiling PostgreSQL myself) and it has worked flawlessly in each of the recent builds I've done on three computers: http://iangow.wordpress.com/2013/06/26/install-plr-on-os-x-10-8-4-using-macports/ (description of earlier process here: http://iangow.wordpress.com/2012/05/21/plr-on-os-x/).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top