[R-pkg-devel] compilation flags WARNING

Heather Turner ht @ending from he@therturner@net
Thu Jul 5 17:43:19 CEST 2018

On Thu, Jul 5, 2018, at 3:39 PM, Iñaki Úcar wrote:
> El jue., 5 jul. 2018 a las 16:11, Göran Broström
> (<goran.brostrom using umu.se>) escribió:
> >
> > I am preparing a CRAN release of eha (a trivial change due to a change
> > in the survival package), but when checking the build I get:
> >
> > goran using M6800:~/R$ R CMD check --as-cran eha_2.5.2.tar.gz
> > ...
> > * checking compilation flags used ... WARNING
> > Compilation used the following non-portable flag(s):
> >    ‘-Wdate-time’ ‘-Werror=format-security’ ‘-Wformat’
> > ...
> AFAIK, these are new checks. I get similar warnings on Fedora for
> different flags.
> > I have never seen this before and I haven't (to my knowledge) set any
> > compilation flags. It is my first build and check on a newly upgraded
> > ubuntu 18.04 (no issues on 17.10). Should I perhaps ask on r-sig-debian,
> > or is that observation irrelevant?
> Again AFAIK (there are package maintainers for several distros here
> that can correct me if I'm wrong), each distro defines some policies
> regarding compilation flags that are applied to all packages by
> default. So these warnings can be safely ignored locally (or you may
> override them), because those flags won't be defined on CRAN.
Yes, by default the compilation flags are those set when R was installed. You can see the current flags via


which in your case should include  ‘-Wdate-time’ etc.

As Iñaki says you can safely ignore the warning, but if you prefer to not to have any warnings you can solve this by creating a Makevars.site file with CFLAGS excluding the non-portable ones, e.g.

CFLAGS=-Wall -g O0 -fPIC

This should be saved in the /etc directory of R.home(), e.g. /usr/lib/R/etc.

See https://cran.r-project.org/doc/manuals/r-release/R-admin.html#Customizing-package-compilation for more information.


> Iñaki
> >
> > Göran Broström
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel

More information about the R-package-devel mailing list