[R] problems with R COMPILE in make

Duncan Temple Lang duncan at research.bell-labs.com
Mon Sep 4 17:39:26 CEST 2000

Hi Peter.

 I took a quick look at the R COMPILE problem and it seems that there
are in fact two problems.  One is the problem with the attempt to
build a target `w'. And the other is that if that error didn't arise,
you would have an infinite loop.

Here is quick fix to your problem. Add the line

  include $(R_HOME)/etc/Makeconf

to your Makefile. Then, make will compile imageio.o with the correct flags.

gcc -I/home2/FlowData/AltProjects/R-shared//include  -I/usr/local/include -mieee-fp -D__NO_MATH_INLINES  -fPIC  -g -O2 -c imageio.c -o imageio.o 

That should be enough to get things working.  The more detailed
explanation is as follows.

a) The rule
imageio.o: imageio.c
 	R COMPILE imageio.c

is executed by the first call to make.
The COMPILE script expands this to call

     make -f $R_HOME/etc/Makeconf -f Makefile imageio.o

At this point, this second make process sees the same rule, and does
the same thing. Hence, you have infinite recursion.

b) The problem about the target `w' is a problem resulting from the R
COMPILE script being called recursively from a make process.  The
second make process getting called via the COMPILE script is getting
the value of the make variable MAKEFLAG from the top-level make you
executed manually.  This is implicitly set to w (meaning to print
directory information before and after the makefile is "executed")
and not -w. At this point, I am not certain whether this is an
R oversight or a GNU make bug.

 Hope this helps.


> From: Peter Holzer <holzer at stat.math.ethz.ch>
> Date: Mon, 4 Sep 2000 11:23:54 +0200 (CEST)
> Sender: owner-r-help at stat.math.ethz.ch
> Precedence: bulk
> Dear R helpers
> I have a problem with R COMPILE. While the Makefile consisting of the lines
> SOURCES = imageio.c procbase.c readargs.c regSegs.c goodiesPH.c \
> 	  generalAnalysis.c edgeAggregation.c utilities.alga.c \
> 	  cs.parametrizing.c
> tst.so: $(SOURCES)
> 	R SHLIB -o $@ $(SOURCES)
> works fine, the Makefile with the target replaced by
> imageio.o: imageio.c
> 	R COMPILE imageio.c
> results in
> cd /u/holzer/CurrentWork/algen/C/
> make
> R COMPILE imageio.c
> make[1]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C'
> R COMPILE imageio.c
> make[2]: Entering directory `/users/u1/staff/holzer/CurrentWork/algen/C'
> make[2]: *** No rule to make target `w'.  Stop.
> make[2]: Leaving directory `/users/u1/staff/holzer/CurrentWork/algen/C'
> make[1]: *** [imageio.o] Error 2
> make[1]: Leaving directory `/users/u1/staff/holzer/CurrentWork/algen/C'
> make: *** [imageio.o] Error 2
> Compilation exited abnormally with code 2 at Mon Sep  4 10:41:57
> However, if I add $ as a typo (or at least, when I did it, it was just a typo)
> $imageio.o: imageio.c
> 	R COMPILE imageio.c
> everything works fine again. Do I miss something there?
> I have one more question concerning compilation. I don't like the option
> -Wcomment, so when I use -Wall for myself I add -Wno-comment. However, when
> setting PKG_CFLAGS = -Wno-comment in file `Makevars' this doesn't help. I
> suppose the reason is that the -Wall option comes then _after_ the
> -Wno-comment option. Is there a way around that?
> Thanks for any help
> Peter
> > version
>          _                
> platform i686-pc-linux-gnu
> arch     i686             
> os       linux-gnu        
> system   i686, linux-gnu  
> status                    
> major    1                
> minor    1.1              
> year     2000             
> month    August           
> day      15               
> language R        
> ____________________________________________________________
> Peter Holzer                      phone: + 41 1 632 46 34
> Seminar fuer Statistik, LEO C14   fax:   + 41 1 632 12 28
> (Leonhardstr. 27)                  <holzer at stat.math.ethz.ch>
> ETH (Federal Inst. Technology)
> 8092 Zurich                       http://www.stat.math.ethz.ch/~holzer/
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Duncan Temple Lang                duncan at research.bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
Murray Hill, NJ  07974-2070       

      "Languages shape the way we think, and determine what 
       we can think about."        
                                      Benjamin Whorf
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list