[R-SIG-Win] Some suggested changes to Windows makefiles with respect to experimental toolchain

Avraham Adler avraham.adler at gmail.com
Tue Sep 8 18:56:14 CEST 2015


Hello.

As the new toolchain is going to require some changes to some of the
makefiles for Windows (such as the NM_FILTER already in place, I would
like to make some suggestions for review.

A: Link-time Optimization
I have successfully compiled R (Windows7 64bit) using link-time
optimization, but it required some monkeying around with various
files. Specifically:

1) src/gnuwin32/Mkrules.local: (no change needed)
    needs '-flto -ffat-lto-objects' passed in EOPTS

2) src/gnuwin32/Mkrules: (changes needed to lines 243, 262, and 263)
    AR, NM, and RANLIB all need to add 'gcc-' as a prefix to the
actual calls. For example: AR=$(BINPREF)gcc-ar

3) src/gnuwin32/Makefile: (changes needed to line 65)
    DLLFLAGS needs to allow multiple definitions (for the tools
package) so the else branch needs to be changed to 'DLLFLAGS =
-Wl,--allow-multiple-definition -s'

4) src/gnuwin32/fixed/etc/Makeconf (changes needed to lines 14, 15,
40, 64, and 132)
    DLLFLAGS and LINKFLAGS need '-Wl,--allow-multiple-definition'
added (lines 14 & 15)
    AR, NM, and RANLIB need the 'gcc-' prefix (lines 40, 64, and 132)

Would it be possible and make sense to expose the variables AR, NM,
RANLIB, DLLFLAGS, and LINKFLAGS in Mkrules.local to allow for LTO?

B: External BLAS
I have been compiling R (Windows7 64bit) linking to an external
OpenBLAS for years now. The method requires changing
src/gnuwin32/Mkrules.local to 'USE_ATLAS = YES' and setting the proper
ATLAS_PATH (lines 30 & 31). Then changing src/extra/blas/Makefile.win
line 15 to point to the proper file. Specifically, from
'-L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" -lf77blas -latlas' to '
-L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" -lopenblas' or the
equivalent. Could the name of the BLAS library itself be made a
variable for Mkrules.local? Perhaps something like 'USE_EXTBLAS',
'EXTBLAS_PATH', and 'EXTBLASLIBS' could be used in Mkrules.local, with
EXTBLASLIBS even defaulting to '-lf77blas -latlas'. Then
src/extra/blas/Makefile.win line 15 could look something like
'-L../../../$(IMPDIR) -lR  -L"$(ATLAS_PATH)" $(EXTBLASLIBS)'? I admit
I have not tested this configuration yet, though.

C: Toolchain definitions
If the toolchain developed by Jeroen will be be the eventual Rtools,
as it is a multilib, src/gnuwin32/Mkrules.local lines 52–59 will
probably require a rewrite, if they are necessary at all.

Thank you,

Avi



More information about the R-SIG-windows mailing list