[R-SIG-Mac] 64-bit R compiling problem on Leopard

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Dec 13 19:45:19 CET 2007


On Thu, 13 Dec 2007, Simon Urbanek wrote:

>
> On Dec 13, 2007, at 12:18 PM, Prof Brian Ripley wrote:
>
>> On Thu, 13 Dec 2007, Simon Urbanek wrote:
>> 
>>> Hi Herve,
>>> 
>>> On Dec 12, 2007, at 7:06 PM, Herve Pages wrote:
>>> 
>>>> Simon Urbanek wrote:
>>>> [...]
>>>>> 
>>>>> FWIW: dual 32-bit and 64-bit binaries of current R 2.6.1 patched
>>>>> and R-
>>>>> devel for Leopard are available from
>>>>> http://r.research.att.com/
>>>>> They support all four architectures. To start 64-bit Intel R use R --
>>>>> arch=x86_64, for 64-bit ppc it is R --arch=ppc64.
>>>> 
>>>> We are trying to help some Bioconductor users to use these nightly
>>>> builds in 64-bit mode.
>>>> 
>>>> I noticed that when I start them with R --arch=x86_64,
>>>> 'sessionInfo()' and 'version' still report i386 (this is with the
>>>> latest R-2.6-branch r R-devel builds for Leopard available at 
>>>> http://r.research.att.com/)
>>>> .
>>>> 
>>> 
>>> Yes - the platform is always i386 or powerpc since Mac OS X identifies
>>> as such (there is no 64-bit only Mac OS X).
>> 
>> I don't think so.  The R.version setting is coming from what configure 
>> identifies as the value: e.g. the 'arch' value is that of the C macro 
>> R_CPU.  The configure support files in R-devel have been updated, and do 
>> give x86_64 using a 64-bit compiler on iMac/Leopard.
>
> Not for me (tonight's R-devel build):
>
>> R.version
>              _
> platform       i386-apple-darwin9.1.0
> arch           i386
> os             darwin9.1.0
> system         i386, darwin9.1.0
> status         Under development (unstable)
> major          2
> minor          7.0
> year           2007
> month          12
> day            12
> svn rev        43668
> language       R
> version.string R version 2.7.0 Under development (unstable) (2007-12-12 
> r43668)
>
>> .Platform$r_arch
> [1] "x86_64"
>
>> .Machine$sizeof.pointer
> [1] 8
>
>
> AFAICS R_CPU comes from host_cpu which is always i386 or powerpc for Darwin:
> In config.guess for Darwin: UNAME_PROCESSOR=`uname -p` and Mac OS X always 
> reports i386 or powerpc, never anything else. This is different from Linux 
> where the kernel will use x86_64 if in 64-bit mode.

On Linux it reports x86_64 if that is the kernel architecture, whatever 
mode it is in.  So an ix86 build of R on AMD64 reports arch=x86_64 unless 
you fiddle it.

On Solaris I get arch=sparc whatever the kernel is tuned for.

Someone has changed something in the last week (probably on our machine), 
as rebuilding today does give 'i386' as you found, but not on Dec 4.

> As I was saying, we would have to override the platform string (and we can), 
> but the official platform is i386-apple-darwin.

Easily, set --build or --host on configure.  That's one reason why it is 
unreliable.

> A possible work-around would be to modify R_CPU according to the compiler 
> (which is what you were suggesting I presume) after we have run the checks on 
> the compiler, but we don't do that right now (AFAICS).

I was only reporting what I got, and I can't see how it happened so please 
discard the data point.  But if I want to change this I would specify 
--host (and it seems to work, at a quick test)

> Now for something related - right now it is a bit tedious to specify the 
> 64-bit builds, because it means to essentially set all compilers to custom 
> values. A convenient solution would be to invert the above and modify the 
> compilers automatically if host_cpu is set manually to a 64-bit CPU (this is 
> what some projects do e.g. GMP) basically by appending -arch x86_64 or -arch 
> ppc64 to all compilers. I'm not 100% convinced of the usefulness, but it is a 
> solution ...

We could just introduce $(ARCH_FLAG), so e.g. CC is set to
@CC@ $(ARCH_FLAG).  There's a need to something like this elsewhere, e.g. 
-m32/-m64, -march or -mtune values.  Just provided there is a means to 
undo this with mixed compiler families (e.g. GNU/Sun Studio).

-- 
Brian D. Ripley,                  ripley at 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



More information about the R-SIG-Mac mailing list