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

Simon Urbanek simon.urbanek at r-project.org
Mon Nov 14 16:07:58 CET 2011


Richard,

On Oct 31, 2011, at 8:39 AM, Richard R. Liu wrote:

> Hello,
>  
> I sent the following email to Duncan Temple Lang, who maintains Rlibstemmer, but
> I suspect the problem is a general one.

Not really, it is a fundamental problem with Rlibstemmer.


>  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.
>  

First, cc and gcc are the same thing in Xcode so that's a red herring. Second, setting CFLAGS/CCFLAGS has no effect on the package itself, those are ignored and it uses R's settings. [Note that the flags you specified are nowhere seen in the listing you sent]. Third, the way Rlibstemmer is build is fundamentally broken, since sources are actually outside of the src tree so they will be wrong - and you can see that from the output "make: Nothing to be done for `all'." indicates that nothing is actually built for the architecture since R has no way of knowing about them.

[... I was trying to fix the sources to demonstrate wheat needs to be changed, but it was more than I hoped, so I gave up and never sent this ...]

I may try to give 0.1-0 a shot, maybe it's easier to fix than 0.1-1 ... 

Cheers,
Simon





> ---------- 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
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list