[R-pkg-devel] How to R CMD build / check using LTO

Paul Schmidt-Walter p@u|@@chm|dt-w@|ter @end|ng |rom po@teo@de
Wed Feb 17 20:04:34 CET 2021


Dear Team,

My package 'LWFBrook90R' (https://github.com/pschmidtwalter/LWFBrook90R) 
was recently released on CRAN, but there are additional LTO Issues 
(https://www.stats.ox.ac.uk/pub/bdr/LTO/LWFBrook90R.out) with the 
compiled code, that need to be fixed soon.

I would like to reproduce the LTO warnings locally to see if possible 
solutions fix them, but dont know how to build and check with LTO. I am 
a newbie on Ubuntu 18.04 and hope to get help in this case.

There is information provided on how to configure R to reproduce the 
test (https://www.stats.ox.ac.uk/pub/bdr/LTO/README.txt), but I simply 
don't know how to "build with configure --enable-lto" and I also can't 
find the "config.site" file on my system to enable the respective 
compiler flags (see below).

Any help is appreciated!

Paul

---

LTO-Readme.txt:

Compilation logs for CRAN packages using x86_64 Fedora 32 Linux
(currently using GCC 10.1)built with configure --enable-lto and 
config.site:

CFLAGS="-g -O2 -Wall -pedantic -mtune=native"
FFLAGS="-g -O2 -mtune=native -Wall -pedantic"
CXXFLAGS="-g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes 
-Wno-deprecated-declarations -Wno-parentheses"
AR=gcc-ar
RANLIB=gcc-ranlib

Look for [-Wlto-type-mismatch] warnings.  In some cases these involve
Fortran CHARACTER arguments where the length is passed as a 'hidden'
argument at the end, giving mismatches such as

sblas.f:3951:14: note: type ‘long int’ should match type ‘void’

To work around these, define USE_FC_LEN_T and include Rconfig.h
(perhaps via R.h) before including BLAS.h or Lapack.h or your own
C proptypes for Fortran functions.  Then amend the actual calls to include
character length arguments: see the example of 
src/library/stats/src/rWishart.c

in the R sources.

---



More information about the R-package-devel mailing list