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

Duncan Murdoch murdoch.duncan at gmail.com
Tue Sep 8 20:00:50 CEST 2015


On 08/09/2015 12:56 PM, Avraham Adler wrote:
> 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

That's no good.  The makefiles will need to work with both toolchains,
and that doesn't look compatible with the old toolchain.

I'd be happy to put in changes, subject to the following:

 - Existing builds should work with no change.
 - Users of the new toolchain should be able to try it out with a one
line addition to Mkrules.local.
 - It would be nice to allow some flexibility, so if you get it wrong on
the first try, only Mkrules.local needs to be updated, not the R-devel
sources.

Send me a patch that you've tested on both toolchains, and I'll put it
in (after testing on the old toolchain).

Duncan Murdoch

> 
> 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
> 
> _______________________________________________
> R-SIG-windows mailing list
> R-SIG-windows at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-windows
>



More information about the R-SIG-windows mailing list