r-hub / containers

Docker containers for R-hub
https://r-hub.github.io/containers/
15 stars 4 forks source link

Support LTO checks #55

Closed krlmlr closed 8 months ago

krlmlr commented 8 months ago

Can be a lightweight extension of the gcc13 image. Upstream: https://www.stats.ox.ac.uk/pub/bdr/LTO/README.txt .

I made it work for myself with the following ~/.R/Makevars :

CFLAGS := $(CFLAGS) -flto=10
FFLAGS := $(FFLAGS) -flto=10
CXXFLAGS := $(CXXFLAGS) -flto=10

Unlike the upstream doc, I don't need --use-LTO for R CMD INSTALL . to enable this. But there might be a much nicer way to configure the gcc-13 image to listen to the --use-LTO flag?

krlmlr commented 8 months ago

Much cleaner by editing /opt/R/devel-gcc13/lib/R/etc/Makeconf :

LTO_OPT = -flto=10 
LTO_FC_OPT = -flto=10

Then this image can be used for both LTO (with --use-LTO) and non-LTO (without that switch) builds of R packages.

Are there any downsides?