From simon.urbanek at math.uni-augsburg.de  Sun Jul 11 19:13:27 2004
From: simon.urbanek at math.uni-augsburg.de (Simon Urbanek)
Date: Sun Jul 11 19:14:09 2004
Subject: [Rd] R + OS X + gcc 3.5 = not quite there ..
Message-ID: <9FB0B53C-D35D-11D8-BE4D-000A959F327E@math.uni-augsburg.de>

I tried to compile R (current R-patched to be more precise) with gcc 
3.5 by Apple (which will be probably shipped with Tiger) and here's how 
far I got:

1) compilation itself was fine except for one exception:
../../../../../../R-patched/src/library/stats/src/starma.c: In function 
`forkal':
../../../../../../R-patched/src/library/stats/src/starma.c:384: error: 
invalid lvalue in assignment

relevant code:

for (j = 0; j < nt; j++)
if(!ISNAN(tmp = G->resid[j])) { nu++; sigma2 += tmp * tmp; }

problem: ISNAN changed obviously as the pre-processing result shows:

  if(!(( ( sizeof ( tmp = G->resid[j] ) == sizeof(double) ) ? __isnand ( 
(double)tmp = G->resid[j] ) : ( sizeof ( tmp = G->resid[j] ) == sizeof( 
float) ) ? __isnanf ( (float)tmp = G->resid[j] ) : __isnan ( ( long 
double )tmp = G->resid[j] ) )!=0)) { nu++; sigma2 += tmp * tmp; }

fix: get the assignment out of ISNAN:
for (j = 0; j < nt; j++) {
     tmp = G->resid[j];
     if(!ISNAN(tmp)) { nu++; sigma2 += tmp * tmp; }
}

2) DYLD_LIBRARY_PATH shouldn't be too eagerly changed - R segfaulted 
with the default setting. Unfortunately it segfaulted in a weird place 
(in code responsible for loading a shared library somewhere in non-R 
code). Removing all unnecessary stuff (such as /usr/local) from the 
path helped (i.e. the path is now just ${R_HOME}/bin).

3) problem with saved images. I can't quite figure out this one:
basically R isn't able to load images stored during the package 
installation phase. I get this error:
Error: bad restore file magic number (file may be corrupted)-- no data 
loaded

for example with stats:
 > library(stats)
Error: bad restore file magic number (file may be corrupted)-- no data 
loaded
Error in library(stats) : package/namespace load failed

same if you try to load .../stats/R/all.rda manually.
I put the rda file in http://www.rosuda.org/misc/all.rda (it comes from 
the stats package) for anyone who can have a look at it...

using save/load manually on arbitrary objects worked for me, however I 
don't know how to re-create the all.rda manually, so I'm stuck here. 
Any ideas?

Cheers,
Simon


[Rd] R + OS X + gcc 3.5 = not quite there ..
Simon Urbanek