From hin-tak.leung at cimr.cam.ac.uk  Thu Jan 18 18:43:34 2007
From: hin-tak.leung at cimr.cam.ac.uk (Hin-Tak Leung)
Date: Thu, 18 Jan 2007 17:43:34 +0000
Subject: [Rd] Building R 2.4.1 on IRIX
In-Reply-To: <45AFA3E8.6000602@biostat.ku.dk>
References: <200701180948.l0I9mgdL009486@kruuna.helsinki.fi>
	<45AFA3E8.6000602@biostat.ku.dk>
Message-ID: <45AFB1C6.4000907@cimr.cam.ac.uk>

Peter Dalgaard wrote:
> Atro Tossavainen wrote:
>> Hi,
>>
>> I've got the latest MIPS compilers that are C99 aware (7.4.4).
>>
>> "configure" finishes with:
>>
>> R is now configured for mips-sgi-irix6.5
>>
>>   Source directory:          .
>>   Installation directory:    /afs/bi/v/@sys/apps/stats/R/2.4.1
>>
>>   C compiler:                cc -c99 -OPT:IEEE_NaN_inf=ON -g
>>   Fortran 77 compiler:       f77 -OPT:IEEE_NaN_inf=ON -g
>>
>>   C++ compiler:              CC -OPT:IEEE_NaN_inf=ON -g
>>   Fortran 90/95 compiler:    f90 -g
>>
>>   Interfaces supported:      X11
>>   External libraries:        readline 
>>   Additional capabilities:   PNG, JPEG, NLS
>>   Options enabled:           shared BLAS, R profiling
>>
>>   Recommended packages:      yes
>>
>> Building R 2.4.1, I stumble across the following error in
>> src/main/complex.c:
>>
>> cc -c99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre  -I. -I../../src/include -I../../src/include -I/afs/bi/p/include -DHAVE_CONFIG_H  -OPT:IEEE_NaN_inf=ON  -g -c complex.c -o complex.o
>>
>> cc-1143 cc: ERROR File = /usr/include/complex.h, Line = 176
>>   Declaration is incompatible with "double cabs(struct __cabs_s)" (declared at
>>           line 667 of "/usr/include/math.h").
>>
>>   static inline double cabs       (double complex z)      {return __c99_cabs(z); }
>>                        ^
>>
>> cc-1143 cc: ERROR File = /usr/include/complex.h, Line = 178
>>   Declaration is incompatible with "long double cabsl(struct __cabsl_s)"
>>           (declared at line 528 of "/usr/include/math.h").
>>
>>   static inline long double cabsl (long double complex z) {return __c99_cabsl(z);}
>>                             ^
>>
>> 2 errors detected in the compilation of "complex.c".
>> gmake[3]: *** [complex.o] Error 2
>>
>>
>> All ideas for fixing this would be welcome.  I'm not subscribed to the
>> mailing list, so personal copies would be appreciated, but I will be
>> monitoring the web archives of the list to catch responses posted to
>> the list only.
>>   
> It looks like two system include files are getting into a dogfight. You
> might want to investigate whether you can reproduce the issue with a
> smaller source file, possibly dropping some of the -I directories in
> that cc command line, and submit the issue to the vendor if you get
> convinced that the issue is not actually an R one.
> 
> If this is the case, your best hope is if you can make cc less picky
> about such redefinitions.
> 

Certainly it looks the case. It might also be worth actually looking at
the two flighting system header files - occasionally sections are
controlled by macros like this:

ifdef _XOPEN_SOURCE
extern void foo(int bar)
#else
static void foo(char bar)
#end

where alternative function prototype definitions are chosen based
on macros. It might be possible to resolve the conflict by defining
a suitable macro during ./confgure. with something like this:
    CFLAGS="-D_XOPEN_SOURCE" ./configure

(in fact posting the two files somewhere or even e-mailing in
might be a good idea - I am not promising I'll look at them
in time though, but somebody else might have the time to do
it, so it might be a good idea to put it up on a URL and wait...).

HTL



[Rd] Building R 2.4.1 on IRIX
Hin-Tak Leung