From ripley at stats.ox.ac.uk  Sun Jun 27 22:21:22 2004
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun Jun 27 22:26:42 2004
Subject: [Rd] cross-compiling + expm1
In-Reply-To: <42EB7F10-C874-11D8-9ED5-000A95DA50E2@stanford.edu>
Message-ID: <Pine.LNX.4.44.0406272106460.29419-100000@gannet.stats>

If set up correctly, this _does_ work.  There is no known bug in the R
files for cross-compiling, and it _has_ been tested.

Something is seriously wrong with your cross-compiling setup, which since
you do not credit I presume you made yourself.  See below for some
guesses as to what might be wrong.

On Sun, 27 Jun 2004, Jonathan Taylor wrote:

> Hello all,
> 	Just joined this mailing list -- not sure if this is the right list to 
> send this question, but I have a question about cross-compiling R. I am 
> working with R-1.9.1.tgz.
> 	It may just be with my version of mingw32, but it seems that expm1 is 
> not defined, so I tried to ensure that HAVE_EXPM1 was #undef'ed before 
> cross-compiling. The problem is that, in <include/Rmath.h> if it is 
> #undef'ed it is then #define'd as 1, meaning that the line where expm1 
> is declared automatically not included. 

That's not right.  First, the file is called Rmath.h but it is in
src/include not include.  Second, the Windows Rmath.h has

#ifndef HAVE_EXPM1
#endif

so I guess your cross-compiling is set up to use the Rmath.h from the host
and not the target.  Incorrectly built cross-compilers do get the include
paths wrong, and I have seen several such.  I suggest you use gcc -v and 
check your include paths.

> I had similar problems with 
> logpq, but after changing Rmath.h cross-compiling was straightforward. 
> My question is: is this a "bug" in Rmath.h with respect to expm1 and 
> logp1? If so, how would you cross-compile, or even compile, if you 
> don't have expm1 or logp1?

Not relevant, as the correct Rmath.h will define expm1/log1p (sic, not 
logpq or logp1) iff it is not present in the system's runtime files.

You should have log1p in your mingw32 files, and if you do not your
system is too old (and the file src/gnuwin32/INSTALL does have warnings 
about this).

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] cross-compiling + expm1
Prof Brian Ripley