From ripley at stats.ox.ac.uk  Mon Dec 31 20:43:31 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 31 Dec 2012 19:43:31 +0000
Subject: [Rd] Does dlltools in 64-bit rtools for windows support 64-bit
 machine type?
In-Reply-To: <50E1D72E.2010208@gmail.com>
References: <CAEeinJ9f1SwgVmtYNtmJqmtM2ZrVHzO1hM3ectLXpcdVbF5RDQ@mail.gmail.com>
	<50E1D72E.2010208@gmail.com>
Message-ID: <50E1EAE3.6070703@stats.ox.ac.uk>

On 31/12/2012 18:19, Duncan Murdoch wrote:
> On 12-12-30 9:07 AM, Johan Johansson wrote:
>> Hi,
>>
>> I've been trying to get the python bridge (rpy2) to build for 64-bit R
>> and python. The current stumbling block is that mingw can't use the
>> python27.lib file that comes with CPython and so I need to generate
>> libpython27.a.

BTW, 'mingw' is irrelevant as it has not been used by R for a long time. 
  Mingw's dlltool is indeed 32-bit only.

>> When I use dlltool from rtools to do that however, I end up with a
>> 32-bit file:
>>
>>> "G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool" -e libpython27.a
>>> -d python27.def python27.dll
>>> objdump -f libpython27.a
>>
>> libpython27.a:     file format pe-i386
>>
>> More problematically, x86_64 is not listed as supported by objdump:
>>
>> Usage G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool <option(s)>
>> <object-file(s)>
>>     -m --machine <machine>    Create as DLL for <machine>.  [default:
>> i386]
>>          possible <machine>: arm[_interwork], i386,
>> mcore[-elf]{-le|-be}, ppc, thumb
>>
>> Am I doing it wrong?
>
> You aren't using the same flags as R uses in its builds.  For 64 bit
> builds, it uses these flags (from MkRules.rules):
>
> DLLTOOLFLAGS=--as $(BINPREF)as $(DT_ARCH) -k
>
> DT_ARCH = -m i386:x86-64 --as-flags --64

The irrational mess of flags in GNU bintools is not our doing, and 
suggestions upstream to support e.g. -m64 have fallen on deaf ears.  At 
least a useR does not need to divine this from the bintools 
documentation (at least at the time I had to read the sources as it was 
not in the bintools manual).

>
> Duncan Murdoch
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel


-- 
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



[Rd] Does dlltools in 64-bit rtools for windows support 64-bit machine type?
Prof Brian Ripley