From ripley at stats.ox.ac.uk  Wed Apr 26 02:07:49 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 26 Apr 2006 01:07:49 +0100 (BST)
Subject: [Rd] Windows MinGW compiler clarification, consequences
In-Reply-To: <6phzmi9kyh9.fsf@gopher3.fhcrc.org>
References: <6phzmi9kyh9.fsf@gopher3.fhcrc.org>
Message-ID: <Pine.LNX.4.64.0604260055270.18367@gannet.stats.ox.ac.uk>

On Tue, 25 Apr 2006, Martin Morgan wrote:

> The information at
>
> http://cran.r-project.org/doc/manuals/R-admin.html#The-MinGW-compilers

The R 2.3.0 manual is current.

> and
>
> http://www.murdoch-sutherland.com/Rtools/
>
> is slightly inconsistent about the compiler used to build Windows
> binary packages available through cran.
>
> The 'candidate' package of the recommended MinGW-5.0.0.exe installs
> g++/g77 3.4.4 (as does the updated installer MinGW-5.0.2.exe). "An
> alternative..." described on the cran page lists g++/g77 3.4.5.

Please just use 3.4.5: MinGW keep on making errors in their beta 
installers ... so it is hard to keep up (I believe 5.0.1 installed 3.4.5).
3.4.4 does not even appear on the download lists.

> The murdoch-sutherland site says "The release version of gcc-3.4.2 
> included in MinGW-3.2.0-rc-3 is used by the core developers" and 
> mentions that patches to g77 and to ld are used.

There is a change entry above that that says 3.4.4 was used for 2.2.1.

> My questions are:
>
> 1) which compiler is actually used for creating windows binary
>   packages available on cran?

3.4.5, I believe, and that's what I use.

> 2) Are the patches to g77 and ld still relevant?

To g77 only for 3.4.2, to ld yes.

> 3) what issues are we likely to encounter -- code incompatibility, ???
>   -- changing from 3.4.2 to the current compiler tools?

You should not use unpatched 3.4.2 for Fortran.  And without the ld patch, 
the internal DLL name is likely to lose its extension and so not work when 
linked to on some versions of Windows.

> As a more specific example, a particular Bioconductor package depends
> on the cran package odesolve; odesolve has Fortan source
> files. Example R code in the Bioconductor package evaluates without
> issues when the .zip file from cran is used, but generates warnings
> (originating from the Fortran code of odesolve) when compiled locally:
>
> Warning: intdy--  t (=r1) illegal
> Warning: t not in interval tcur - hu (= r1) to tcur (=r2)
> Warning: intdy--  t (=r1) illegal
> Warning: t not in interval tcur - hu (= r1) to tcur (=r2)
> Warning: lsoda--  trouble from intdy. itask = i1, tout = r1
> Error in lsoda(y = y0, times = times, fderiv, parms = c(mod = mod), rtol = 1e-04,  :
> 	Illegal input to lsoda

This looks like the 3.4.2 Fortran bug.

> R version: 2.3.0 (2006-04-24)
>
>> gcc --version
> gcc (GCC) 3.4.2 (mingw-special)
> Copyright (C) 2004 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
> Thanks for any guidance,

I generally find that using the latest MinGW candidates is the best 
policy, but it is frustrating that they never seem to release anything 
these days.

-- 
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] Windows MinGW compiler clarification, consequences
Prof Brian Ripley