Skip to content

Trouble building R 1.7.1

4 messages · George W. Gilchrist, Thomas Lumley, Simon Urbanek +1 more

#
I'm trying to build R following Stefano's step by step directions. I am
using gcc 3.3 and g77 3.4. After a few minutes compiling, I get the
following set of messages/errors.

gcc -no-cpp-precomp -I. -I../../src/include -I../../src/include
-I/usr/X11R6/include -I/sw/include -I/usr/local/include -DHAVE_CONFIG_H   -g
-O2 -c devQuartz.c -o devQuartz.o
In file included from
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.fram
ework/Headers/CarbonCore.h:113,
                 from
/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
                 from
/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
                 from devQuartz.c:42:
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.fram
ework/Headers/Debugging.h:285:2: #else without #if
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.fram
ework/Headers/Debugging.h:287:2: #endif without #if
/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.fram
ework/Headers/Debugging.h:301:1: missing binary operator before token "enum"
devQuartz.c:1156:1: unterminated #if
make[3]: *** [devQuartz.o] Error 1
make[2]: *** [R] Error 2
make[1]: *** [R] Error 1
make: *** [R] Error 1

I looked at those lines in Debugging.h and everything looks fine. Any clues?
Thanks to all for your help.

==================================================================
George W. Gilchrist                        Email #1: gwgilc@wm.edu
Department of Biology, Box 8795          Email #2: kitesci@cox.net
College of William & Mary                    Phone: (757) 221-7751
Williamsburg, VA 23187-8795                    Fax: (757) 221-6483
http://gwgilc.people.wm.edu/
#
On Wed, 1 Oct 2003, George W. Gilchrist wrote:

            
Yes, this is a known problem. I forget the solution, but someone will
probably point it out.  More importantly, if you build the r-devel
snapshot (which is now in code freeze and will be 1.8.0 next week) it
doesn't happen.

	-thomas
Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle
#
As Thomas pointed out this was an issue a while ago. This is a part of  
post I sent at that time:
(the proposed solution refers to the relevant #include in devQuartz.c)

--- cut here ---

I was just building R-devel with aqua today. I had some issues  
compiling it, so I'm letting you know ... just in case ... ;)

gcc -no-cpp-precomp -I. -I../../src/include  
-I../../../../R-devel/src/include -I/usr/X11R6/include  
-I/usr/local/include -DHAVE_CONFIG_H   -g -O2 -c  
../../../../R-devel/src/unix/devQuartz.c -o devQuartz.o
In file included from  
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/CarbonCore.h:113,
                  from  
/System/Library/Frameworks/CoreServices.framework/Headers/ 
CoreServices.h:21,
                  from  
/System/Library/Frameworks/Carbon.framework/Headers/Carbon.h:20,
                  from ../../../../R-devel/src/unix/devQuartz.c:35:
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/Debugging.h:285:2: #else without #if
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/Debugging.h:287:2: #endif without #if
/System/Library/Frameworks/CoreServices.framework/Frameworks/ 
CarbonCore.framework/Headers/Debugging.h:301:1: missing binary operator  
before token "enum"
../../../../R-devel/src/unix/devQuartz.c:922:1: unterminated #if
make[3]: *** [devQuartz.o] Error 1

This is mainly due to the fact that R uses DEBUG in some way where  
Carbon expects it to be either undefined or defined as 0/1. Dirty fix  
is to always #undef it before including Carbon.h, but that is just a  
quick hack, not a real solution. A bit more general (but clumsy) is the  
following:

#ifdef DEBUG
#define __R_DEBUG DEBUG
#undef DEBUG
#endif
#include <Carbon/Carbon.h>
#ifdef __R_DEBUG
#define DEBUG __R_DEBUG
#undef __R_DEBUG
#endif

that works for me ... although I'm still not happy about R using DEBUG  
... I fell into that trap with Rserve already.

--- cut here ---

... and as Thomas also pointed out this was fixed in R-devel since.

Cheers,
Simon

---
Simon Urbanek
Department of computer oriented statistics and data analysis
University of Augsburg
Universit?tsstr. 14
86135 Augsburg
Germany

Tel: +49-821-598-2236
Fax: +49-821-598-2200

Simon.Urbanek@Math.Uni-Augsburg.de
http://simon.urbanek.info
#
You should either use -D__DEBUGGING__, use Simon's patch or build the  
latest R-devel sources.

R 1.7.1 builds fine with that instruction using Dec2002 Dev Tools. When  
you update the tools the problems comes out. I should mention it in the  
instructions page.

BTW, R-1.8.0 is going to be released next week, and this version builds  
fine.

stefano


On Mercoled?, ott 1, 2003, at 13:59 Europe/Rome, George W. Gilchrist  
wrote: