[R-pkg-devel] Non-portable flags.

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Wed Jun 5 00:42:44 CEST 2019

I am working on a revision of my Iso package (which hasn't been revised 
for quite a while) and have added in registration of Fortran routines 
that are called directly by .Fortran() in R functions.

When I do

     R CMD check --as-cran Iso_0.0-18.tar.gz

I get a "NOTE":

> Compilation used the following non-portable flag(s):
>   ‘-Wdate-time’ ‘-Werror=format-security’ ‘-Wformat’

After experimenting with building a *.so file directly using SHLIB I 
discerned that the problem appears to arise from the compilation of the 
init.c file that I placed in "src" to effect the routine registration:

> gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG     -fpic  -g -O2
> -fdebug-prefix-map=/build/r-base-VAQCff/r-base-3.6.0=.
> -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
> -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o

I presume that I should do something about this note.  (Non-portability 
is indeed an egregious sin.)  How can I tell gcc not to use these flags?

Note that the NOTE does not arise unless I use the "--as-cran" flag.

Thanks for any insight.


Rolf Turner

P.S. I am running Ubuntu 18.04.  Happy to supply any further details 
that might be relevant.

R. T.

Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

More information about the R-package-devel mailing list