[R-SIG-Mac] Compiling CC source: cc in R 2.12 vs gcc in R 2.13

Richard R. Liu richard.liu at pueo-owl.ch
Mon Oct 31 13:39:44 CET 2011


Hello,
 
I sent the following email to Duncan Temple Lang, who maintains Rlibstemmer, but
I suspect the problem is a general one.  Perhaps somebody here can tell me what
options have to be set for gcc -- or whether and how I can still use cc with R
2.13 -- in order to get a 32-bit version.  Thanks.
 
---------- Original email follows ----------
Hello Duncan,

Some time ago I had a problem with RStem which was solved in Rlibstemmer.  Since
then I have been using the latter, specifically Rlibstemmer_0.1-0.tar.gz.  Up
until R 2.12 the following recipe has worked for building a 32-/64-bit binary
for OS X:

----------
Download Rlibstemmer_0.1-0.tar.gz from http://www.omegahat.org/Rlibstemmer.
 Unpack it by double-clicking on it.  This will produce a folder Rlibstemmer.
 Navigate to Rlibstemmer/inst/libstemmer_c.  Modify Makefile as follows:  (1)
delete the line specifying the CFLAGS and (2) add examples/*.o to the files to
be cleaned.  Save the Makefile.

Now start Terminal and cd to the directory that contains the folder Rlibstemmer.
 Issue the command tar -czf Rlibstemmer.tar.gz Rlibstemmer/* to create a new
source package.  After that, create and install the 64-bit version of
Rlibstemmer as follows:

export CFLAGS="-arch x86_64 -m64 -Iinclude -fPIC"
export CCFLAGS="-arch x86_64 -m64"
R --arch=x86_64 CMD INSTALL Rlibstemmer.tar.gz

Then create and install the 32-bit version:

export CFLAGS="-arch i386 -m32 -Iinclude -fPIC"
export CCFLAGS="-arch i386 -m32"
R --arch=i386 CMD INSTALL --libs-only Rlibstemmer.tar.gz
----------

However, compiling for R 2.13, 32-bit version, no longer works.  Here is a log
of the run:

----------
rrl-macbookpro:Downloads sim$ export CFLAGS="-arch i386 -m32 -Iinclude -fPIC"
rrl-macbookpro:Downloads sim$ export CCFLAGS="-arch i386 -m32"
rrl-macbookpro:Downloads sim$ R --arch=i386 CMD INSTALL --libs-only
Rlibstemmer.tar.gz
* installing to library ‘/Users/sim/Library/R/2.13/library’
* installing *source* package ‘Rlibstemmer’ ...
make: Nothing to be done for `all'.
** libs
*** arch - i386
gcc-4.2 -arch i386 -std=gnu99
-I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/i386
-I../inst/libstemmer_c/include -I/usr/local/include -fPIC  -g -O2 -c
._listAlgorithms.c -o ._listAlgorithms.o
._listAlgorithms.c:1:1: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\5’ in program
._listAlgorithms.c:1: error: stray ‘\26’ in program
._listAlgorithms.c:1: error: stray ‘\7’ in program
._listAlgorithms.c:1:5: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\2’ in program
._listAlgorithms.c:1:7: warning: null character(s) ignored
._listAlgorithms.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘OS’
._listAlgorithms.c:1:17: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\2’ in program
._listAlgorithms.c:1:27: warning: null character(s) ignored
._listAlgorithms.c:1:35: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\263’ in program
._listAlgorithms.c:1:39: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\2’ in program
._listAlgorithms.c:1:43: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\345’ in program
._listAlgorithms.c:1:47: warning: null character(s) ignored
._listAlgorithms.c:1:89: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\210’ in program
._listAlgorithms.c:1: error: stray ‘\241’ in program
._listAlgorithms.c:1:92: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\345’ in program
._listAlgorithms.c:1:97: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\230’ in program
._listAlgorithms.c:1:101: warning: null character(s) ignored
._listAlgorithms.c:1:105: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\1’ in program
._listAlgorithms.c:1:121: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\230’ in program
._listAlgorithms.c:1:125: warning: null character(s) ignored
._listAlgorithms.c:1:129: warning: null character(s) ignored
._listAlgorithms.c:1: error: stray ‘\25’ in program
._listAlgorithms.c:1:152: warning: null character(s) ignored
._listAlgorithms.c:1:160: error: invalid suffix "c618132" on integer constant
._listAlgorithms.c:1: error: expected identifier or ‘(’ before numeric constant
._listAlgorithms.c:1: warning: data definition has no type or storage class
._listAlgorithms.c:1: warning: type defaults to ‘int’ in declaration of ‘Safari’
._listAlgorithms.c:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘-’ token
._listAlgorithms.c:1:190: error: invalid suffix "A61" on integer constant
._listAlgorithms.c:1:200: error: invalid suffix "C52479DCA9" on integer constant
._listAlgorithms.c:1:229: warning: null character(s) ignored
make: *** [._listAlgorithms.o] Error 1
ERROR: compilation failed for package ‘Rlibstemmer’
* removing ‘/Users/sim/Library/R/2.13/library/Rlibstemmer’
* restoring previous ‘/Users/sim/Library/R/2.13/library/Rlibstemmer’
----------

I notice that compiling for 2.12 invokes cc, whereas for 2.13 it is gcc-4.2.
 Can you suggest a fix for this problem?
---------- End of original email ----------


Richard R. Liu
richard.liu at pueo-owl.ch



More information about the R-SIG-Mac mailing list