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

Bill Dunlap w||||@mwdun|@p @end|ng |rom gm@||@com
Thu Feb 18 19:43:18 CET 2021


Hi Paul,

I think that changing the Fortran logicals to integers is the easiest
way to fix this up.

In the old days (1990's and maybe later), there were Fortran compilers
that did not map .TRUE. to 1 and .FALSE. to 0, but I suspect that R's
.Fortran does not cater to them.  I avoid Fortran logicals out of
habit.

-Bill

On Thu, Feb 18, 2021 at 1:59 AM Paul Schmidt-Walter
<paul.schmidt-walter using posteo.de> wrote:
>
> Hi Bill,
>
> thanks a lot for your suggestion!
>
> I managed to use Gabors Docker image to reproduce the warning... I
> already found a solution, by turning LOGICAL to INTEGER in the F77_CALL
> and declare the subroutines' respective variables as
> integer(kind=c_int)... Was that your suggestion? Or is there an easier way?
>
> Thanks
>
> Paul
>
> On 2/17/21 9:48 PM, Bill Dunlap wrote:
> > I suspect your problem is that, at least with the recent gnu
> > compilers, the Fortran 'c_logical' maps to the C _Bool, not the C int.
> >
> > -Bill
> >
> > On Wed, Feb 17, 2021 at 11:38 AM Paul Schmidt-Walter
> > <paul.schmidt-walter using posteo.de> wrote:
> >> 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.
> >>
> >> ---
> >>
> >> ______________________________________________
> >> R-package-devel using r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
> --
> Paul Schmidt-Walter
> Eckernförder Str. 66
> 24116 Kiel
>



More information about the R-package-devel mailing list