[Rd] mingw-cross with R 2.4.x Re: wine and build difference between R.2.4.0 and R 2.4.1 windows binaries?

Hin-Tak Leung hin-tak.leung at cimr.cam.ac.uk
Mon Jan 15 19:49:35 CET 2007

Hin-Tak Leung wrote:
> 2.4.0 works and 2.4.1/2.5dev crashes, all on the same machine with
> the same version of wine in en_GB.UTF-8 locale.
> export |grep 'LANG'
> declare -x LANG="en_GB.UTF-8"
> I found all 3 versions of Rgui.exe hangs (and not crashes) if I run
> wine under LANG=C .
> I think it would be most interesting to try building the older 2.4.0
> with newer mingw - that would distinguish whether it is code change
> in R or change in mingw. (I'll give this a try in the next few days).

I have managed to build both R 2.4.0 and 2.4.1 with the newer
mingw 3.11+ (both crashes under wine and works okay under XP)
and can now confirm that the wine crash seems to be due to mingw change.

Some comments, notes below, in case it may be useful to others (and
also a good reminder for myself as well):

- building the cross-compiler itself was relatively easy with the
   latest cross-build script from mingw, except by default it doesn't do
   the bleeding-edge component versions.

My /usr/bin/R is 32-bit 2.4.1 and my /usr/bin/R64 is 64-bit 2.4.0 -
so I can cross-build two different versions of R. (cross-build R 
requires the *exact same* version of native R).


- Although http://www.murdoch-sutherland.com/Rtools/ states
that mingw-runtime-3.11 is required, there was a bug with
mingw-runtime-3.11-src.tar.gz for cross-build. (20061202 is
a post-release fix which wasn't much advertised as such). The nature
of the problem about GCC_NO_EXECUTABLES was discussed in this thread:

- I needed to copy R/src/intl and R/src/extra/pcre from 2.4.1 to 2.4.0
to get the older R 2.4.0 to build against newer mingw.

- for both versions, symbol export doesn't work and a big chunk
   of R won't link; my initial work around was to stick
    "-Wl,--export-all-symbols" (...barbaric...) to get some executable
    to link.
   later I worked out the proper way is to do
     export NM=/path-to/bin/i386-mingw32-nm
   and also edit the R/src/gnuwin32/Makefile and replaces the two lines
   of this portion of sed code (8 dots):
      $(SED) -n 's/^........ [BCDRT] _/ /p'
   with this (16 dots):
       $(SED) -n 's/^................ [BCDRT] _/ /p'

It seems that the SED change is in R trunk (with "s/^.* ...").
and the NM export is probably not necessary and due to
my mistake somewhere on dependency generation, as Mkrules does
make NM=$(BINPREF)nm .

More information about the R-devel mailing list